From 8454bd8c86af37d9a7d7db4d1611bca82e7a4c22 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 6 Oct 2024 02:49:26 +0800 Subject: [PATCH 01/29] Update to TDLib 1.8.37 --- client/function.go | 266 +++++++++++++++-- client/type.go | 678 +++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 329 +++++++++++++++++++- data/td_api.tl | 271 ++++++++++++----- 4 files changed, 1392 insertions(+), 152 deletions(-) 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; From 4330cb2fa104fef541892e63b70d48fd58e1f653 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 1 Nov 2024 06:19:36 +0800 Subject: [PATCH 02/29] Update to TDLib 1.8.39 --- client/function.go | 90 +++-------- client/type.go | 344 +++++++++++++++++++----------------------- client/unmarshaler.go | 106 ++++++------- data/td_api.tl | 202 +++++++++++++------------ 4 files changed, 325 insertions(+), 417 deletions(-) diff --git a/client/function.go b/client/function.go index ca360f0..087d17c 100755 --- a/client/function.go +++ b/client/function.go @@ -1828,32 +1828,6 @@ func (client *Client) SearchChatsOnServer(req *SearchChatsOnServerRequest) (*Cha return UnmarshalChats(result.Data) } -type SearchChatsNearbyRequest struct { - // Current user location - Location *Location `json:"location"` -} - -// 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{ - Type: "searchChatsNearby", - }, - Data: map[string]interface{}{ - "location": req.Location, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalChatsNearby(result.Data) -} - // Returns a list of channel chats recommended to the current user func (client *Client) GetRecommendedChats() (*Chats, error) { result, err := client.Send(Request{ @@ -2939,6 +2913,8 @@ func (client *Client) SearchPublicMessagesByTag(req *SearchPublicMessagesByTagRe } type SearchPublicStoriesByTagRequest struct { + // Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats + StorySenderChatId int64 `json:"story_sender_chat_id"` // Hashtag or cashtag to search for Tag string `json:"tag"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -2954,6 +2930,7 @@ func (client *Client) SearchPublicStoriesByTag(req *SearchPublicStoriesByTagRequ Type: "searchPublicStoriesByTag", }, Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, "tag": req.Tag, "offset": req.Offset, "limit": req.Limit, @@ -3379,7 +3356,7 @@ type GetChatSponsoredMessagesRequest struct { ChatId int64 `json:"chat_id"` } -// Returns sponsored messages to be shown in a chat; for channel chats only +// Returns sponsored messages to be shown in a chat; for channel chats and chats with bots only func (client *Client) GetChatSponsoredMessages(req *GetChatSponsoredMessagesRequest) (*SponsoredMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -3982,7 +3959,7 @@ type ForwardMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` - // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local + // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // Pass true to remove media captions of message copies. Ignored if send_copy is false RemoveCaption bool `json:"remove_caption"` @@ -4321,7 +4298,7 @@ func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationReques type EditMessageMediaRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited + // Identifier of the message. Use messageProperties.can_edit_media to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` @@ -4329,7 +4306,7 @@ type EditMessageMediaRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side +// Edits the media content of a message, including message caption. If only the caption needs to be edited, use editMessageCaption instead. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side func (client *Client) EditMessageMedia(req *EditMessageMediaRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -4505,7 +4482,7 @@ type EditInlineMessageMediaRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only +// Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only func (client *Client) EditInlineMessageMedia(req *EditInlineMessageMediaRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4597,7 +4574,7 @@ type EditMessageSchedulingStateRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message. Use messageProperties.can_edit_scheduling_state to check whether the message is suitable MessageId int64 `json:"message_id"` - // The new message scheduling state; pass null to send the message immediately + // The new message scheduling state; pass null to send the message immediately. Must be null for messages in the state messageSchedulingStateSendWhenVideoProcessed SchedulingState MessageSchedulingState `json:"scheduling_state"` } @@ -4845,7 +4822,7 @@ type EditBusinessMessageMediaRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the content of a message with an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only +// Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only func (client *Client) EditBusinessMessageMedia(req *EditBusinessMessageMediaRequest) (*BusinessMessage, error) { result, err := client.Send(Request{ meta: meta{ @@ -5342,7 +5319,7 @@ type EditQuickReplyMessageRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Text message can be edited only to a text message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Media message can be edited only to a media message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa func (client *Client) EditQuickReplyMessage(req *EditQuickReplyMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6035,7 +6012,7 @@ type SetMessageReactionsRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Types of the reaction to set + // Types of the reaction to set; pass an empty list to remove the reactions ReactionTypes []ReactionType `json:"reaction_types"` // Pass true if the reactions are added with a big animation IsBig bool `json:"is_big"` @@ -14932,6 +14909,8 @@ func (client *Client) GetStickerSetName(req *GetStickerSetNameRequest) (*Text, e type SearchStickerSetRequest struct { // Name of the sticker set Name string `json:"name"` + // Pass true to ignore local cache of sticker sets and always send a network request + IgnoreCache bool `json:"ignore_cache"` } // Searches for a sticker set by its name @@ -14942,6 +14921,7 @@ func (client *Client) SearchStickerSet(req *SearchStickerSetRequest) (*StickerSe }, Data: map[string]interface{}{ "name": req.Name, + "ignore_cache": req.IgnoreCache, }, }) if err != nil { @@ -16059,32 +16039,6 @@ func (client *Client) SetEmojiStatus(req *SetEmojiStatusRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -type SetLocationRequest struct { - // The new location of the user - Location *Location `json:"location"` -} - -// Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer. Must not be called if the user has a business location -func (client *Client) SetLocation(req *SetLocationRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "setLocation", - }, - Data: map[string]interface{}{ - "location": req.Location, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type ToggleHasSponsoredMessagesEnabledRequest struct { // Pass true to enable sponsored messages for the current user; false to disable them HasSponsoredMessagesEnabled bool `json:"has_sponsored_messages_enabled"` @@ -18513,7 +18467,7 @@ type SendGiftRequest struct { IsPrivate bool `json:"is_private"` } -// Send a gift to another user +// Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19773,7 +19727,7 @@ type GetChatRevenueStatisticsRequest struct { IsDark bool `json:"is_dark"` } -// Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +// Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true func (client *Client) GetChatRevenueStatistics(req *GetChatRevenueStatisticsRequest) (*ChatRevenueStatistics, error) { result, err := client.Send(Request{ meta: meta{ @@ -19802,7 +19756,7 @@ type GetChatRevenueWithdrawalUrlRequest struct { Password string `json:"password"` } -// Returns a URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue") +// Returns a URL for chat revenue withdrawal; requires owner privileges in the channel chat or the bot. Currently, this method can be used only if getOption("can_withdraw_chat_revenue") for channels with supergroupFullInfo.can_get_revenue_statistics == true or bots with userFullInfo.bot_info.can_get_revenue_statistics == true func (client *Client) GetChatRevenueWithdrawalUrl(req *GetChatRevenueWithdrawalUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -19833,7 +19787,7 @@ type GetChatRevenueTransactionsRequest struct { Limit int32 `json:"limit"` } -// Returns the list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +// Returns the list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactionsRequest) (*ChatRevenueTransactions, error) { result, err := client.Send(Request{ meta: meta{ @@ -23331,6 +23285,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(result.Data) + case TypeUpdateVideoPublished: + return UnmarshalUpdateVideoPublished(result.Data) + case TypeUpdateNewChat: return UnmarshalUpdateNewChat(result.Data) @@ -23619,9 +23576,6 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(result.Data) - case TypeUpdateUsersNearby: - return UnmarshalUpdateUsersNearby(result.Data) - case TypeUpdateUnconfirmedSession: return UnmarshalUpdateUnconfirmedSession(result.Data) diff --git a/client/type.go b/client/type.go index 0305533..348df90 100755 --- a/client/type.go +++ b/client/type.go @@ -344,8 +344,6 @@ const ( ClassFailedToAddMember = "FailedToAddMember" ClassFailedToAddMembers = "FailedToAddMembers" ClassCreatedBasicGroupChat = "CreatedBasicGroupChat" - ClassChatNearby = "ChatNearby" - ClassChatsNearby = "ChatsNearby" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" ClassFoundWebApp = "FoundWebApp" @@ -741,6 +739,7 @@ const ( TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" TypeStarTransactionPartnerFragment = "starTransactionPartnerFragment" TypeStarTransactionPartnerTelegramAds = "starTransactionPartnerTelegramAds" + TypeStarTransactionPartnerTelegramApi = "starTransactionPartnerTelegramApi" TypeStarTransactionPartnerBot = "starTransactionPartnerBot" TypeStarTransactionPartnerBusiness = "starTransactionPartnerBusiness" TypeStarTransactionPartnerChat = "starTransactionPartnerChat" @@ -929,12 +928,9 @@ const ( TypeFailedToAddMember = "failedToAddMember" TypeFailedToAddMembers = "failedToAddMembers" TypeCreatedBasicGroupChat = "createdBasicGroupChat" - TypeChatNearby = "chatNearby" - TypeChatsNearby = "chatsNearby" TypePublicChatTypeHasUsername = "publicChatTypeHasUsername" TypePublicChatTypeIsLocationBased = "publicChatTypeIsLocationBased" TypeChatActionBarReportSpam = "chatActionBarReportSpam" - TypeChatActionBarReportUnrelatedLocation = "chatActionBarReportUnrelatedLocation" TypeChatActionBarInviteMembers = "chatActionBarInviteMembers" TypeChatActionBarReportAddBlock = "chatActionBarReportAddBlock" TypeChatActionBarAddContact = "chatActionBarAddContact" @@ -1287,6 +1283,7 @@ const ( TypeInputPaidMedia = "inputPaidMedia" TypeMessageSchedulingStateSendAtDate = "messageSchedulingStateSendAtDate" TypeMessageSchedulingStateSendWhenOnline = "messageSchedulingStateSendWhenOnline" + TypeMessageSchedulingStateSendWhenVideoProcessed = "messageSchedulingStateSendWhenVideoProcessed" TypeMessageSelfDestructTypeTimer = "messageSelfDestructTypeTimer" TypeMessageSelfDestructTypeImmediately = "messageSelfDestructTypeImmediately" TypeMessageSendOptions = "messageSendOptions" @@ -1663,7 +1660,6 @@ const ( TypeBusinessFeaturePromotionAnimation = "businessFeaturePromotionAnimation" TypePremiumState = "premiumState" TypeStorePaymentPurposePremiumSubscription = "storePaymentPurposePremiumSubscription" - TypeStorePaymentPurposeGiftedPremium = "storePaymentPurposeGiftedPremium" TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" TypeStorePaymentPurposeStarGiveaway = "storePaymentPurposeStarGiveaway" @@ -2054,6 +2050,7 @@ const ( TypeUpdateMessageUnreadReactions = "updateMessageUnreadReactions" TypeUpdateMessageFactCheck = "updateMessageFactCheck" TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" + TypeUpdateVideoPublished = "updateVideoPublished" TypeUpdateNewChat = "updateNewChat" TypeUpdateChatTitle = "updateChatTitle" TypeUpdateChatPhoto = "updateChatPhoto" @@ -2150,7 +2147,6 @@ const ( TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" TypeUpdateTermsOfService = "updateTermsOfService" - TypeUpdateUsersNearby = "updateUsersNearby" TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" @@ -7317,7 +7313,7 @@ type StarSubscriptions struct { meta // The amount of owned Telegram Stars StarCount int64 `json:"star_count"` - // List of subbscriptions for Telegram Stars + // List of subscriptions for Telegram Stars Subscriptions []*StarSubscription `json:"subscriptions"` // The number of Telegram Stars required to buy to extend subscriptions expiring soon RequiredStarCount int64 `json:"required_star_count"` @@ -7464,6 +7460,8 @@ type PremiumGiftCodePaymentOption struct { Currency string `json:"currency"` // The amount to pay, in the smallest units of the currency Amount int64 `json:"amount"` + // The discount associated with this option, as a percentage + DiscountPercentage int32 `json:"discount_percentage"` // Number of users which will be able to activate the gift codes WinnerCount int32 `json:"winner_count"` // Number of months the Telegram Premium subscription will be active @@ -7472,6 +7470,8 @@ type PremiumGiftCodePaymentOption struct { StoreProductId string `json:"store_product_id"` // Number of times the store product must be paid StoreProductQuantity int32 `json:"store_product_quantity"` + // A sticker to be shown along with the gift code; may be null if unknown + Sticker *Sticker `json:"sticker"` } func (entity *PremiumGiftCodePaymentOption) MarshalJSON() ([]byte, error) { @@ -7729,10 +7729,14 @@ type Gift struct { 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 + // Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out 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"` + // Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only + FirstSendDate int32 `json:"first_send_date"` + // Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only + LastSendDate int32 `json:"last_send_date"` } func (entity *Gift) MarshalJSON() ([]byte, error) { @@ -7891,7 +7895,7 @@ func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { // Paid media were bought type BotTransactionPurposePaidMedia struct { meta - // The bought media if the trancastion wasn't refunded + // The bought media if the transaction wasn't refunded Media []PaidMedia `json:"media"` // Bot-provided payload; for bots only Payload string `json:"payload"` @@ -7970,7 +7974,7 @@ type ChatTransactionPurposePaidMedia struct { meta // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message MessageId int64 `json:"message_id"` - // The bought media if the trancastion wasn't refunded + // The bought media if the transaction wasn't refunded Media []PaidMedia `json:"media"` } @@ -8253,7 +8257,7 @@ func (*StarTransactionPartnerGooglePlay) StarTransactionPartnerType() string { // The transaction is a transaction with Fragment type StarTransactionPartnerFragment struct { meta - // State of the withdrawal; may be null for refunds from Fragment + // State of the withdrawal; may be null for refunds from Fragment or for Telegram Stars bought on Fragment WithdrawalState RevenueWithdrawalState `json:"withdrawal_state"` } @@ -8318,6 +8322,33 @@ func (*StarTransactionPartnerTelegramAds) StarTransactionPartnerType() string { return TypeStarTransactionPartnerTelegramAds } +// The transaction is a transaction with Telegram for API usage +type StarTransactionPartnerTelegramApi struct { + meta + // The number of billed requests + RequestCount int32 `json:"request_count"` +} + +func (entity *StarTransactionPartnerTelegramApi) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionPartnerTelegramApi + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionPartnerTelegramApi) GetClass() string { + return ClassStarTransactionPartner +} + +func (*StarTransactionPartnerTelegramApi) GetType() string { + return TypeStarTransactionPartnerTelegramApi +} + +func (*StarTransactionPartnerTelegramApi) StarTransactionPartnerType() string { + return TypeStarTransactionPartnerTelegramApi +} + // The transaction is a transaction with a bot type StarTransactionPartnerBot struct { meta @@ -8371,7 +8402,7 @@ type StarTransactionPartnerBusiness struct { meta // Identifier of the business account user UserId int64 `json:"user_id"` - // The bought media if the trancastion wasn't refunded + // The bought media if the transaction wasn't refunded Media []PaidMedia `json:"media"` } @@ -8462,7 +8493,7 @@ func (starTransactionPartnerChat *StarTransactionPartnerChat) UnmarshalJSON(data return nil } -// The transaction is a transcation with another user +// The transaction is a transaction with another user type StarTransactionPartnerUser struct { meta // Identifier of the user; 0 if the user was anonymous @@ -9235,6 +9266,8 @@ type BotInfo struct { DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` // Default administrator rights for adding the bot to channels; may be null DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + // True, if the bot's revenue statistics are available + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` // True, if the bot has media previews HasMediaPreviews bool `json:"has_media_previews"` // The internal link, which can be used to edit bot commands; may be null @@ -9274,6 +9307,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { PrivacyPolicyUrl string `json:"privacy_policy_url"` DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` HasMediaPreviews bool `json:"has_media_previews"` EditCommandsLink json.RawMessage `json:"edit_commands_link"` EditDescriptionLink json.RawMessage `json:"edit_description_link"` @@ -9295,6 +9329,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.PrivacyPolicyUrl = tmp.PrivacyPolicyUrl botInfo.DefaultGroupAdministratorRights = tmp.DefaultGroupAdministratorRights botInfo.DefaultChannelAdministratorRights = tmp.DefaultChannelAdministratorRights + botInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics botInfo.HasMediaPreviews = tmp.HasMediaPreviews fieldEditCommandsLink, _ := UnmarshalInternalLinkType(tmp.EditCommandsLink) @@ -9347,8 +9382,6 @@ type UserFullInfo struct { Birthdate *Birthdate `json:"birthdate"` // Identifier of the personal chat of the user; 0 if none 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 @@ -9393,7 +9426,6 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { Bio *FormattedText `json:"bio"` 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"` @@ -9420,7 +9452,6 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.Bio = tmp.Bio userFullInfo.Birthdate = tmp.Birthdate userFullInfo.PersonalChatId = tmp.PersonalChatId - userFullInfo.PremiumGiftOptions = tmp.PremiumGiftOptions userFullInfo.GiftCount = tmp.GiftCount userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount userFullInfo.BusinessInfo = tmp.BusinessInfo @@ -10735,7 +10766,7 @@ type Supergroup struct { Date int32 `json:"date"` // Status of the current user in the supergroup or channel; custom title will always be empty Status ChatMemberStatus `json:"status"` - // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards and foundStories + // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards and foundStories MemberCount int32 `json:"member_count"` // Approximate boost level for the chat BoostLevel int32 `json:"boost_level"` @@ -12492,9 +12523,9 @@ type Message struct { IsTopicMessage bool `json:"is_topic_message"` // True, if the message contains an unread mention for the current user ContainsUnreadMention bool `json:"contains_unread_mention"` - // Point in time (Unix timestamp) when the message was sent + // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages Date int32 `json:"date"` - // Point in time (Unix timestamp) when the message was last edited + // Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages EditDate int32 `json:"edit_date"` // Information about the initial message sender; may be null if none or unknown ForwardInfo *MessageForwardInfo `json:"forward_info"` @@ -14979,56 +15010,6 @@ func (*CreatedBasicGroupChat) GetType() string { return TypeCreatedBasicGroupChat } -// Describes a chat located nearby -type ChatNearby struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // Distance to the chat location, in meters - Distance int32 `json:"distance"` -} - -func (entity *ChatNearby) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatNearby - - return json.Marshal((*stub)(entity)) -} - -func (*ChatNearby) GetClass() string { - return ClassChatNearby -} - -func (*ChatNearby) GetType() string { - return TypeChatNearby -} - -// Represents a list of chats located nearby -type ChatsNearby struct { - meta - // List of users nearby - UsersNearby []*ChatNearby `json:"users_nearby"` - // List of location-based supergroups nearby - SupergroupsNearby []*ChatNearby `json:"supergroups_nearby"` -} - -func (entity *ChatsNearby) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatsNearby - - return json.Marshal((*stub)(entity)) -} - -func (*ChatsNearby) GetClass() string { - return ClassChatsNearby -} - -func (*ChatsNearby) GetType() string { - return TypeChatsNearby -} - // The chat is public, because it has an active username type PublicChatTypeHasUsername struct{ meta @@ -15079,7 +15060,7 @@ func (*PublicChatTypeIsLocationBased) PublicChatTypeType() string { return TypePublicChatTypeIsLocationBased } -// The chat can be reported as spam using the method reportChat with the reason reportReasonSpam. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown +// The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown type ChatActionBarReportSpam struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings @@ -15106,31 +15087,6 @@ func (*ChatActionBarReportSpam) ChatActionBarType() string { return TypeChatActionBarReportSpam } -// The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason reportReasonUnrelatedLocation -type ChatActionBarReportUnrelatedLocation struct{ - meta -} - -func (entity *ChatActionBarReportUnrelatedLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActionBarReportUnrelatedLocation - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActionBarReportUnrelatedLocation) GetClass() string { - return ClassChatActionBar -} - -func (*ChatActionBarReportUnrelatedLocation) GetType() string { - return TypeChatActionBarReportUnrelatedLocation -} - -func (*ChatActionBarReportUnrelatedLocation) ChatActionBarType() string { - return TypeChatActionBarReportUnrelatedLocation -} - // The chat is a recently created group chat to which new members can be invited type ChatActionBarInviteMembers struct{ meta @@ -15161,8 +15117,6 @@ type ChatActionBarReportAddBlock struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings CanUnarchive bool `json:"can_unarchive"` - // If non-negative, the current user was found by the other user through searchChatsNearby and this is the distance between the users - Distance int32 `json:"distance"` } func (entity *ChatActionBarReportAddBlock) MarshalJSON() ([]byte, error) { @@ -19711,7 +19665,7 @@ type LinkPreviewTypeTheme struct { meta // The list of files with theme description Documents []*Document `json:"documents"` - // Settings for the cloud theme + // Settings for the cloud theme; may be null if unknown Settings *ThemeSettings `json:"settings"` } @@ -19902,7 +19856,7 @@ func (*LinkPreviewTypeVoiceNote) LinkPreviewTypeType() string { // The link is a link to a Web App type LinkPreviewTypeWebApp struct { meta - // Web App photo + // Web App photo; may be null if none Photo *Photo `json:"photo"` } @@ -20299,35 +20253,35 @@ func (*LocationAddress) GetType() string { // Contains parameters of the application theme type ThemeParameters struct { meta - // A color of the background in the RGB24 format + // A color of the background in the RGB format BackgroundColor int32 `json:"background_color"` - // A secondary color for the background in the RGB24 format + // A secondary color for the background in the RGB format SecondaryBackgroundColor int32 `json:"secondary_background_color"` - // A color of the header background in the RGB24 format + // A color of the header background in the RGB format HeaderBackgroundColor int32 `json:"header_background_color"` - // A color of the bottom bar background in the RGB24 format + // A color of the bottom bar background in the RGB format BottomBarBackgroundColor int32 `json:"bottom_bar_background_color"` - // A color of the section background in the RGB24 format + // A color of the section background in the RGB format SectionBackgroundColor int32 `json:"section_background_color"` - // A color of the section separator in the RGB24 format + // A color of the section separator in the RGB format SectionSeparatorColor int32 `json:"section_separator_color"` - // A color of text in the RGB24 format + // A color of text in the RGB format TextColor int32 `json:"text_color"` - // An accent color of the text in the RGB24 format + // An accent color of the text in the RGB format AccentTextColor int32 `json:"accent_text_color"` - // A color of text on the section headers in the RGB24 format + // A color of text on the section headers in the RGB format SectionHeaderTextColor int32 `json:"section_header_text_color"` - // A color of the subtitle text in the RGB24 format + // A color of the subtitle text in the RGB format SubtitleTextColor int32 `json:"subtitle_text_color"` - // A color of the text for destructive actions in the RGB24 format + // A color of the text for destructive actions in the RGB format DestructiveTextColor int32 `json:"destructive_text_color"` - // A color of hints in the RGB24 format + // A color of hints in the RGB format HintColor int32 `json:"hint_color"` - // A color of links in the RGB24 format + // A color of links in the RGB format LinkColor int32 `json:"link_color"` - // A color of the buttons in the RGB24 format + // A color of the buttons in the RGB format ButtonColor int32 `json:"button_color"` - // A color of text on the buttons in the RGB24 format + // A color of text on the buttons in the RGB format ButtonTextColor int32 `json:"button_text_color"` } @@ -21050,7 +21004,7 @@ type InputInvoiceMessage struct { meta // Chat identifier of the message ChatId int64 `json:"chat_id"` - // Message identifier + // Message identifier. Use messageProperties.can_be_paid to check whether the message can be used in the method MessageId int64 `json:"message_id"` } @@ -25201,6 +25155,8 @@ type MessageGiftedPremium struct { GifterUserId int64 `json:"gifter_user_id"` // The identifier of a user that received Telegram Premium; 0 if the gift is incoming ReceiverUserId int64 `json:"receiver_user_id"` + // Message added to the gifted Telegram Premium by the sender + Text *FormattedText `json:"text"` // Currency for the paid amount Currency string `json:"currency"` // The paid amount, in the smallest units of the currency @@ -25240,6 +25196,8 @@ type MessagePremiumGiftCode struct { meta // Identifier of a chat or a user that created the gift code; may be null if unknown CreatorId MessageSender `json:"creator_id"` + // Message added to the gift + Text *FormattedText `json:"text"` // True, if the gift code was created for a giveaway IsFromGiveaway bool `json:"is_from_giveaway"` // True, if the winner for the corresponding Telegram Premium subscription wasn't chosen @@ -25283,6 +25241,7 @@ func (*MessagePremiumGiftCode) MessageContentType() string { func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) error { var tmp struct { CreatorId json.RawMessage `json:"creator_id"` + Text *FormattedText `json:"text"` IsFromGiveaway bool `json:"is_from_giveaway"` IsUnclaimed bool `json:"is_unclaimed"` Currency string `json:"currency"` @@ -25299,6 +25258,7 @@ func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) return err } + messagePremiumGiftCode.Text = tmp.Text messagePremiumGiftCode.IsFromGiveaway = tmp.IsFromGiveaway messagePremiumGiftCode.IsUnclaimed = tmp.IsUnclaimed messagePremiumGiftCode.Currency = tmp.Currency @@ -25990,7 +25950,7 @@ func (*TextEntityTypeMention) TextEntityTypeType() string { return TypeTextEntityTypeMention } -// A hashtag text, beginning with "#" +// A hashtag text, beginning with "#" and optionally containing a chat username at the end type TextEntityTypeHashtag struct{ meta } @@ -26015,7 +25975,7 @@ func (*TextEntityTypeHashtag) TextEntityTypeType() string { return TypeTextEntityTypeHashtag } -// A cashtag text, beginning with "$" and consisting of capital English letters (e.g., "$USD") +// A cashtag text, beginning with "$", consisting of capital English letters (e.g., "$USD"), and optionally containing a chat username at the end type TextEntityTypeCashtag struct{ meta } @@ -26741,6 +26701,33 @@ func (*MessageSchedulingStateSendWhenOnline) MessageSchedulingStateType() string return TypeMessageSchedulingStateSendWhenOnline } +// The message will be sent when the video in the message is converted and optimized; can be used only by the server +type MessageSchedulingStateSendWhenVideoProcessed struct { + meta + // Approximate point in time (Unix timestamp) when the message is expected to be sent + SendDate int32 `json:"send_date"` +} + +func (entity *MessageSchedulingStateSendWhenVideoProcessed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSchedulingStateSendWhenVideoProcessed + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSchedulingStateSendWhenVideoProcessed) GetClass() string { + return ClassMessageSchedulingState +} + +func (*MessageSchedulingStateSendWhenVideoProcessed) GetType() string { + return TypeMessageSchedulingStateSendWhenVideoProcessed +} + +func (*MessageSchedulingStateSendWhenVideoProcessed) MessageSchedulingStateType() string { + return TypeMessageSchedulingStateSendWhenVideoProcessed +} + // The message will be self-destructed in the specified time after its content was opened type MessageSelfDestructTypeTimer struct { meta @@ -26802,6 +26789,8 @@ type MessageSendOptions struct { FromBackground bool `json:"from_background"` // Pass true if the content of the message must be protected from forwarding and saving; for bots only ProtectContent bool `json:"protect_content"` + // Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only + AllowPaidBroadcast bool `json:"allow_paid_broadcast"` // Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled @@ -26835,6 +26824,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { DisableNotification bool `json:"disable_notification"` FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast"` UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` SchedulingState json.RawMessage `json:"scheduling_state"` EffectId JsonInt64 `json:"effect_id"` @@ -26850,6 +26840,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { messageSendOptions.DisableNotification = tmp.DisableNotification messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent + messageSendOptions.AllowPaidBroadcast = tmp.AllowPaidBroadcast messageSendOptions.UpdateOrderOfInstalledStickerSets = tmp.UpdateOrderOfInstalledStickerSets messageSendOptions.EffectId = tmp.EffectId messageSendOptions.SendingId = tmp.SendingId @@ -26864,7 +26855,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { // Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied type MessageCopyOptions struct { meta - // 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 + // 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. Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false ReplaceCaption bool `json:"replace_caption"` @@ -27379,7 +27370,7 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { // A video note message type InputMessageVideoNote struct { meta - // Video note to be sent + // Video note to be sent. The video is expected to be encoded to MPEG4 format with H.264 codec and have no data outside of the visible circle VideoNote InputFile `json:"video_note"` // Video thumbnail; may be null if empty; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` @@ -27835,7 +27826,7 @@ type MessageProperties struct { CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` // True, if the message can be deleted for all users using the method deleteMessages with revoke == true CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - // True, if the message can be edited using the methods editMessageText, editMessageMedia, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message + // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message CanBeEdited bool `json:"can_be_edited"` // True, if the message can be forwarded using inputMessageForwarded or forwardMessages CanBeForwarded bool `json:"can_be_forwarded"` @@ -27851,6 +27842,8 @@ type MessageProperties struct { CanBeSaved bool `json:"can_be_saved"` // True, if the message can be shared in a story using inputStoryAreaTypeMessage CanBeSharedInStory bool `json:"can_be_shared_in_story"` + // True, if the message can be edited using the method editMessageMedia + CanEditMedia bool `json:"can_edit_media"` // True, if scheduling state of the message can be edited CanEditSchedulingState bool `json:"can_edit_scheduling_state"` // True, if code for message embedding can be received using getMessageEmbeddingCode @@ -33544,9 +33537,9 @@ func (*BusinessConnection) GetType() string { // Describes a color to highlight a bot added to attachment menu type AttachmentMenuBotColor struct { meta - // Color in the RGB24 format for light themes + // Color in the RGB format for light themes LightColor int32 `json:"light_color"` - // Color in the RGB24 format for dark themes + // Color in the RGB format for dark themes DarkColor int32 `json:"dark_color"` } @@ -39389,37 +39382,6 @@ func (*StorePaymentPurposePremiumSubscription) StorePaymentPurposeType() string return TypeStorePaymentPurposePremiumSubscription } -// The user gifting Telegram Premium to another user -type StorePaymentPurposeGiftedPremium struct { - meta - // Identifier of the user to which Telegram Premium is gifted - UserId int64 `json:"user_id"` - // ISO 4217 currency code of the payment currency - Currency string `json:"currency"` - // Paid amount, in the smallest units of the currency - Amount int64 `json:"amount"` -} - -func (entity *StorePaymentPurposeGiftedPremium) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StorePaymentPurposeGiftedPremium - - return json.Marshal((*stub)(entity)) -} - -func (*StorePaymentPurposeGiftedPremium) GetClass() string { - return ClassStorePaymentPurpose -} - -func (*StorePaymentPurposeGiftedPremium) GetType() string { - return TypeStorePaymentPurposeGiftedPremium -} - -func (*StorePaymentPurposeGiftedPremium) StorePaymentPurposeType() string { - return TypeStorePaymentPurposeGiftedPremium -} - // The user creating Telegram Premium gift codes for other users type StorePaymentPurposePremiumGiftCodes struct { meta @@ -39431,6 +39393,8 @@ type StorePaymentPurposePremiumGiftCodes struct { Amount int64 `json:"amount"` // Identifiers of the users which can activate the gift codes UserIds []int64 `json:"user_ids"` + // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` } func (entity *StorePaymentPurposePremiumGiftCodes) MarshalJSON() ([]byte, error) { @@ -39596,6 +39560,8 @@ type TelegramPaymentPurposePremiumGiftCodes struct { UserIds []int64 `json:"user_ids"` // Number of months the Telegram Premium subscription will be active for the users MonthCount int32 `json:"month_count"` + // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` } func (entity *TelegramPaymentPurposePremiumGiftCodes) MarshalJSON() ([]byte, error) { @@ -40143,7 +40109,7 @@ func (*PushReceiverId) GetType() string { // Describes a solid fill of a background type BackgroundFillSolid struct { meta - // A color of the background in the RGB24 format + // A color of the background in the RGB format Color int32 `json:"color"` } @@ -40170,9 +40136,9 @@ func (*BackgroundFillSolid) BackgroundFillType() string { // Describes a gradient fill of a background type BackgroundFillGradient struct { meta - // A top color of the background in the RGB24 format + // A top color of the background in the RGB format TopColor int32 `json:"top_color"` - // A bottom color of the background in the RGB24 format + // A bottom color of the background in the RGB format BottomColor int32 `json:"bottom_color"` // Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible by 45 RotationAngle int32 `json:"rotation_angle"` @@ -40201,7 +40167,7 @@ func (*BackgroundFillGradient) BackgroundFillType() string { // Describes a freeform gradient fill of a background type BackgroundFillFreeformGradient struct { meta - // A list of 3 or 4 colors of the freeform gradient in the RGB24 format + // A list of 3 or 4 colors of the freeform gradient in the RGB format Colors []int32 `json:"colors"` } @@ -45783,7 +45749,7 @@ func (*InternalLinkTypePremiumFeatures) InternalLinkTypeType() string { return TypeInternalLinkTypePremiumFeatures } -// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram payments or in-store purchases +// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGiftCodes payments or in-store purchases type InternalLinkTypePremiumGift struct { meta // Referrer specified in the link @@ -50477,7 +50443,7 @@ func (*UpdateMessageSendAcknowledged) UpdateType() string { // A message has been successfully sent type UpdateMessageSendSucceeded struct { meta - // The sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change + // The sent message. Almost any field of the new message can be different from the corresponding field of the original message. For example, the field scheduling_state may change, making the message scheduled, or non-scheduled Message *Message `json:"message"` // The previous temporary message identifier OldMessageId int64 `json:"old_message_id"` @@ -50857,6 +50823,35 @@ func (*UpdateMessageLiveLocationViewed) UpdateType() string { return TypeUpdateMessageLiveLocationViewed } +// An automatically scheduled message with video has been successfully sent after conversion +type UpdateVideoPublished struct { + meta + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the sent message + MessageId int64 `json:"message_id"` +} + +func (entity *UpdateVideoPublished) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateVideoPublished + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateVideoPublished) GetClass() string { + return ClassUpdate +} + +func (*UpdateVideoPublished) GetType() string { + return TypeUpdateVideoPublished +} + +func (*UpdateVideoPublished) UpdateType() string { + return TypeUpdateVideoPublished +} + // A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the application. The chat field changes will be reported through separate updates type UpdateNewChat struct { meta @@ -54060,33 +54055,6 @@ func (*UpdateTermsOfService) UpdateType() string { return TypeUpdateTermsOfService } -// The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request -type UpdateUsersNearby struct { - meta - // The new list of users nearby - UsersNearby []*ChatNearby `json:"users_nearby"` -} - -func (entity *UpdateUsersNearby) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UpdateUsersNearby - - return json.Marshal((*stub)(entity)) -} - -func (*UpdateUsersNearby) GetClass() string { - return ClassUpdate -} - -func (*UpdateUsersNearby) GetType() string { - return TypeUpdateUsersNearby -} - -func (*UpdateUsersNearby) UpdateType() string { - return TypeUpdateUsersNearby -} - // The first unconfirmed session has changed type UpdateUnconfirmedSession struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index b779a08..7d468fc 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -828,6 +828,9 @@ func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartn case TypeStarTransactionPartnerTelegramAds: return UnmarshalStarTransactionPartnerTelegramAds(data) + case TypeStarTransactionPartnerTelegramApi: + return UnmarshalStarTransactionPartnerTelegramApi(data) + case TypeStarTransactionPartnerBot: return UnmarshalStarTransactionPartnerBot(data) @@ -1853,9 +1856,6 @@ func UnmarshalChatActionBar(data json.RawMessage) (ChatActionBar, error) { case TypeChatActionBarReportSpam: return UnmarshalChatActionBarReportSpam(data) - case TypeChatActionBarReportUnrelatedLocation: - return UnmarshalChatActionBarReportUnrelatedLocation(data) - case TypeChatActionBarInviteMembers: return UnmarshalChatActionBarInviteMembers(data) @@ -3491,6 +3491,9 @@ func UnmarshalMessageSchedulingState(data json.RawMessage) (MessageSchedulingSta case TypeMessageSchedulingStateSendWhenOnline: return UnmarshalMessageSchedulingStateSendWhenOnline(data) + case TypeMessageSchedulingStateSendWhenVideoProcessed: + return UnmarshalMessageSchedulingStateSendWhenVideoProcessed(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -5441,9 +5444,6 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) - case TypeStorePaymentPurposeGiftedPremium: - return UnmarshalStorePaymentPurposeGiftedPremium(data) - case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -7713,6 +7713,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) + case TypeUpdateVideoPublished: + return UnmarshalUpdateVideoPublished(data) + case TypeUpdateNewChat: return UnmarshalUpdateNewChat(data) @@ -8001,9 +8004,6 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) - case TypeUpdateUsersNearby: - return UnmarshalUpdateUsersNearby(data) - case TypeUpdateUnconfirmedSession: return UnmarshalUpdateUnconfirmedSession(data) @@ -9532,6 +9532,14 @@ func UnmarshalStarTransactionPartnerTelegramAds(data json.RawMessage) (*StarTran return &resp, err } +func UnmarshalStarTransactionPartnerTelegramApi(data json.RawMessage) (*StarTransactionPartnerTelegramApi, error) { + var resp StarTransactionPartnerTelegramApi + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionPartnerBot(data json.RawMessage) (*StarTransactionPartnerBot, error) { var resp StarTransactionPartnerBot @@ -11036,22 +11044,6 @@ func UnmarshalCreatedBasicGroupChat(data json.RawMessage) (*CreatedBasicGroupCha return &resp, err } -func UnmarshalChatNearby(data json.RawMessage) (*ChatNearby, error) { - var resp ChatNearby - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalChatsNearby(data json.RawMessage) (*ChatsNearby, error) { - var resp ChatsNearby - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalPublicChatTypeHasUsername(data json.RawMessage) (*PublicChatTypeHasUsername, error) { var resp PublicChatTypeHasUsername @@ -11076,14 +11068,6 @@ func UnmarshalChatActionBarReportSpam(data json.RawMessage) (*ChatActionBarRepor return &resp, err } -func UnmarshalChatActionBarReportUnrelatedLocation(data json.RawMessage) (*ChatActionBarReportUnrelatedLocation, error) { - var resp ChatActionBarReportUnrelatedLocation - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalChatActionBarInviteMembers(data json.RawMessage) (*ChatActionBarInviteMembers, error) { var resp ChatActionBarInviteMembers @@ -13900,6 +13884,14 @@ func UnmarshalMessageSchedulingStateSendWhenOnline(data json.RawMessage) (*Messa return &resp, err } +func UnmarshalMessageSchedulingStateSendWhenVideoProcessed(data json.RawMessage) (*MessageSchedulingStateSendWhenVideoProcessed, error) { + var resp MessageSchedulingStateSendWhenVideoProcessed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSelfDestructTypeTimer(data json.RawMessage) (*MessageSelfDestructTypeTimer, error) { var resp MessageSelfDestructTypeTimer @@ -16908,14 +16900,6 @@ func UnmarshalStorePaymentPurposePremiumSubscription(data json.RawMessage) (*Sto return &resp, err } -func UnmarshalStorePaymentPurposeGiftedPremium(data json.RawMessage) (*StorePaymentPurposeGiftedPremium, error) { - var resp StorePaymentPurposeGiftedPremium - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalStorePaymentPurposePremiumGiftCodes(data json.RawMessage) (*StorePaymentPurposePremiumGiftCodes, error) { var resp StorePaymentPurposePremiumGiftCodes @@ -20036,6 +20020,14 @@ func UnmarshalUpdateMessageLiveLocationViewed(data json.RawMessage) (*UpdateMess return &resp, err } +func UnmarshalUpdateVideoPublished(data json.RawMessage) (*UpdateVideoPublished, error) { + var resp UpdateVideoPublished + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewChat(data json.RawMessage) (*UpdateNewChat, error) { var resp UpdateNewChat @@ -20804,14 +20796,6 @@ func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, return &resp, err } -func UnmarshalUpdateUsersNearby(data json.RawMessage) (*UpdateUsersNearby, error) { - var resp UpdateUsersNearby - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalUpdateUnconfirmedSession(data json.RawMessage) (*UpdateUnconfirmedSession, error) { var resp UpdateUnconfirmedSession @@ -21760,6 +21744,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionPartnerTelegramAds: return UnmarshalStarTransactionPartnerTelegramAds(data) + case TypeStarTransactionPartnerTelegramApi: + return UnmarshalStarTransactionPartnerTelegramApi(data) + case TypeStarTransactionPartnerBot: return UnmarshalStarTransactionPartnerBot(data) @@ -22324,12 +22311,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCreatedBasicGroupChat: return UnmarshalCreatedBasicGroupChat(data) - case TypeChatNearby: - return UnmarshalChatNearby(data) - - case TypeChatsNearby: - return UnmarshalChatsNearby(data) - case TypePublicChatTypeHasUsername: return UnmarshalPublicChatTypeHasUsername(data) @@ -22339,9 +22320,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatActionBarReportSpam: return UnmarshalChatActionBarReportSpam(data) - case TypeChatActionBarReportUnrelatedLocation: - return UnmarshalChatActionBarReportUnrelatedLocation(data) - case TypeChatActionBarInviteMembers: return UnmarshalChatActionBarInviteMembers(data) @@ -23398,6 +23376,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSchedulingStateSendWhenOnline: return UnmarshalMessageSchedulingStateSendWhenOnline(data) + case TypeMessageSchedulingStateSendWhenVideoProcessed: + return UnmarshalMessageSchedulingStateSendWhenVideoProcessed(data) + case TypeMessageSelfDestructTypeTimer: return UnmarshalMessageSelfDestructTypeTimer(data) @@ -24526,9 +24507,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) - case TypeStorePaymentPurposeGiftedPremium: - return UnmarshalStorePaymentPurposeGiftedPremium(data) - case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -25699,6 +25677,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) + case TypeUpdateVideoPublished: + return UnmarshalUpdateVideoPublished(data) + case TypeUpdateNewChat: return UnmarshalUpdateNewChat(data) @@ -25987,9 +25968,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) - case TypeUpdateUsersNearby: - return UnmarshalUpdateUsersNearby(data) - case TypeUpdateUnconfirmedSession: return UnmarshalUpdateUnconfirmedSession(data) diff --git a/data/td_api.tl b/data/td_api.tl index 8101cdc..c7dd285 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -829,7 +829,7 @@ starSubscription id:string chat_id:int53 expiration_date:int32 can_reuse:Bool is //@description Represents a list of Telegram Star subscriptions //@star_count The amount of owned Telegram Stars -//@subscriptions List of subbscriptions for Telegram Stars +//@subscriptions List of subscriptions for Telegram Stars //@required_star_count The number of Telegram Stars required to buy to extend subscriptions expiring soon //@next_offset The offset for the next request. If empty, then there are no more results starSubscriptions star_count:int53 subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; @@ -861,11 +861,13 @@ premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is //@description Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments //@currency ISO 4217 currency code for Telegram Premium gift code payment //@amount The amount to pay, in the smallest units of the currency +//@discount_percentage The discount associated with this option, as a percentage //@winner_count Number of users which will be able to activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active //@store_product_id Identifier of the store product associated with the option; may be empty if none //@store_product_quantity Number of times the store product must be paid -premiumGiftCodePaymentOption currency:string amount:int53 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiftCodePaymentOption; +//@sticker A sticker to be shown along with the gift code; may be null if unknown +premiumGiftCodePaymentOption currency:string amount:int53 discount_percentage:int32 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 sticker:sticker = PremiumGiftCodePaymentOption; //@description Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway @options The list of options premiumGiftCodePaymentOptions options:vector = PremiumGiftCodePaymentOptions; @@ -916,9 +918,11 @@ starGiveawayPaymentOptions options:vector = StarGivea //@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 +//@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out //@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; +//@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only +//@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only +gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; //@description Contains a list of gifts that can be sent to another user @gifts The list of gifts gifts gifts:vector = Gifts; @@ -952,7 +956,7 @@ starTransactionDirectionOutgoing = StarTransactionDirection; //@class BotTransactionPurpose @description Describes purpose of a transaction with a bot -//@description Paid media were bought @media The bought media if the trancastion wasn't refunded @payload Bot-provided payload; for bots only +//@description Paid media were bought @media The bought media if the transaction wasn't refunded @payload Bot-provided payload; for bots only botTransactionPurposePaidMedia media:vector payload:string = BotTransactionPurpose; //@description User bought a product from the bot @@ -965,7 +969,7 @@ botTransactionPurposeInvoicePayment product_info:productInfo invoice_payload:byt //@description Paid media were bought //@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message -//@media The bought media if the trancastion wasn't refunded +//@media The bought media if the transaction wasn't refunded chatTransactionPurposePaidMedia message_id:int53 media:vector = ChatTransactionPurpose; //@description User joined the channel and subscribed to regular payments in Telegram Stars @@ -1003,22 +1007,25 @@ starTransactionPartnerAppStore = StarTransactionPartner; //@description The transaction is a transaction with Google Play starTransactionPartnerGooglePlay = StarTransactionPartner; -//@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment +//@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment or for Telegram Stars bought on Fragment starTransactionPartnerFragment withdrawal_state:RevenueWithdrawalState = StarTransactionPartner; //@description The transaction is a transaction with Telegram Ad platform starTransactionPartnerTelegramAds = StarTransactionPartner; +//@description The transaction is a transaction with Telegram for API usage @request_count The number of billed requests +starTransactionPartnerTelegramApi request_count:int32 = StarTransactionPartner; + //@description The transaction is a transaction with a bot @user_id Identifier of the bot @purpose Purpose of the transaction starTransactionPartnerBot user_id:int53 purpose:BotTransactionPurpose = StarTransactionPartner; -//@description The transaction is a transaction with a business account @user_id Identifier of the business account user @media The bought media if the trancastion wasn't refunded +//@description The transaction is a transaction with a business account @user_id Identifier of the business account user @media The bought media if the transaction wasn't refunded starTransactionPartnerBusiness user_id:int53 media:vector = StarTransactionPartner; //@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 transcation with another user @user_id Identifier of the user; 0 if the user was anonymous @purpose Purpose of the transaction +//@description The transaction is a transaction 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 @@ -1169,12 +1176,13 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null +//@can_get_revenue_statistics True, if the bot's revenue statistics are available //@has_media_previews True, if the bot has media previews //@edit_commands_link The internal link, which can be used to edit bot commands; may be null //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights can_get_revenue_statistics:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -1196,12 +1204,11 @@ botInfo short_description:string description:string photo:photo animation:animat //@bio A short user bio; may be null for bots //@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 gift_count:int32 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 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; @@ -1430,7 +1437,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@status Status of the current user in the supergroup or channel; custom title will always be empty //@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through //-getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, -//-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchChatsNearby, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, +//-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, //-or for chats with messages or stories from publicForwards and foundStories //@boost_level Approximate boost level for the chat //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel @@ -1760,8 +1767,8 @@ factCheck text:formattedText country_code:string = FactCheck; //@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 //@contains_unread_mention True, if the message contains an unread mention for the current user -//@date Point in time (Unix timestamp) when the message was sent -//@edit_date Point in time (Unix timestamp) when the message was last edited +//@date Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages +//@edit_date Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages //@forward_info Information about the initial message sender; may be null if none or unknown //@import_info Information about the initial message for messages created with importMessages; may be null if the message isn't imported //@interaction_info Information about interactions with the message; may be null if none @@ -2189,13 +2196,6 @@ failedToAddMembers failed_to_add_members:vector = FailedToAdd createdBasicGroupChat chat_id:int53 failed_to_add_members:failedToAddMembers = CreatedBasicGroupChat; -//@description Describes a chat located nearby @chat_id Chat identifier @distance Distance to the chat location, in meters -chatNearby chat_id:int53 distance:int32 = ChatNearby; - -//@description Represents a list of chats located nearby @users_nearby List of users nearby @supergroups_nearby List of location-based supergroups nearby -chatsNearby users_nearby:vector supergroups_nearby:vector = ChatsNearby; - - //@class PublicChatType @description Describes type of public chat //@description The chat is public, because it has an active username @@ -2207,21 +2207,17 @@ publicChatTypeIsLocationBased = PublicChatType; //@class ChatActionBar @description Describes actions which must be possible to do through a chat action bar -//@description The chat can be reported as spam using the method reportChat with the reason reportReasonSpam. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown +//@description The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown //@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings chatActionBarReportSpam can_unarchive:Bool = ChatActionBar; -//@description The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason reportReasonUnrelatedLocation -chatActionBarReportUnrelatedLocation = ChatActionBar; - //@description The chat is a recently created group chat to which new members can be invited chatActionBarInviteMembers = ChatActionBar; //@description The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method setMessageSenderBlockList, //-or the other user can be added to the contact list using the method addContact. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown //@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings -//@distance If non-negative, the current user was found by the other user through searchChatsNearby and this is the distance between the users -chatActionBarReportAddBlock can_unarchive:Bool distance:int32 = ChatActionBar; +chatActionBarReportAddBlock can_unarchive:Bool = ChatActionBar; //@description The chat is a private or secret chat and the other user can be added to the contact list using the method addContact chatActionBarAddContact = ChatActionBar; @@ -2844,7 +2840,7 @@ linkPreviewTypeStory story_sender_chat_id:int53 story_id:int32 = LinkPreviewType //@description The link is a link to boost a supergroup chat @photo Photo of the chat; may be null linkPreviewTypeSupergroupBoost photo:chatPhoto = LinkPreviewType; -//@description The link is a link to a cloud theme. TDLib has no theme support yet @documents The list of files with theme description @settings Settings for the cloud theme +//@description The link is a link to a cloud theme. TDLib has no theme support yet @documents The list of files with theme description @settings Settings for the cloud theme; may be null if unknown linkPreviewTypeTheme documents:vector settings:themeSettings = LinkPreviewType; //@description The link preview type is unsupported yet @@ -2867,7 +2863,7 @@ linkPreviewTypeVideoNote video_note:videoNote = LinkPreviewType; //@description The link is a link to a voice note message @voice_note The voice note linkPreviewTypeVoiceNote voice_note:voiceNote = LinkPreviewType; -//@description The link is a link to a Web App @photo Web App photo +//@description The link is a link to a Web App @photo Web App photo; may be null if none linkPreviewTypeWebApp photo:photo = LinkPreviewType; @@ -2951,21 +2947,21 @@ locationAddress country_code:string state:string city:string street:string = Loc //@description Contains parameters of the application theme -//@background_color A color of the background in the RGB24 format -//@secondary_background_color A secondary color for the background in the RGB24 format -//@header_background_color A color of the header background in the RGB24 format -//@bottom_bar_background_color A color of the bottom bar background in the RGB24 format -//@section_background_color A color of the section background in the RGB24 format -//@section_separator_color A color of the section separator in the RGB24 format -//@text_color A color of text in the RGB24 format -//@accent_text_color An accent color of the text in the RGB24 format -//@section_header_text_color A color of text on the section headers in the RGB24 format -//@subtitle_text_color A color of the subtitle text in the RGB24 format -//@destructive_text_color A color of the text for destructive actions in the RGB24 format -//@hint_color A color of hints in the RGB24 format -//@link_color A color of links in the RGB24 format -//@button_color A color of the buttons in the RGB24 format -//@button_text_color A color of text on the buttons in the RGB24 format +//@background_color A color of the background in the RGB format +//@secondary_background_color A secondary color for the background in the RGB format +//@header_background_color A color of the header background in the RGB format +//@bottom_bar_background_color A color of the bottom bar background in the RGB format +//@section_background_color A color of the section background in the RGB format +//@section_separator_color A color of the section separator in the RGB format +//@text_color A color of text in the RGB format +//@accent_text_color An accent color of the text in the RGB format +//@section_header_text_color A color of text on the section headers in the RGB format +//@subtitle_text_color A color of the subtitle text in the RGB format +//@destructive_text_color A color of the text for destructive actions in the RGB format +//@hint_color A color of hints in the RGB format +//@link_color A color of links in the RGB format +//@button_color A color of the buttons in the RGB format +//@button_text_color A color of text on the buttons in the RGB format themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 bottom_bar_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; @@ -3101,7 +3097,7 @@ paymentReceipt product_info:productInfo date:int32 seller_bot_user_id:int53 type //@description An invoice from a message of the type messageInvoice or paid media purchase from messagePaidMedia //@chat_id Chat identifier of the message -//@message_id Message identifier +//@message_id Message identifier. Use messageProperties.can_be_paid to check whether the message can be used in the method inputInvoiceMessage chat_id:int53 message_id:int53 = InputInvoice; //@description An invoice from a link of the type internalLinkTypeInvoice @name Name of the invoice @@ -3666,16 +3662,18 @@ messagePaymentRefunded owner_id:MessageSender currency:string total_amount:int53 //@description Telegram Premium was gifted to a user //@gifter_user_id The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous or is outgoing //@receiver_user_id The identifier of a user that received Telegram Premium; 0 if the gift is incoming +//@text Message added to the gifted Telegram Premium by the sender //@currency Currency for the paid amount //@amount The paid amount, in the smallest units of the currency //@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none //@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if none //@month_count Number of months the Telegram Premium subscription will be active //@sticker A sticker to be shown in the message; may be null if unknown -messageGiftedPremium gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; +messageGiftedPremium gifter_user_id:int53 receiver_user_id:int53 text:formattedText currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; //@description A Telegram Premium gift code was created for the user //@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown +//@text Message added to the gift //@is_from_giveaway True, if the gift code was created for a giveaway //@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen //@currency Currency for the paid amount; empty if unknown @@ -3685,7 +3683,7 @@ messageGiftedPremium gifter_user_id:int53 receiver_user_id:int53 currency:string //@month_count Number of months the Telegram Premium subscription will be active after code activation //@sticker A sticker to be shown in the message; may be null if unknown //@code The gift code -messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool is_unclaimed:Bool currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker code:string = MessageContent; +messagePremiumGiftCode creator_id:MessageSender text:formattedText is_from_giveaway:Bool is_unclaimed:Bool currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker code:string = MessageContent; //@description A giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway, storePaymentPurposePremiumGiveaway, telegramPaymentPurposeStarGiveaway, or storePaymentPurposeStarGiveaway to create a giveaway //@star_count Number of Telegram Stars that will be shared by winners of the giveaway; 0 for Telegram Premium giveaways @@ -3785,10 +3783,10 @@ messageUnsupported = MessageContent; //@description A mention of a user, a supergroup, or a channel by their username textEntityTypeMention = TextEntityType; -//@description A hashtag text, beginning with "#" +//@description A hashtag text, beginning with "#" and optionally containing a chat username at the end textEntityTypeHashtag = TextEntityType; -//@description A cashtag text, beginning with "$" and consisting of capital English letters (e.g., "$USD") +//@description A cashtag text, beginning with "$", consisting of capital English letters (e.g., "$USD"), and optionally containing a chat username at the end textEntityTypeCashtag = TextEntityType; //@description A bot command, beginning with "/" @@ -3885,6 +3883,10 @@ messageSchedulingStateSendAtDate send_date:int32 = MessageSchedulingState; //@description The message will be sent when the other user is online. Applicable to private chats only and when the exact online status of the other user is known messageSchedulingStateSendWhenOnline = MessageSchedulingState; +//@description The message will be sent when the video in the message is converted and optimized; can be used only by the server +//@send_date Approximate point in time (Unix timestamp) when the message is expected to be sent +messageSchedulingStateSendWhenVideoProcessed send_date:int32 = MessageSchedulingState; + //@class MessageSelfDestructType @description Describes when a message will be self-destructed @@ -3899,15 +3901,17 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@disable_notification Pass true to disable notification for the message //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only +//@allow_paid_broadcast Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum //@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied -//@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local +//@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. +//-Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable //@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 media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false @@ -3994,7 +3998,7 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; //@description A video note message -//@video_note Video note to be sent +//@video_note Video note to be sent. The video is expected to be encoded to MPEG4 format with H.264 codec and have no data outside of the visible circle //@thumbnail Video thumbnail; may be null if empty; pass null to skip thumbnail uploading //@duration Duration of the video, in seconds; 0-60 //@length Video width and height; must be positive and not greater than 640 @@ -4071,7 +4075,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true -//@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageMedia, editMessageCaption, or editMessageReplyMarkup. +//@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. //-For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message //@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages //@can_be_paid True, if the message can be paid using inputInvoiceMessage @@ -4080,6 +4084,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage //@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage +//@can_edit_media True, if the message can be edited using the method editMessageMedia //@can_edit_scheduling_state True, if scheduling state of the message can be edited //@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode //@can_get_link True, if a link can be generated for the message using getMessageLink @@ -4094,7 +4099,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -5045,7 +5050,7 @@ speechRecognitionResultError error:error = SpeechRecognitionResult; businessConnection id:string user_id:int53 user_chat_id:int53 date:int32 can_reply:Bool is_enabled:Bool = BusinessConnection; -//@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB24 format for light themes @dark_color Color in the RGB24 format for dark themes +//@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB format for light themes @dark_color Color in the RGB format for dark themes attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotColor; //@description Represents a bot, which can be added to attachment or side menu @@ -5848,18 +5853,13 @@ premiumState state:formattedText payment_options:vector = StorePaymentPurpose; +//@text Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed +storePaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector text:formattedText = StorePaymentPurpose; //@description The user creating a Telegram Premium giveaway //@parameters Giveaway parameters @@ -5897,7 +5897,8 @@ storePaymentPurposeGiftedStars user_id:int53 currency:string amount:int53 star_c //@amount Paid amount, in the smallest units of the currency //@user_ids Identifiers of the users which can activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active for the users -telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector month_count:int32 = TelegramPaymentPurpose; +//@text Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed +telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector month_count:int32 text:formattedText = TelegramPaymentPurpose; //@description The user creating a Telegram Premium giveaway //@parameters Giveaway parameters @@ -5980,16 +5981,16 @@ pushReceiverId id:int64 = PushReceiverId; //@class BackgroundFill @description Describes a fill of a background -//@description Describes a solid fill of a background @color A color of the background in the RGB24 format +//@description Describes a solid fill of a background @color A color of the background in the RGB format backgroundFillSolid color:int32 = BackgroundFill; //@description Describes a gradient fill of a background -//@top_color A top color of the background in the RGB24 format -//@bottom_color A bottom color of the background in the RGB24 format +//@top_color A top color of the background in the RGB format +//@bottom_color A bottom color of the background in the RGB format //@rotation_angle Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible by 45 backgroundFillGradient top_color:int32 bottom_color:int32 rotation_angle:int32 = BackgroundFill; -//@description Describes a freeform gradient fill of a background @colors A list of 3 or 4 colors of the freeform gradient in the RGB24 format +//@description Describes a freeform gradient fill of a background @colors A list of 3 or 4 colors of the freeform gradient in the RGB format backgroundFillFreeformGradient colors:vector = BackgroundFill; @@ -6824,7 +6825,8 @@ internalLinkTypePhoneNumberConfirmation hash:string phone_number:string = Intern //@referrer Referrer specified in the link internalLinkTypePremiumFeatures referrer:string = InternalLinkType; -//@description The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram payments or in-store purchases @referrer Referrer specified in the link +//@description The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGiftCodes payments or in-store purchases +//@referrer Referrer specified in the link internalLinkTypePremiumGift referrer:string = InternalLinkType; //@description The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. @@ -7557,7 +7559,10 @@ updateNewMessage message:message = Update; //@message_id A temporary message identifier updateMessageSendAcknowledged chat_id:int53 message_id:int53 = Update; -//@description A message has been successfully sent @message The sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change @old_message_id The previous temporary message identifier +//@description A message has been successfully sent +//@message The sent message. Almost any field of the new message can be different from the corresponding field of the original message. +//-For example, the field scheduling_state may change, making the message scheduled, or non-scheduled +//@old_message_id The previous temporary message identifier updateMessageSendSucceeded message:message old_message_id:int53 = Update; //@description A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update @@ -7606,6 +7611,11 @@ updateMessageFactCheck chat_id:int53 message_id:int53 fact_check:factCheck = Upd //@message_id Identifier of the message with live location updateMessageLiveLocationViewed chat_id:int53 message_id:int53 = Update; +//@description An automatically scheduled message with video has been successfully sent after conversion +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the sent message +updateVideoPublished chat_id:int53 message_id:int53 = Update; + //@description A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the application. The chat field changes will be reported through separate updates @chat The chat updateNewChat chat:chat = Update; @@ -7981,9 +7991,6 @@ updateConnectionState state:ConnectionState = Update; //@description New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" @terms_of_service_id Identifier of the terms of service @terms_of_service The new terms of service updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService = Update; -//@description The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request @users_nearby The new list of users nearby -updateUsersNearby users_nearby:vector = Update; - //@description The first unconfirmed session has changed @session The unconfirmed session; may be null if none updateUnconfirmedSession session:unconfirmedSession = Update; @@ -8515,9 +8522,6 @@ 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 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 getRecommendedChats = Chats; @@ -8715,10 +8719,11 @@ searchOutgoingDocumentMessages query:string limit:int32 = FoundMessages; searchPublicMessagesByTag tag:string offset:string limit:int32 = FoundMessages; //@description Searches for public stories containing the given hashtag or cashtag. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +//@story_sender_chat_id Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats //@tag Hashtag or cashtag to search for //@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 stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -searchPublicStoriesByTag tag:string offset:string limit:int32 = FoundStories; +searchPublicStoriesByTag story_sender_chat_id:int53 tag:string offset:string limit:int32 = FoundStories; //@description Searches for public stories by the given address location. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit //@address Address of the location @@ -8787,7 +8792,7 @@ getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilte //@description Returns all scheduled messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier 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 +//@description Returns sponsored messages to be shown in a chat; for channel chats and chats with bots 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 chat photo, a mention in the sponsored message text, or the media in the sponsored message @@ -8904,7 +8909,8 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:Inpu //@from_chat_id Identifier of the chat from which to forward messages //@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if messageProperties.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options -//@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local +//@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. +//-Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; @@ -8968,11 +8974,10 @@ editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_me //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Message; -//@description Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. -//-The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. -//-Returns the edited message after the edit is completed on the server side +//@description Edits the media content of a message, including message caption. If only the caption needs to be edited, use editMessageCaption instead. +//-The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to -//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited +//@message_id Identifier of the message. Use messageProperties.can_edit_media to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo editMessageMedia chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; @@ -9007,7 +9012,7 @@ editInlineMessageText inline_message_id:string reply_markup:ReplyMarkup input_me //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Ok; -//@description Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only +//@description Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only //@inline_message_id Inline message identifier //@reply_markup The new message reply markup; pass null if none; for bots only //@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo @@ -9028,9 +9033,10 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = //@description Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed //@chat_id The chat the message belongs to //@message_id Identifier of the message. Use messageProperties.can_edit_scheduling_state to check whether the message is suitable -//@scheduling_state The new message scheduling state; pass null to send the message immediately +//@scheduling_state The new message scheduling state; pass null to send the message immediately. Must be null for messages in the state messageSchedulingStateSendWhenVideoProcessed editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; + //@description Changes the fact-check of a message. Can be only used if messageProperties.can_set_fact_check == true //@chat_id The channel chat the message belongs to //@message_id Identifier of the message @@ -9080,7 +9086,7 @@ editBusinessMessageText business_connection_id:string chat_id:int53 message_id:i //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editBusinessMessageLiveLocation business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = BusinessMessage; -//@description Edits the content of a message with an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only +//@description Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only //@business_connection_id Unique identifier of business connection on behalf of which the message was sent //@chat_id The chat the message belongs to //@message_id Identifier of the message @@ -9173,7 +9179,7 @@ addQuickReplyShortcutMessageAlbum shortcut_name:string reply_to_message_id:int53 readdQuickReplyShortcutMessages shortcut_name:string message_ids:vector = QuickReplyMessages; //@description Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. -//-Text message can be edited only to a text message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +//-Media message can be edited only to a media message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa //@shortcut_id Unique identifier of the quick reply shortcut with the message //@message_id Identifier of the message //@input_message_content New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo @@ -9296,7 +9302,7 @@ togglePaidMessageReactionIsAnonymous chat_id:int53 message_id:int53 is_anonymous //@description Sets reactions on a message; for bots only //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@reaction_types Types of the reaction to set +//@reaction_types Types of the reaction to set; pass an empty list to remove the reactions //@is_big Pass true if the reactions are added with a big animation setMessageReactions chat_id:int53 message_id:int53 reaction_types:vector is_big:Bool = Ok; @@ -10701,8 +10707,8 @@ getStickerSet set_id:int64 = StickerSet; //@description Returns name of a sticker set by its identifier @set_id Identifier of the sticker set getStickerSetName set_id:int64 = Text; -//@description Searches for a sticker set by its name @name Name of the sticker set -searchStickerSet name:string = StickerSet; +//@description Searches for a sticker set by its name @name Name of the sticker set @ignore_cache Pass true to ignore local cache of sticker sets and always send a network request +searchStickerSet name:string ignore_cache:Bool = StickerSet; //@description Searches for installed sticker sets by looking for specified query in their title and name @sticker_type Type of the sticker sets to search for @query Query to search for @limit The maximum number of sticker sets to return searchInstalledStickerSets sticker_type:StickerType query:string limit:int32 = StickerSets; @@ -10861,9 +10867,6 @@ setPersonalChat chat_id:int53 = Ok; //@description Changes the emoji status of the current user; for Telegram Premium users only @emoji_status New emoji status; pass null to switch to the default badge setEmojiStatus emoji_status:emojiStatus = Ok; -//@description Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer. Must not be called if the user has a business location @location The new location of the user -setLocation location:location = Ok; - //@description Toggles whether the current user has sponsored messages enabled. The setting has no effect for users without Telegram Premium for which sponsored messages are always enabled //@has_sponsored_messages_enabled Pass true to enable sponsored messages for the current user; false to disable them toggleHasSponsoredMessagesEnabled has_sponsored_messages_enabled:Bool = Ok; @@ -11250,7 +11253,7 @@ deleteSavedCredentials = Ok; //@description Returns gifts that can be sent to other users getAvailableGifts = Gifts; -//@description Send a gift to another user +//@description Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@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 @@ -11443,15 +11446,20 @@ reportChatPhoto chat_id:int53 file_id:int32 reason:ReportReason text:string = Ok reportMessageReactions chat_id:int53 message_id:int53 sender_id:MessageSender = Ok; -//@description Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application +//@description Returns detailed revenue statistics about a chat. Currently, this method can be used only +//-for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true +//@chat_id Chat identifier +//@is_dark Pass true if a dark theme is used by the application getChatRevenueStatistics chat_id:int53 is_dark:Bool = ChatRevenueStatistics; -//@description Returns a URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue") +//@description Returns a URL for chat revenue withdrawal; requires owner privileges in the channel chat or the bot. Currently, this method can be used only +//-if getOption("can_withdraw_chat_revenue") for channels with supergroupFullInfo.can_get_revenue_statistics == true or bots with userFullInfo.bot_info.can_get_revenue_statistics == true //@chat_id Chat identifier //@password The 2-step verification password of the current user getChatRevenueWithdrawalUrl chat_id:int53 password:string = HttpUrl; -//@description Returns the list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true +//@description Returns the list of revenue transactions for a chat. Currently, this method can be used only +//-for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true //@chat_id Chat identifier //@offset Number of transactions to skip //@limit The maximum number of transactions to be returned; up to 200 From 098715f4f0183925d083742ed32d3c15470b197c Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 17 Nov 2024 21:57:42 +0800 Subject: [PATCH 03/29] Update to TDLib 1.8.40 --- client/function.go | 286 ++++++++++-- client/type.go | 979 +++++++++++++++++++++++++++++++++--------- client/unmarshaler.go | 413 ++++++++++++++---- data/td_api.tl | 287 +++++++++---- 4 files changed, 1572 insertions(+), 393 deletions(-) diff --git a/client/function.go b/client/function.go index 087d17c..5159be1 100755 --- a/client/function.go +++ b/client/function.go @@ -7045,6 +7045,67 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err return UnmarshalOk(result.Data) } +type SavePreparedInlineMessageRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // The description of the message + Result InputInlineQueryResult `json:"result"` + // Types of the chats to which the message can be sent + ChatTypes *TargetChatTypes `json:"chat_types"` +} + +// Saves an inline message to be sent by the given user; for bots only +func (client *Client) SavePreparedInlineMessage(req *SavePreparedInlineMessageRequest) (*PreparedInlineMessageId, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "savePreparedInlineMessage", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "result": req.Result, + "chat_types": req.ChatTypes, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPreparedInlineMessageId(result.Data) +} + +type GetPreparedInlineMessageRequest struct { + // Identifier of the bot that created the message + BotUserId int64 `json:"bot_user_id"` + // Identifier of the prepared message + PreparedMessageId string `json:"prepared_message_id"` +} + +// Saves an inline message to be sent by the given user; for bots only +func (client *Client) GetPreparedInlineMessage(req *GetPreparedInlineMessageRequest) (*PreparedInlineMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPreparedInlineMessage", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "prepared_message_id": req.PreparedMessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPreparedInlineMessage(result.Data) +} + type GetGrossingWebAppBotsRequest struct { // 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"` @@ -7103,6 +7164,32 @@ func (client *Client) SearchWebApp(req *SearchWebAppRequest) (*FoundWebApp, erro return UnmarshalFoundWebApp(result.Data) } +type GetWebAppPlaceholderRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Returns a default placeholder for Web Apps of a bot; this is an offline request. Returns a 404 error if the placeholder isn't known +func (client *Client) GetWebAppPlaceholder(req *GetWebAppPlaceholderRequest) (*Outline, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getWebAppPlaceholder", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOutline(result.Data) +} + type GetWebAppLinkUrlRequest struct { // Identifier of the chat in which the link was clicked; pass 0 if none ChatId int64 `json:"chat_id"` @@ -7112,12 +7199,10 @@ type GetWebAppLinkUrlRequest struct { WebAppShortName string `json:"web_app_short_name"` // Start parameter from internalLinkTypeWebApp StartParameter string `json:"start_parameter"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the current application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` // Pass true if the current user allowed the bot to send them messages AllowWriteAccess bool `json:"allow_write_access"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } // Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked @@ -7131,9 +7216,8 @@ func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, "bot_user_id": req.BotUserId, "web_app_short_name": req.WebAppShortName, "start_parameter": req.StartParameter, - "theme": req.Theme, - "application_name": req.ApplicationName, "allow_write_access": req.AllowWriteAccess, + "parameters": req.Parameters, }, }) if err != nil { @@ -7154,10 +7238,8 @@ type GetMainWebAppRequest struct { BotUserId int64 `json:"bot_user_id"` // Start parameter from internalLinkTypeMainWebApp StartParameter string `json:"start_parameter"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the current application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } // Returns information needed to open the main Web App of a bot @@ -7170,8 +7252,7 @@ func (client *Client) GetMainWebApp(req *GetMainWebAppRequest) (*MainWebApp, err "chat_id": req.ChatId, "bot_user_id": req.BotUserId, "start_parameter": req.StartParameter, - "theme": req.Theme, - "application_name": req.ApplicationName, + "parameters": req.Parameters, }, }) if err != nil { @@ -7190,10 +7271,8 @@ type GetWebAppUrlRequest struct { BotUserId int64 `json:"bot_user_id"` // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu Url string `json:"url"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the current application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } // Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button @@ -7205,8 +7284,7 @@ func (client *Client) GetWebAppUrl(req *GetWebAppUrlRequest) (*HttpUrl, error) { Data: map[string]interface{}{ "bot_user_id": req.BotUserId, "url": req.Url, - "theme": req.Theme, - "application_name": req.ApplicationName, + "parameters": req.Parameters, }, }) if err != nil { @@ -7259,14 +7337,12 @@ type OpenWebAppRequest struct { BotUserId int64 `json:"bot_user_id"` // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise Url string `json:"url"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the current application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` // If not 0, the message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` // Information about the message or story to be replied in the message sent by the Web App; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } // Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. For each bot, a confirmation alert about data sent to the bot must be shown once @@ -7279,10 +7355,9 @@ func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { "chat_id": req.ChatId, "bot_user_id": req.BotUserId, "url": req.Url, - "theme": req.Theme, - "application_name": req.ApplicationName, "message_thread_id": req.MessageThreadId, "reply_to": req.ReplyTo, + "parameters": req.Parameters, }, }) if err != nil { @@ -7351,6 +7426,38 @@ func (client *Client) AnswerWebAppQuery(req *AnswerWebAppQueryRequest) (*SentWeb return UnmarshalSentWebAppMessage(result.Data) } +type CheckWebAppFileDownloadRequest struct { + // Identifier of the bot, providing the Web App + BotUserId int64 `json:"bot_user_id"` + // Name of the file + FileName string `json:"file_name"` + // URL of the file + Url string `json:"url"` +} + +// Checks whether a file can be downloaded and saved locally by Web App request +func (client *Client) CheckWebAppFileDownload(req *CheckWebAppFileDownloadRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkWebAppFileDownload", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "file_name": req.FileName, + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetCallbackQueryAnswerRequest struct { // Identifier of the chat with the message ChatId int64 `json:"chat_id"` @@ -13319,7 +13426,7 @@ type GetVideoChatRtmpUrlRequest struct { ChatId int64 `json:"chat_id"` } -// Returns RTMP URL for streaming to the chat; requires owner privileges +// Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right func (client *Client) GetVideoChatRtmpUrl(req *GetVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -14504,6 +14611,64 @@ func (client *Client) SuggestUserProfilePhoto(req *SuggestUserProfilePhotoReques return UnmarshalOk(result.Data) } +type ToggleBotCanManageEmojiStatusRequest struct { + // User identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // Pass true if the bot is allowed to change emoji status of the user; pass false otherwise + CanManageEmojiStatus bool `json:"can_manage_emoji_status"` +} + +// Toggles whether the bot can manage emoji status of the current user +func (client *Client) ToggleBotCanManageEmojiStatus(req *ToggleBotCanManageEmojiStatusRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleBotCanManageEmojiStatus", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "can_manage_emoji_status": req.CanManageEmojiStatus, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetUserEmojiStatusRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // New emoji status; pass null to switch to the default badge + EmojiStatus *EmojiStatus `json:"emoji_status"` +} + +// Changes the emoji status of a user; for bots only +func (client *Client) SetUserEmojiStatus(req *SetUserEmojiStatusRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setUserEmojiStatus", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "emoji_status": req.EmojiStatus, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SearchUserByPhoneNumberRequest struct { // Phone number to search for PhoneNumber string `json:"phone_number"` @@ -14591,6 +14756,38 @@ func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*C return UnmarshalChatPhotos(result.Data) } +type GetStickerOutlineRequest struct { + // File identifier of the sticker + StickerFileId int32 `json:"sticker_file_id"` + // Pass true to get the outline scaled for animated emoji + ForAnimatedEmoji bool `json:"for_animated_emoji"` + // Pass true to get the outline scaled for clicked animated emoji message + ForClickedAnimatedEmojiMessage bool `json:"for_clicked_animated_emoji_message"` +} + +// Returns outline of a sticker; this is an offline request. Returns a 404 error if the outline isn't known +func (client *Client) GetStickerOutline(req *GetStickerOutlineRequest) (*Outline, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStickerOutline", + }, + Data: map[string]interface{}{ + "sticker_file_id": req.StickerFileId, + "for_animated_emoji": req.ForAnimatedEmoji, + "for_clicked_animated_emoji_message": req.ForClickedAnimatedEmojiMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOutline(result.Data) +} + type GetStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` @@ -18585,6 +18782,8 @@ func (client *Client) GetUserGifts(req *GetUserGiftsRequest) (*UserGifts, error) } type CreateInvoiceLinkRequest struct { + // Unique identifier of business connection on behalf of which to send the request + BusinessConnectionId string `json:"business_connection_id"` // Information about the invoice of the type inputMessageInvoice Invoice InputMessageContent `json:"invoice"` } @@ -18596,6 +18795,7 @@ func (client *Client) CreateInvoiceLink(req *CreateInvoiceLinkRequest) (*HttpUrl Type: "createInvoiceLink", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "invoice": req.Invoice, }, }) @@ -21950,7 +22150,7 @@ type EditStarSubscriptionRequest struct { IsCanceled bool `json:"is_canceled"` } -// Cancels or reenables Telegram Star subscription to a channel +// Cancels or re-enables Telegram Star subscription func (client *Client) EditStarSubscription(req *EditStarSubscriptionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -21972,12 +22172,44 @@ func (client *Client) EditStarSubscription(req *EditStarSubscriptionRequest) (*O return UnmarshalOk(result.Data) } +type EditUserStarSubscriptionRequest struct { + // User identifier + UserId int64 `json:"user_id"` + // Telegram payment identifier of the subscription + TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` + // Pass true to cancel the subscription; pass false to allow the user to enable it + IsCanceled bool `json:"is_canceled"` +} + +// Cancels or re-enables Telegram Star subscription for a user; for bots only +func (client *Client) EditUserStarSubscription(req *EditUserStarSubscriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editUserStarSubscription", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "telegram_payment_charge_id": req.TelegramPaymentChargeId, + "is_canceled": req.IsCanceled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ReuseStarSubscriptionRequest struct { // Identifier of the subscription SubscriptionId string `json:"subscription_id"` } -// Reuses an active subscription and joins the subscribed chat again +// Reuses an active Telegram Star subscription to a channel chat and joins the chat again func (client *Client) ReuseStarSubscription(req *ReuseStarSubscriptionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ diff --git a/client/type.go b/client/type.go index 348df90..7f43b1a 100755 --- a/client/type.go +++ b/client/type.go @@ -23,6 +23,7 @@ const ( ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" + ClassStarSubscriptionType = "StarSubscriptionType" ClassStarTransactionDirection = "StarTransactionDirection" ClassBotTransactionPurpose = "BotTransactionPurpose" ClassChatTransactionPurpose = "ChatTransactionPurpose" @@ -58,6 +59,7 @@ const ( ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" ClassReplyMarkup = "ReplyMarkup" ClassLoginUrlInfo = "LoginUrlInfo" + ClassWebAppOpenMode = "WebAppOpenMode" ClassSavedMessagesTopicType = "SavedMessagesTopicType" ClassRichText = "RichText" ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" @@ -108,6 +110,7 @@ const ( ClassDiceStickers = "DiceStickers" ClassSpeechRecognitionResult = "SpeechRecognitionResult" ClassBotWriteAccessAllowReason = "BotWriteAccessAllowReason" + ClassTargetChat = "TargetChat" ClassInputInlineQueryResult = "InputInlineQueryResult" ClassInlineQueryResult = "InlineQueryResult" ClassInlineQueryResultsButtonType = "InlineQueryResultsButtonType" @@ -144,7 +147,6 @@ const ( ClassReportReason = "ReportReason" ClassReportChatResult = "ReportChatResult" ClassReportStoryResult = "ReportStoryResult" - ClassTargetChat = "TargetChat" ClassInternalLinkType = "InternalLinkType" ClassBlockList = "BlockList" ClassFileType = "FileType" @@ -186,6 +188,7 @@ const ( ClassThumbnail = "Thumbnail" ClassMaskPosition = "MaskPosition" ClassClosedVectorPath = "ClosedVectorPath" + ClassOutline = "Outline" ClassPollOption = "PollOption" ClassAnimation = "Animation" ClassAudio = "Audio" @@ -346,9 +349,11 @@ const ( ClassCreatedBasicGroupChat = "CreatedBasicGroupChat" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" + ClassThemeParameters = "ThemeParameters" ClassFoundWebApp = "FoundWebApp" ClassWebAppInfo = "WebAppInfo" ClassMainWebApp = "MainWebApp" + ClassWebAppOpenParameters = "WebAppOpenParameters" ClassMessageThreadInfo = "MessageThreadInfo" ClassSavedMessagesTopic = "SavedMessagesTopic" ClassForumTopicIcon = "ForumTopicIcon" @@ -373,7 +378,6 @@ const ( ClassBankCardInfo = "BankCardInfo" ClassAddress = "Address" ClassLocationAddress = "LocationAddress" - ClassThemeParameters = "ThemeParameters" ClassLabeledPricePart = "LabeledPricePart" ClassInvoice = "Invoice" ClassOrderInfo = "OrderInfo" @@ -474,8 +478,11 @@ const ( ClassSentWebAppMessage = "SentWebAppMessage" ClassHttpUrl = "HttpUrl" ClassUserLink = "UserLink" + ClassTargetChatTypes = "TargetChatTypes" ClassInlineQueryResultsButton = "InlineQueryResultsButton" ClassInlineQueryResults = "InlineQueryResults" + ClassPreparedInlineMessageId = "PreparedInlineMessageId" + ClassPreparedInlineMessage = "PreparedInlineMessage" ClassCallbackQueryAnswer = "CallbackQueryAnswer" ClassCustomRequestResult = "CustomRequestResult" ClassGameHighScore = "GameHighScore" @@ -642,6 +649,7 @@ const ( TypeStickerFullTypeMask = "stickerFullTypeMask" TypeStickerFullTypeCustomEmoji = "stickerFullTypeCustomEmoji" TypeClosedVectorPath = "closedVectorPath" + TypeOutline = "outline" TypePollOption = "pollOption" TypePollTypeRegular = "pollTypeRegular" TypePollTypeQuiz = "pollTypeQuiz" @@ -705,6 +713,8 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeStarSubscriptionTypeChannel = "starSubscriptionTypeChannel" + TypeStarSubscriptionTypeBot = "starSubscriptionTypeBot" TypeStarSubscriptionPricing = "starSubscriptionPricing" TypeStarSubscription = "starSubscription" TypeStarSubscriptions = "starSubscriptions" @@ -727,6 +737,7 @@ const ( TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" TypeBotTransactionPurposePaidMedia = "botTransactionPurposePaidMedia" TypeBotTransactionPurposeInvoicePayment = "botTransactionPurposeInvoicePayment" + TypeBotTransactionPurposeSubscription = "botTransactionPurposeSubscription" TypeChatTransactionPurposePaidMedia = "chatTransactionPurposePaidMedia" TypeChatTransactionPurposeJoin = "chatTransactionPurposeJoin" TypeChatTransactionPurposeReaction = "chatTransactionPurposeReaction" @@ -961,9 +972,14 @@ const ( TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard" TypeLoginUrlInfoOpen = "loginUrlInfoOpen" TypeLoginUrlInfoRequestConfirmation = "loginUrlInfoRequestConfirmation" + TypeThemeParameters = "themeParameters" + TypeWebAppOpenModeCompact = "webAppOpenModeCompact" + TypeWebAppOpenModeFullSize = "webAppOpenModeFullSize" + TypeWebAppOpenModeFullScreen = "webAppOpenModeFullScreen" TypeFoundWebApp = "foundWebApp" TypeWebAppInfo = "webAppInfo" TypeMainWebApp = "mainWebApp" + TypeWebAppOpenParameters = "webAppOpenParameters" TypeMessageThreadInfo = "messageThreadInfo" TypeSavedMessagesTopicTypeMyNotes = "savedMessagesTopicTypeMyNotes" TypeSavedMessagesTopicTypeAuthorHidden = "savedMessagesTopicTypeAuthorHidden" @@ -1078,7 +1094,6 @@ const ( TypeBankCardInfo = "bankCardInfo" TypeAddress = "address" TypeLocationAddress = "locationAddress" - TypeThemeParameters = "themeParameters" TypeLabeledPricePart = "labeledPricePart" TypeInvoice = "invoice" TypeOrderInfo = "orderInfo" @@ -1094,6 +1109,7 @@ const ( TypePaymentOption = "paymentOption" TypePaymentFormTypeRegular = "paymentFormTypeRegular" TypePaymentFormTypeStars = "paymentFormTypeStars" + TypePaymentFormTypeStarSubscription = "paymentFormTypeStarSubscription" TypePaymentForm = "paymentForm" TypeValidatedOrderInfo = "validatedOrderInfo" TypePaymentResult = "paymentResult" @@ -1490,6 +1506,10 @@ const ( TypeBotWriteAccessAllowReasonAcceptedRequest = "botWriteAccessAllowReasonAcceptedRequest" TypeHttpUrl = "httpUrl" TypeUserLink = "userLink" + TypeTargetChatTypes = "targetChatTypes" + TypeTargetChatCurrent = "targetChatCurrent" + TypeTargetChatChosen = "targetChatChosen" + TypeTargetChatInternalLink = "targetChatInternalLink" TypeInputInlineQueryResultAnimation = "inputInlineQueryResultAnimation" TypeInputInlineQueryResultArticle = "inputInlineQueryResultArticle" TypeInputInlineQueryResultAudio = "inputInlineQueryResultAudio" @@ -1518,6 +1538,8 @@ const ( TypeInlineQueryResultsButtonTypeWebApp = "inlineQueryResultsButtonTypeWebApp" TypeInlineQueryResultsButton = "inlineQueryResultsButton" TypeInlineQueryResults = "inlineQueryResults" + TypePreparedInlineMessageId = "preparedInlineMessageId" + TypePreparedInlineMessage = "preparedInlineMessage" TypeCallbackQueryPayloadData = "callbackQueryPayloadData" TypeCallbackQueryPayloadDataWithPassword = "callbackQueryPayloadDataWithPassword" TypeCallbackQueryPayloadGame = "callbackQueryPayloadGame" @@ -1788,11 +1810,13 @@ const ( TypeStoryPrivacySettingsSelectedUsers = "storyPrivacySettingsSelectedUsers" TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" + TypeUserPrivacySettingRuleAllowBots = "userPrivacySettingRuleAllowBots" TypeUserPrivacySettingRuleAllowPremiumUsers = "userPrivacySettingRuleAllowPremiumUsers" TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" TypeUserPrivacySettingRuleAllowChatMembers = "userPrivacySettingRuleAllowChatMembers" TypeUserPrivacySettingRuleRestrictAll = "userPrivacySettingRuleRestrictAll" TypeUserPrivacySettingRuleRestrictContacts = "userPrivacySettingRuleRestrictContacts" + TypeUserPrivacySettingRuleRestrictBots = "userPrivacySettingRuleRestrictBots" TypeUserPrivacySettingRuleRestrictUsers = "userPrivacySettingRuleRestrictUsers" TypeUserPrivacySettingRuleRestrictChatMembers = "userPrivacySettingRuleRestrictChatMembers" TypeUserPrivacySettingRules = "userPrivacySettingRules" @@ -1807,6 +1831,7 @@ const ( TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls" TypeUserPrivacySettingAllowFindingByPhoneNumber = "userPrivacySettingAllowFindingByPhoneNumber" TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" + TypeUserPrivacySettingAutosaveGifts = "userPrivacySettingAutosaveGifts" TypeReadDatePrivacySettings = "readDatePrivacySettings" TypeNewChatPrivacySettings = "newChatPrivacySettings" TypeCanSendMessageToUserResultOk = "canSendMessageToUserResultOk" @@ -1853,9 +1878,6 @@ const ( TypeReportStoryResultOk = "reportStoryResultOk" TypeReportStoryResultOptionRequired = "reportStoryResultOptionRequired" TypeReportStoryResultTextRequired = "reportStoryResultTextRequired" - TypeTargetChatCurrent = "targetChatCurrent" - TypeTargetChatChosen = "targetChatChosen" - TypeTargetChatInternalLink = "targetChatInternalLink" TypeInternalLinkTypeActiveSessions = "internalLinkTypeActiveSessions" TypeInternalLinkTypeAttachmentMenuBot = "internalLinkTypeAttachmentMenuBot" TypeInternalLinkTypeAuthenticationCode = "internalLinkTypeAuthenticationCode" @@ -2283,6 +2305,11 @@ type InputChatPhoto interface { InputChatPhotoType() string } +// Describes type of subscription paid in Telegram Stars +type StarSubscriptionType interface { + StarSubscriptionTypeType() string +} + // Describes direction of a transaction with Telegram Stars type StarTransactionDirection interface { StarTransactionDirectionType() string @@ -2458,6 +2485,11 @@ type LoginUrlInfo interface { LoginUrlInfoType() string } +// Describes mode in which a Web App is opened +type WebAppOpenMode interface { + WebAppOpenModeType() string +} + // Describes type of Saved Messages topic type SavedMessagesTopicType interface { SavedMessagesTopicTypeType() string @@ -2708,6 +2740,11 @@ type BotWriteAccessAllowReason interface { BotWriteAccessAllowReasonType() string } +// Describes the target chat to be opened +type TargetChat interface { + TargetChatType() string +} + // Represents a single result of an inline query; for bots only type InputInlineQueryResult interface { InputInlineQueryResultType() string @@ -2888,11 +2925,6 @@ type ReportStoryResult interface { ReportStoryResultType() string } -// Describes the target chat to be opened -type TargetChat interface { - TargetChatType() string -} - // Describes an internal https://t.me or tg: link, which must be processed by the application in a special way type InternalLinkType interface { InternalLinkTypeType() string @@ -5056,7 +5088,7 @@ func (*StickerFullTypeCustomEmoji) StickerFullTypeType() string { return TypeStickerFullTypeCustomEmoji } -// Represents a closed vector path. The path begins at the end point of the last command +// Represents a closed vector path. The path begins at the end point of the last command. The coordinate system origin is in the upper-left corner type ClosedVectorPath struct { meta // List of vector path commands @@ -5095,6 +5127,29 @@ func (closedVectorPath *ClosedVectorPath) UnmarshalJSON(data []byte) error { return nil } +// Represents outline of an image +type Outline struct { + meta + // The list of closed vector paths + Paths []*ClosedVectorPath `json:"paths"` +} + +func (entity *Outline) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Outline + + return json.Marshal((*stub)(entity)) +} + +func (*Outline) GetClass() string { + return ClassOutline +} + +func (*Outline) GetType() string { + return TypeOutline +} + // Describes one answer option of a poll type PollOption struct { meta @@ -5335,8 +5390,6 @@ type Sticker struct { Format StickerFormat `json:"format"` // Sticker's full type FullType StickerFullType `json:"full_type"` - // Sticker's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner - Outline []*ClosedVectorPath `json:"outline"` // Sticker thumbnail in WEBP or JPEG format; may be null Thumbnail *Thumbnail `json:"thumbnail"` // File containing the sticker @@ -5368,7 +5421,6 @@ func (sticker *Sticker) UnmarshalJSON(data []byte) error { Emoji string `json:"emoji"` Format json.RawMessage `json:"format"` FullType json.RawMessage `json:"full_type"` - Outline []*ClosedVectorPath `json:"outline"` Thumbnail *Thumbnail `json:"thumbnail"` Sticker *File `json:"sticker"` } @@ -5383,7 +5435,6 @@ func (sticker *Sticker) UnmarshalJSON(data []byte) error { sticker.Width = tmp.Width sticker.Height = tmp.Height sticker.Emoji = tmp.Emoji - sticker.Outline = tmp.Outline sticker.Thumbnail = tmp.Thumbnail sticker.Sticker = tmp.Sticker @@ -5823,7 +5874,7 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { return nil } -// Describes an alternative reencoded quality of a video file +// Describes an alternative re-encoded quality of a video file type AlternativeVideo struct { meta // Video width @@ -7246,6 +7297,68 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes a subscription to a channel chat +type StarSubscriptionTypeChannel struct { + meta + // True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again + CanReuse bool `json:"can_reuse"` + // The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore + InviteLink string `json:"invite_link"` +} + +func (entity *StarSubscriptionTypeChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscriptionTypeChannel + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscriptionTypeChannel) GetClass() string { + return ClassStarSubscriptionType +} + +func (*StarSubscriptionTypeChannel) GetType() string { + return TypeStarSubscriptionTypeChannel +} + +func (*StarSubscriptionTypeChannel) StarSubscriptionTypeType() string { + return TypeStarSubscriptionTypeChannel +} + +// Describes a subscription in a bot or a business account +type StarSubscriptionTypeBot struct { + meta + // True, if the subscription was canceled by the bot and can't be extended + IsCanceledByBot bool `json:"is_canceled_by_bot"` + // Subscription invoice title + Title string `json:"title"` + // Subscription invoice photo + Photo *Photo `json:"photo"` + // The link to the subscription invoice + InvoiceLink string `json:"invoice_link"` +} + +func (entity *StarSubscriptionTypeBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscriptionTypeBot + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscriptionTypeBot) GetClass() string { + return ClassStarSubscriptionType +} + +func (*StarSubscriptionTypeBot) GetType() string { + return TypeStarSubscriptionTypeBot +} + +func (*StarSubscriptionTypeBot) StarSubscriptionTypeType() string { + return TypeStarSubscriptionTypeBot +} + // Describes subscription plan paid in Telegram Stars type StarSubscriptionPricing struct { meta @@ -7271,25 +7384,23 @@ func (*StarSubscriptionPricing) GetType() string { return TypeStarSubscriptionPricing } -// Contains information about subscription to a channel chat paid in Telegram Stars +// Contains information about subscription to a channel chat, a bot, or a business account that was paid in Telegram Stars type StarSubscription struct { meta // Unique identifier of the subscription Id string `json:"id"` - // Identifier of the channel chat that is subscribed + // Identifier of the chat that is subscribed ChatId int64 `json:"chat_id"` // Point in time (Unix timestamp) when the subscription will expire or expired ExpirationDate int32 `json:"expiration_date"` - // True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again - CanReuse bool `json:"can_reuse"` // True, if the subscription was canceled IsCanceled bool `json:"is_canceled"` // True, if the subscription expires soon and there are no enough Telegram Stars on the user's balance to extend it IsExpiring bool `json:"is_expiring"` - // The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore - InviteLink string `json:"invite_link"` // The subscription plan Pricing *StarSubscriptionPricing `json:"pricing"` + // Type of the subscription + Type StarSubscriptionType `json:"type"` } func (entity *StarSubscription) MarshalJSON() ([]byte, error) { @@ -7308,6 +7419,35 @@ func (*StarSubscription) GetType() string { return TypeStarSubscription } +func (starSubscription *StarSubscription) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + ChatId int64 `json:"chat_id"` + ExpirationDate int32 `json:"expiration_date"` + IsCanceled bool `json:"is_canceled"` + IsExpiring bool `json:"is_expiring"` + Pricing *StarSubscriptionPricing `json:"pricing"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starSubscription.Id = tmp.Id + starSubscription.ChatId = tmp.ChatId + starSubscription.ExpirationDate = tmp.ExpirationDate + starSubscription.IsCanceled = tmp.IsCanceled + starSubscription.IsExpiring = tmp.IsExpiring + starSubscription.Pricing = tmp.Pricing + + fieldType, _ := UnmarshalStarSubscriptionType(tmp.Type) + starSubscription.Type = fieldType + + return nil +} + // Represents a list of Telegram Star subscriptions type StarSubscriptions struct { meta @@ -7729,6 +7869,8 @@ type Gift struct { 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"` + // True, if the gift is a birthday gift + IsForBirthday bool `json:"is_for_birthday"` // Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out RemainingCount int32 `json:"remaining_count"` // Number of total times the gift can be purchased by all users; 0 if not limited @@ -7795,7 +7937,7 @@ type UserGift struct { 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 + // Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the current user SellStarCount int64 `json:"sell_star_count"` } @@ -7969,6 +8111,37 @@ func (*BotTransactionPurposeInvoicePayment) BotTransactionPurposeType() string { return TypeBotTransactionPurposeInvoicePayment } +// User bought a subscription in a bot or a business account +type BotTransactionPurposeSubscription struct { + meta + // The number of seconds between consecutive Telegram Star debiting + Period int32 `json:"period"` + // Information about the bought subscription; may be null if not applicable + ProductInfo *ProductInfo `json:"product_info"` + // Invoice payload; for bots only + InvoicePayload []byte `json:"invoice_payload"` +} + +func (entity *BotTransactionPurposeSubscription) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotTransactionPurposeSubscription + + return json.Marshal((*stub)(entity)) +} + +func (*BotTransactionPurposeSubscription) GetClass() string { + return ClassBotTransactionPurpose +} + +func (*BotTransactionPurposeSubscription) GetType() string { + return TypeBotTransactionPurposeSubscription +} + +func (*BotTransactionPurposeSubscription) BotTransactionPurposeType() string { + return TypeBotTransactionPurposeSubscription +} + // Paid media were bought type ChatTransactionPurposePaidMedia struct { meta @@ -8125,7 +8298,7 @@ func (*UserTransactionPurposeGiftedStars) UserTransactionPurposeType() string { return TypeUserTransactionPurposeGiftedStars } -// The current user sold a gift received from another user +// The user sold a gift received from another user or bot type UserTransactionPurposeGiftSell struct { meta // The gift @@ -8152,7 +8325,7 @@ func (*UserTransactionPurposeGiftSell) UserTransactionPurposeType() string { return TypeUserTransactionPurposeGiftSell } -// The current user sent a gift to another user +// The user or the bot sent a gift to a user type UserTransactionPurposeGiftSend struct { meta // The gift @@ -9266,8 +9439,18 @@ type BotInfo struct { DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` // Default administrator rights for adding the bot to channels; may be null DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` - // True, if the bot's revenue statistics are available + // Default light background color for bot Web Apps; -1 if not specified + WebAppBackgroundLightColor int32 `json:"web_app_background_light_color"` + // Default dark background color for bot Web Apps; -1 if not specified + WebAppBackgroundDarkColor int32 `json:"web_app_background_dark_color"` + // Default light header color for bot Web Apps; -1 if not specified + WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` + // Default dark header color for bot Web Apps; -1 if not specified + WebAppHeaderDarkColor int32 `json:"web_app_header_dark_color"` + // True, if the bot's revenue statistics are available to the current user CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + // True, if the bot can manage emoji status of the current user + CanManageEmojiStatus bool `json:"can_manage_emoji_status"` // True, if the bot has media previews HasMediaPreviews bool `json:"has_media_previews"` // The internal link, which can be used to edit bot commands; may be null @@ -9307,7 +9490,12 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { PrivacyPolicyUrl string `json:"privacy_policy_url"` DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + WebAppBackgroundLightColor int32 `json:"web_app_background_light_color"` + WebAppBackgroundDarkColor int32 `json:"web_app_background_dark_color"` + WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` + WebAppHeaderDarkColor int32 `json:"web_app_header_dark_color"` CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + CanManageEmojiStatus bool `json:"can_manage_emoji_status"` HasMediaPreviews bool `json:"has_media_previews"` EditCommandsLink json.RawMessage `json:"edit_commands_link"` EditDescriptionLink json.RawMessage `json:"edit_description_link"` @@ -9329,7 +9517,12 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.PrivacyPolicyUrl = tmp.PrivacyPolicyUrl botInfo.DefaultGroupAdministratorRights = tmp.DefaultGroupAdministratorRights botInfo.DefaultChannelAdministratorRights = tmp.DefaultChannelAdministratorRights + botInfo.WebAppBackgroundLightColor = tmp.WebAppBackgroundLightColor + botInfo.WebAppBackgroundDarkColor = tmp.WebAppBackgroundDarkColor + botInfo.WebAppHeaderLightColor = tmp.WebAppHeaderLightColor + botInfo.WebAppHeaderDarkColor = tmp.WebAppHeaderDarkColor botInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics + botInfo.CanManageEmojiStatus = tmp.CanManageEmojiStatus botInfo.HasMediaPreviews = tmp.HasMediaPreviews fieldEditCommandsLink, _ := UnmarshalInternalLinkType(tmp.EditCommandsLink) @@ -16006,6 +16199,132 @@ func (*LoginUrlInfoRequestConfirmation) LoginUrlInfoType() string { return TypeLoginUrlInfoRequestConfirmation } +// Contains parameters of the application theme +type ThemeParameters struct { + meta + // A color of the background in the RGB format + BackgroundColor int32 `json:"background_color"` + // A secondary color for the background in the RGB format + SecondaryBackgroundColor int32 `json:"secondary_background_color"` + // A color of the header background in the RGB format + HeaderBackgroundColor int32 `json:"header_background_color"` + // A color of the bottom bar background in the RGB format + BottomBarBackgroundColor int32 `json:"bottom_bar_background_color"` + // A color of the section background in the RGB format + SectionBackgroundColor int32 `json:"section_background_color"` + // A color of the section separator in the RGB format + SectionSeparatorColor int32 `json:"section_separator_color"` + // A color of text in the RGB format + TextColor int32 `json:"text_color"` + // An accent color of the text in the RGB format + AccentTextColor int32 `json:"accent_text_color"` + // A color of text on the section headers in the RGB format + SectionHeaderTextColor int32 `json:"section_header_text_color"` + // A color of the subtitle text in the RGB format + SubtitleTextColor int32 `json:"subtitle_text_color"` + // A color of the text for destructive actions in the RGB format + DestructiveTextColor int32 `json:"destructive_text_color"` + // A color of hints in the RGB format + HintColor int32 `json:"hint_color"` + // A color of links in the RGB format + LinkColor int32 `json:"link_color"` + // A color of the buttons in the RGB format + ButtonColor int32 `json:"button_color"` + // A color of text on the buttons in the RGB format + ButtonTextColor int32 `json:"button_text_color"` +} + +func (entity *ThemeParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThemeParameters + + return json.Marshal((*stub)(entity)) +} + +func (*ThemeParameters) GetClass() string { + return ClassThemeParameters +} + +func (*ThemeParameters) GetType() string { + return TypeThemeParameters +} + +// The Web App is opened in the compact mode +type WebAppOpenModeCompact struct{ + meta +} + +func (entity *WebAppOpenModeCompact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenModeCompact + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenModeCompact) GetClass() string { + return ClassWebAppOpenMode +} + +func (*WebAppOpenModeCompact) GetType() string { + return TypeWebAppOpenModeCompact +} + +func (*WebAppOpenModeCompact) WebAppOpenModeType() string { + return TypeWebAppOpenModeCompact +} + +// The Web App is opened in the full-size mode +type WebAppOpenModeFullSize struct{ + meta +} + +func (entity *WebAppOpenModeFullSize) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenModeFullSize + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenModeFullSize) GetClass() string { + return ClassWebAppOpenMode +} + +func (*WebAppOpenModeFullSize) GetType() string { + return TypeWebAppOpenModeFullSize +} + +func (*WebAppOpenModeFullSize) WebAppOpenModeType() string { + return TypeWebAppOpenModeFullSize +} + +// The Web App is opened in the full-screen mode +type WebAppOpenModeFullScreen struct{ + meta +} + +func (entity *WebAppOpenModeFullScreen) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenModeFullScreen + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenModeFullScreen) GetClass() string { + return ClassWebAppOpenMode +} + +func (*WebAppOpenModeFullScreen) GetType() string { + return TypeWebAppOpenModeFullScreen +} + +func (*WebAppOpenModeFullScreen) WebAppOpenModeType() string { + return TypeWebAppOpenModeFullScreen +} + // Contains information about a Web App found by its short name type FoundWebApp struct { meta @@ -16063,8 +16382,8 @@ type MainWebApp struct { meta // URL of the Web App to open Url string `json:"url"` - // True, if the Web App must always be opened in the compact mode instead of the full-size mode - IsCompact bool `json:"is_compact"` + // The mode in which the Web App must be opened + Mode WebAppOpenMode `json:"mode"` } func (entity *MainWebApp) MarshalJSON() ([]byte, error) { @@ -16083,6 +16402,73 @@ func (*MainWebApp) GetType() string { return TypeMainWebApp } +func (mainWebApp *MainWebApp) UnmarshalJSON(data []byte) error { + var tmp struct { + Url string `json:"url"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + mainWebApp.Url = tmp.Url + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + mainWebApp.Mode = fieldMode + + return nil +} + +// Options to be used when a Web App is opened +type WebAppOpenParameters struct { + meta + // Preferred Web App theme; pass null to use the default theme + Theme *ThemeParameters `json:"theme"` + // Short name of the current application; 0-64 English letters, digits, and underscores + ApplicationName string `json:"application_name"` + // The mode in which the Web App is opened; pass null to open in webAppOpenModeFullSize + Mode WebAppOpenMode `json:"mode"` +} + +func (entity *WebAppOpenParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenParameters + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenParameters) GetClass() string { + return ClassWebAppOpenParameters +} + +func (*WebAppOpenParameters) GetType() string { + return TypeWebAppOpenParameters +} + +func (webAppOpenParameters *WebAppOpenParameters) UnmarshalJSON(data []byte) error { + var tmp struct { + Theme *ThemeParameters `json:"theme"` + ApplicationName string `json:"application_name"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + webAppOpenParameters.Theme = tmp.Theme + webAppOpenParameters.ApplicationName = tmp.ApplicationName + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + webAppOpenParameters.Mode = fieldMode + + return nil +} + // Contains information about a message thread type MessageThreadInfo struct { meta @@ -20250,57 +20636,6 @@ func (*LocationAddress) GetType() string { return TypeLocationAddress } -// Contains parameters of the application theme -type ThemeParameters struct { - meta - // A color of the background in the RGB format - BackgroundColor int32 `json:"background_color"` - // A secondary color for the background in the RGB format - SecondaryBackgroundColor int32 `json:"secondary_background_color"` - // A color of the header background in the RGB format - HeaderBackgroundColor int32 `json:"header_background_color"` - // A color of the bottom bar background in the RGB format - BottomBarBackgroundColor int32 `json:"bottom_bar_background_color"` - // A color of the section background in the RGB format - SectionBackgroundColor int32 `json:"section_background_color"` - // A color of the section separator in the RGB format - SectionSeparatorColor int32 `json:"section_separator_color"` - // A color of text in the RGB format - TextColor int32 `json:"text_color"` - // An accent color of the text in the RGB format - AccentTextColor int32 `json:"accent_text_color"` - // A color of text on the section headers in the RGB format - SectionHeaderTextColor int32 `json:"section_header_text_color"` - // A color of the subtitle text in the RGB format - SubtitleTextColor int32 `json:"subtitle_text_color"` - // A color of the text for destructive actions in the RGB format - DestructiveTextColor int32 `json:"destructive_text_color"` - // A color of hints in the RGB format - HintColor int32 `json:"hint_color"` - // A color of links in the RGB format - LinkColor int32 `json:"link_color"` - // A color of the buttons in the RGB format - ButtonColor int32 `json:"button_color"` - // A color of text on the buttons in the RGB format - ButtonTextColor int32 `json:"button_text_color"` -} - -func (entity *ThemeParameters) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ThemeParameters - - return json.Marshal((*stub)(entity)) -} - -func (*ThemeParameters) GetClass() string { - return ClassThemeParameters -} - -func (*ThemeParameters) GetType() string { - return TypeThemeParameters -} - // Portion of the price of a product (e.g., "delivery cost", "tax amount") type LabeledPricePart struct { meta @@ -20333,6 +20668,8 @@ type Invoice struct { Currency string `json:"currency"` // A list of objects used to calculate the total price of the product PriceParts []*LabeledPricePart `json:"price_parts"` + // The number of seconds between consecutive Telegram Star debiting for subscription invoices; 0 if the invoice doesn't create subscription + SubscriptionPeriod int32 `json:"subscription_period"` // The maximum allowed amount of tip in the smallest units of the currency MaxTipAmount int64 `json:"max_tip_amount"` // Suggested amounts of tip in the smallest units of the currency @@ -20779,6 +21116,33 @@ func (*PaymentFormTypeStars) PaymentFormTypeType() string { return TypePaymentFormTypeStars } +// The payment form is for a payment in Telegram Stars for subscription +type PaymentFormTypeStarSubscription struct { + meta + // Information about subscription plan + Pricing *StarSubscriptionPricing `json:"pricing"` +} + +func (entity *PaymentFormTypeStarSubscription) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentFormTypeStarSubscription + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentFormTypeStarSubscription) GetClass() string { + return ClassPaymentFormType +} + +func (*PaymentFormTypeStarSubscription) GetType() string { + return TypePaymentFormTypeStarSubscription +} + +func (*PaymentFormTypeStarSubscription) PaymentFormTypeType() string { + return TypePaymentFormTypeStarSubscription +} + // Contains information about an invoice payment form type PaymentForm struct { meta @@ -25002,7 +25366,7 @@ func (*MessageGameScore) MessageContentType() string { return TypeMessageGameScore } -// A payment has been completed +// A payment has been sent to a bot or a business account type MessagePaymentSuccessful struct { meta // Identifier of the chat, containing the corresponding invoice message @@ -25013,6 +25377,8 @@ type MessagePaymentSuccessful struct { Currency string `json:"currency"` // Total price for the product, in the smallest units of the currency TotalAmount int64 `json:"total_amount"` + // Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring + SubscriptionUntilDate int32 `json:"subscription_until_date"` // True, if this is a recurring payment IsRecurring bool `json:"is_recurring"` // True, if this is the first recurring payment @@ -25041,22 +25407,24 @@ func (*MessagePaymentSuccessful) MessageContentType() string { return TypeMessagePaymentSuccessful } -// A payment has been completed; for bots only +// A payment has been received by the bot or the business account type MessagePaymentSuccessfulBot struct { meta // Currency for price of the product Currency string `json:"currency"` // Total price for the product, in the smallest units of the currency TotalAmount int64 `json:"total_amount"` + // Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring + SubscriptionUntilDate int32 `json:"subscription_until_date"` // True, if this is a recurring payment IsRecurring bool `json:"is_recurring"` // True, if this is the first recurring payment IsFirstRecurring bool `json:"is_first_recurring"` // Invoice payload InvoicePayload []byte `json:"invoice_payload"` - // Identifier of the shipping option chosen by the user; may be empty if not applicable + // Identifier of the shipping option chosen by the user; may be empty if not applicable; for bots only ShippingOptionId string `json:"shipping_option_id"` - // Information about the order; may be null + // Information about the order; may be null; for bots only OrderInfo *OrderInfo `json:"order_info"` // Telegram payment identifier TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` @@ -25562,7 +25930,7 @@ type MessageGift struct { 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 + // Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the receiver 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"` @@ -27284,7 +27652,7 @@ func (inputMessageSticker *InputMessageSticker) UnmarshalJSON(data []byte) error // A video message type InputMessageVideo struct { meta - // Video to be sent. The video is expected to be reencoded to MPEG4 format with H.264 codec by the sender + // Video to be sent. The video is expected to be re-encoded 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"` @@ -28967,8 +29335,8 @@ type StickerSet struct { Name string `json:"name"` // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed Thumbnail *Thumbnail `json:"thumbnail"` - // Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + // Sticker set thumbnail's outline; may be null if unknown + ThumbnailOutline *Outline `json:"thumbnail_outline"` // True, if the sticker set is owned by the current user IsOwned bool `json:"is_owned"` // True, if the sticker set has been installed by the current user @@ -29013,7 +29381,7 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { Title string `json:"title"` Name string `json:"name"` Thumbnail *Thumbnail `json:"thumbnail"` - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + ThumbnailOutline *Outline `json:"thumbnail_outline"` IsOwned bool `json:"is_owned"` IsInstalled bool `json:"is_installed"` IsArchived bool `json:"is_archived"` @@ -29063,8 +29431,8 @@ type StickerSetInfo struct { Name string `json:"name"` // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed Thumbnail *Thumbnail `json:"thumbnail"` - // Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + // Sticker set thumbnail's outline; may be null if unknown + ThumbnailOutline *Outline `json:"thumbnail_outline"` // True, if the sticker set is owned by the current user IsOwned bool `json:"is_owned"` // True, if the sticker set has been installed by the current user @@ -29109,7 +29477,7 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { Title string `json:"title"` Name string `json:"name"` Thumbnail *Thumbnail `json:"thumbnail"` - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + ThumbnailOutline *Outline `json:"thumbnail_outline"` IsOwned bool `json:"is_owned"` IsInstalled bool `json:"is_installed"` IsArchived bool `json:"is_archived"` @@ -33801,6 +34169,130 @@ func (*UserLink) GetType() string { return TypeUserLink } +// Describes allowed types for the target chat +type TargetChatTypes struct { + meta + // True, if private chats with ordinary users are allowed + AllowUserChats bool `json:"allow_user_chats"` + // True, if private chats with other bots are allowed + AllowBotChats bool `json:"allow_bot_chats"` + // True, if basic group and supergroup chats are allowed + AllowGroupChats bool `json:"allow_group_chats"` + // True, if channel chats are allowed + AllowChannelChats bool `json:"allow_channel_chats"` +} + +func (entity *TargetChatTypes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatTypes + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatTypes) GetClass() string { + return ClassTargetChatTypes +} + +func (*TargetChatTypes) GetType() string { + return TypeTargetChatTypes +} + +// The currently opened chat needs to be kept +type TargetChatCurrent struct{ + meta +} + +func (entity *TargetChatCurrent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatCurrent + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatCurrent) GetClass() string { + return ClassTargetChat +} + +func (*TargetChatCurrent) GetType() string { + return TypeTargetChatCurrent +} + +func (*TargetChatCurrent) TargetChatType() string { + return TypeTargetChatCurrent +} + +// The chat needs to be chosen by the user among chats of the specified types +type TargetChatChosen struct { + meta + // Allowed types for the chat + Types *TargetChatTypes `json:"types"` +} + +func (entity *TargetChatChosen) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatChosen + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatChosen) GetClass() string { + return ClassTargetChat +} + +func (*TargetChatChosen) GetType() string { + return TypeTargetChatChosen +} + +func (*TargetChatChosen) TargetChatType() string { + return TypeTargetChatChosen +} + +// The chat needs to be open with the provided internal link +type TargetChatInternalLink struct { + meta + // An internal link pointing to the chat + Link InternalLinkType `json:"link"` +} + +func (entity *TargetChatInternalLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatInternalLink + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatInternalLink) GetClass() string { + return ClassTargetChat +} + +func (*TargetChatInternalLink) GetType() string { + return TypeTargetChatInternalLink +} + +func (*TargetChatInternalLink) TargetChatType() string { + return TypeTargetChatInternalLink +} + +func (targetChatInternalLink *TargetChatInternalLink) UnmarshalJSON(data []byte) error { + var tmp struct { + Link json.RawMessage `json:"link"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) + targetChatInternalLink.Link = fieldLink + + return nil +} + // Represents a link to an animated GIF or an animated (i.e., without sound) H.264/MPEG-4 AVC video type InputInlineQueryResultAnimation struct { meta @@ -35221,6 +35713,79 @@ func (inlineQueryResults *InlineQueryResults) UnmarshalJSON(data []byte) error { return nil } +// Represents an inline message that can be sent via the bot +type PreparedInlineMessageId struct { + meta + // Unique identifier for the message + Id string `json:"id"` + // Point in time (Unix timestamp) when the message can't be used anymore + ExpirationDate int32 `json:"expiration_date"` +} + +func (entity *PreparedInlineMessageId) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PreparedInlineMessageId + + return json.Marshal((*stub)(entity)) +} + +func (*PreparedInlineMessageId) GetClass() string { + return ClassPreparedInlineMessageId +} + +func (*PreparedInlineMessageId) GetType() string { + return TypePreparedInlineMessageId +} + +// Represents a ready to send inline message. Use sendInlineQueryResultMessage to send the message +type PreparedInlineMessage struct { + meta + // Unique identifier of the inline query to pass to sendInlineQueryResultMessage + InlineQueryId JsonInt64 `json:"inline_query_id"` + // Resulted inline message of the query + Result InlineQueryResult `json:"result"` + // Types of the chats to which the message can be sent + ChatTypes *TargetChatTypes `json:"chat_types"` +} + +func (entity *PreparedInlineMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PreparedInlineMessage + + return json.Marshal((*stub)(entity)) +} + +func (*PreparedInlineMessage) GetClass() string { + return ClassPreparedInlineMessage +} + +func (*PreparedInlineMessage) GetType() string { + return TypePreparedInlineMessage +} + +func (preparedInlineMessage *PreparedInlineMessage) UnmarshalJSON(data []byte) error { + var tmp struct { + InlineQueryId JsonInt64 `json:"inline_query_id"` + Result json.RawMessage `json:"result"` + ChatTypes *TargetChatTypes `json:"chat_types"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + preparedInlineMessage.InlineQueryId = tmp.InlineQueryId + preparedInlineMessage.ChatTypes = tmp.ChatTypes + + fieldResult, _ := UnmarshalInlineQueryResult(tmp.Result) + preparedInlineMessage.Result = fieldResult + + return nil +} + // The payload for a general callback button type CallbackQueryPayloadData struct { meta @@ -43120,6 +43685,31 @@ func (*UserPrivacySettingRuleAllowContacts) UserPrivacySettingRuleType() string return TypeUserPrivacySettingRuleAllowContacts } +// A rule to allow all bots to do something +type UserPrivacySettingRuleAllowBots struct{ + meta +} + +func (entity *UserPrivacySettingRuleAllowBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleAllowBots + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleAllowBots) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleAllowBots) GetType() string { + return TypeUserPrivacySettingRuleAllowBots +} + +func (*UserPrivacySettingRuleAllowBots) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleAllowBots +} + // A rule to allow all Premium Users to do something; currently, allowed only for userPrivacySettingAllowChatInvites type UserPrivacySettingRuleAllowPremiumUsers struct{ meta @@ -43249,6 +43839,31 @@ func (*UserPrivacySettingRuleRestrictContacts) UserPrivacySettingRuleType() stri return TypeUserPrivacySettingRuleRestrictContacts } +// A rule to restrict all bots from doing something +type UserPrivacySettingRuleRestrictBots struct{ + meta +} + +func (entity *UserPrivacySettingRuleRestrictBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleRestrictBots + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleRestrictBots) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleRestrictBots) GetType() string { + return TypeUserPrivacySettingRuleRestrictBots +} + +func (*UserPrivacySettingRuleRestrictBots) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleRestrictBots +} + // A rule to restrict all specified users from doing something type UserPrivacySettingRuleRestrictUsers struct { meta @@ -43617,6 +44232,31 @@ func (*UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) UserPrivacySetti return TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages } +// A privacy setting for managing whether received gifts are automatically shown on the user's profile page +type UserPrivacySettingAutosaveGifts struct{ + meta +} + +func (entity *UserPrivacySettingAutosaveGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAutosaveGifts + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAutosaveGifts) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAutosaveGifts) GetType() string { + return TypeUserPrivacySettingAutosaveGifts +} + +func (*UserPrivacySettingAutosaveGifts) UserPrivacySettingType() string { + return TypeUserPrivacySettingAutosaveGifts +} + // Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting type ReadDatePrivacySettings struct { meta @@ -44874,107 +45514,6 @@ func (*ReportStoryResultTextRequired) ReportStoryResultType() string { return TypeReportStoryResultTextRequired } -// The currently opened chat needs to be kept -type TargetChatCurrent struct{ - meta -} - -func (entity *TargetChatCurrent) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TargetChatCurrent - - return json.Marshal((*stub)(entity)) -} - -func (*TargetChatCurrent) GetClass() string { - return ClassTargetChat -} - -func (*TargetChatCurrent) GetType() string { - return TypeTargetChatCurrent -} - -func (*TargetChatCurrent) TargetChatType() string { - return TypeTargetChatCurrent -} - -// The chat needs to be chosen by the user among chats of the specified types -type TargetChatChosen struct { - meta - // True, if private chats with ordinary users are allowed - AllowUserChats bool `json:"allow_user_chats"` - // True, if private chats with other bots are allowed - AllowBotChats bool `json:"allow_bot_chats"` - // True, if basic group and supergroup chats are allowed - AllowGroupChats bool `json:"allow_group_chats"` - // True, if channel chats are allowed - AllowChannelChats bool `json:"allow_channel_chats"` -} - -func (entity *TargetChatChosen) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TargetChatChosen - - return json.Marshal((*stub)(entity)) -} - -func (*TargetChatChosen) GetClass() string { - return ClassTargetChat -} - -func (*TargetChatChosen) GetType() string { - return TypeTargetChatChosen -} - -func (*TargetChatChosen) TargetChatType() string { - return TypeTargetChatChosen -} - -// The chat needs to be open with the provided internal link -type TargetChatInternalLink struct { - meta - // An internal link pointing to the chat - Link InternalLinkType `json:"link"` -} - -func (entity *TargetChatInternalLink) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TargetChatInternalLink - - return json.Marshal((*stub)(entity)) -} - -func (*TargetChatInternalLink) GetClass() string { - return ClassTargetChat -} - -func (*TargetChatInternalLink) GetType() string { - return TypeTargetChatInternalLink -} - -func (*TargetChatInternalLink) TargetChatType() string { - return TypeTargetChatInternalLink -} - -func (targetChatInternalLink *TargetChatInternalLink) UnmarshalJSON(data []byte) error { - var tmp struct { - Link json.RawMessage `json:"link"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) - targetChatInternalLink.Link = fieldLink - - return nil -} - // The link is a link to the Devices section of the application. Use getActiveSessions to get the list of active sessions and show them to the user type InternalLinkTypeActiveSessions struct{ meta @@ -45571,15 +46110,15 @@ func (*InternalLinkTypeLanguageSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeLanguageSettings } -// The link is a link to the main Web App of a bot. Call searchPublicChat with the given bot username, check that the user is a bot and has the main Web App. If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. Then, use getMainWebApp with the given start parameter and open the returned URL as a Web App +// The link is a link to the main Web App of a bot. Call searchPublicChat with the given bot username, check that the user is a bot and has the main Web App. If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. Then, use getMainWebApp with the given start parameter and mode and open the returned URL as a Web App type InternalLinkTypeMainWebApp struct { meta // Username of the bot BotUsername string `json:"bot_username"` // Start parameter to be passed to getMainWebApp StartParameter string `json:"start_parameter"` - // True, if the Web App must be opened in the compact mode instead of the full-size mode - IsCompact bool `json:"is_compact"` + // The mode to be passed to getMainWebApp + Mode WebAppOpenMode `json:"mode"` } func (entity *InternalLinkTypeMainWebApp) MarshalJSON() ([]byte, error) { @@ -45602,6 +46141,27 @@ func (*InternalLinkTypeMainWebApp) InternalLinkTypeType() string { return TypeInternalLinkTypeMainWebApp } +func (internalLinkTypeMainWebApp *InternalLinkTypeMainWebApp) UnmarshalJSON(data []byte) error { + var tmp struct { + BotUsername string `json:"bot_username"` + StartParameter string `json:"start_parameter"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + internalLinkTypeMainWebApp.BotUsername = tmp.BotUsername + internalLinkTypeMainWebApp.StartParameter = tmp.StartParameter + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + internalLinkTypeMainWebApp.Mode = fieldMode + + return nil +} + // The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link, and then open received forum topic or chat and show the message there type InternalLinkTypeMessage struct { meta @@ -46246,8 +46806,8 @@ type InternalLinkTypeWebApp struct { WebAppShortName string `json:"web_app_short_name"` // Start parameter to be passed to getWebAppLinkUrl StartParameter string `json:"start_parameter"` - // True, if the Web App must be opened in the compact mode instead of the full-size mode - IsCompact bool `json:"is_compact"` + // The mode in which the Web App must be opened + Mode WebAppOpenMode `json:"mode"` } func (entity *InternalLinkTypeWebApp) MarshalJSON() ([]byte, error) { @@ -46270,6 +46830,29 @@ func (*InternalLinkTypeWebApp) InternalLinkTypeType() string { return TypeInternalLinkTypeWebApp } +func (internalLinkTypeWebApp *InternalLinkTypeWebApp) UnmarshalJSON(data []byte) error { + var tmp struct { + BotUsername string `json:"bot_username"` + WebAppShortName string `json:"web_app_short_name"` + StartParameter string `json:"start_parameter"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + internalLinkTypeWebApp.BotUsername = tmp.BotUsername + internalLinkTypeWebApp.WebAppShortName = tmp.WebAppShortName + internalLinkTypeWebApp.StartParameter = tmp.StartParameter + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + internalLinkTypeWebApp.Mode = fieldMode + + return nil +} + // Contains an HTTPS link to a message in a supergroup or channel, or a forum topic type MessageLink struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 7d468fc..c30f7ad 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -659,6 +659,40 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } +func UnmarshalStarSubscriptionType(data json.RawMessage) (StarSubscriptionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStarSubscriptionTypeChannel: + return UnmarshalStarSubscriptionTypeChannel(data) + + case TypeStarSubscriptionTypeBot: + return UnmarshalStarSubscriptionTypeBot(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStarSubscriptionType(dataList []json.RawMessage) ([]StarSubscriptionType, error) { + list := []StarSubscriptionType{} + + for _, data := range dataList { + entity, err := UnmarshalStarSubscriptionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { var meta meta @@ -708,6 +742,9 @@ func UnmarshalBotTransactionPurpose(data json.RawMessage) (BotTransactionPurpose case TypeBotTransactionPurposeInvoicePayment: return UnmarshalBotTransactionPurposeInvoicePayment(data) + case TypeBotTransactionPurposeSubscription: + return UnmarshalBotTransactionPurposeSubscription(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -2071,6 +2108,43 @@ func UnmarshalListOfLoginUrlInfo(dataList []json.RawMessage) ([]LoginUrlInfo, er return list, nil } +func UnmarshalWebAppOpenMode(data json.RawMessage) (WebAppOpenMode, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeWebAppOpenModeCompact: + return UnmarshalWebAppOpenModeCompact(data) + + case TypeWebAppOpenModeFullSize: + return UnmarshalWebAppOpenModeFullSize(data) + + case TypeWebAppOpenModeFullScreen: + return UnmarshalWebAppOpenModeFullScreen(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfWebAppOpenMode(dataList []json.RawMessage) ([]WebAppOpenMode, error) { + list := []WebAppOpenMode{} + + for _, data := range dataList { + entity, err := UnmarshalWebAppOpenMode(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSavedMessagesTopicType(data json.RawMessage) (SavedMessagesTopicType, error) { var meta meta @@ -2657,6 +2731,9 @@ func UnmarshalPaymentFormType(data json.RawMessage) (PaymentFormType, error) { case TypePaymentFormTypeStars: return UnmarshalPaymentFormTypeStars(data) + case TypePaymentFormTypeStarSubscription: + return UnmarshalPaymentFormTypeStarSubscription(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4674,6 +4751,43 @@ func UnmarshalListOfBotWriteAccessAllowReason(dataList []json.RawMessage) ([]Bot return list, nil } +func UnmarshalTargetChat(data json.RawMessage) (TargetChat, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTargetChatCurrent: + return UnmarshalTargetChatCurrent(data) + + case TypeTargetChatChosen: + return UnmarshalTargetChatChosen(data) + + case TypeTargetChatInternalLink: + return UnmarshalTargetChatInternalLink(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTargetChat(dataList []json.RawMessage) ([]TargetChat, error) { + list := []TargetChat{} + + for _, data := range dataList { + entity, err := UnmarshalTargetChat(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputInlineQueryResult(data json.RawMessage) (InputInlineQueryResult, error) { var meta meta @@ -6302,6 +6416,9 @@ func UnmarshalUserPrivacySettingRule(data json.RawMessage) (UserPrivacySettingRu case TypeUserPrivacySettingRuleAllowContacts: return UnmarshalUserPrivacySettingRuleAllowContacts(data) + case TypeUserPrivacySettingRuleAllowBots: + return UnmarshalUserPrivacySettingRuleAllowBots(data) + case TypeUserPrivacySettingRuleAllowPremiumUsers: return UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data) @@ -6317,6 +6434,9 @@ func UnmarshalUserPrivacySettingRule(data json.RawMessage) (UserPrivacySettingRu case TypeUserPrivacySettingRuleRestrictContacts: return UnmarshalUserPrivacySettingRuleRestrictContacts(data) + case TypeUserPrivacySettingRuleRestrictBots: + return UnmarshalUserPrivacySettingRuleRestrictBots(data) + case TypeUserPrivacySettingRuleRestrictUsers: return UnmarshalUserPrivacySettingRuleRestrictUsers(data) @@ -6384,6 +6504,9 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro case TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages: return UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data) + case TypeUserPrivacySettingAutosaveGifts: + return UnmarshalUserPrivacySettingAutosaveGifts(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6654,43 +6777,6 @@ func UnmarshalListOfReportStoryResult(dataList []json.RawMessage) ([]ReportStory return list, nil } -func UnmarshalTargetChat(data json.RawMessage) (TargetChat, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeTargetChatCurrent: - return UnmarshalTargetChatCurrent(data) - - case TypeTargetChatChosen: - return UnmarshalTargetChatChosen(data) - - case TypeTargetChatInternalLink: - return UnmarshalTargetChatInternalLink(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfTargetChat(dataList []json.RawMessage) ([]TargetChat, error) { - list := []TargetChat{} - - for _, data := range dataList { - entity, err := UnmarshalTargetChat(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { var meta meta @@ -8756,6 +8842,14 @@ func UnmarshalClosedVectorPath(data json.RawMessage) (*ClosedVectorPath, error) return &resp, err } +func UnmarshalOutline(data json.RawMessage) (*Outline, error) { + var resp Outline + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPollOption(data json.RawMessage) (*PollOption, error) { var resp PollOption @@ -9260,6 +9354,22 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalStarSubscriptionTypeChannel(data json.RawMessage) (*StarSubscriptionTypeChannel, error) { + var resp StarSubscriptionTypeChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarSubscriptionTypeBot(data json.RawMessage) (*StarSubscriptionTypeBot, error) { + var resp StarSubscriptionTypeBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarSubscriptionPricing(data json.RawMessage) (*StarSubscriptionPricing, error) { var resp StarSubscriptionPricing @@ -9436,6 +9546,14 @@ func UnmarshalBotTransactionPurposeInvoicePayment(data json.RawMessage) (*BotTra return &resp, err } +func UnmarshalBotTransactionPurposeSubscription(data json.RawMessage) (*BotTransactionPurposeSubscription, error) { + var resp BotTransactionPurposeSubscription + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatTransactionPurposePaidMedia(data json.RawMessage) (*ChatTransactionPurposePaidMedia, error) { var resp ChatTransactionPurposePaidMedia @@ -11308,6 +11426,38 @@ func UnmarshalLoginUrlInfoRequestConfirmation(data json.RawMessage) (*LoginUrlIn return &resp, err } +func UnmarshalThemeParameters(data json.RawMessage) (*ThemeParameters, error) { + var resp ThemeParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebAppOpenModeCompact(data json.RawMessage) (*WebAppOpenModeCompact, error) { + var resp WebAppOpenModeCompact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebAppOpenModeFullSize(data json.RawMessage) (*WebAppOpenModeFullSize, error) { + var resp WebAppOpenModeFullSize + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebAppOpenModeFullScreen(data json.RawMessage) (*WebAppOpenModeFullScreen, error) { + var resp WebAppOpenModeFullScreen + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFoundWebApp(data json.RawMessage) (*FoundWebApp, error) { var resp FoundWebApp @@ -11332,6 +11482,14 @@ func UnmarshalMainWebApp(data json.RawMessage) (*MainWebApp, error) { return &resp, err } +func UnmarshalWebAppOpenParameters(data json.RawMessage) (*WebAppOpenParameters, error) { + var resp WebAppOpenParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageThreadInfo(data json.RawMessage) (*MessageThreadInfo, error) { var resp MessageThreadInfo @@ -12244,14 +12402,6 @@ func UnmarshalLocationAddress(data json.RawMessage) (*LocationAddress, error) { return &resp, err } -func UnmarshalThemeParameters(data json.RawMessage) (*ThemeParameters, error) { - var resp ThemeParameters - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalLabeledPricePart(data json.RawMessage) (*LabeledPricePart, error) { var resp LabeledPricePart @@ -12372,6 +12522,14 @@ func UnmarshalPaymentFormTypeStars(data json.RawMessage) (*PaymentFormTypeStars, return &resp, err } +func UnmarshalPaymentFormTypeStarSubscription(data json.RawMessage) (*PaymentFormTypeStarSubscription, error) { + var resp PaymentFormTypeStarSubscription + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPaymentForm(data json.RawMessage) (*PaymentForm, error) { var resp PaymentForm @@ -15540,6 +15698,38 @@ func UnmarshalUserLink(data json.RawMessage) (*UserLink, error) { return &resp, err } +func UnmarshalTargetChatTypes(data json.RawMessage) (*TargetChatTypes, error) { + var resp TargetChatTypes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTargetChatCurrent(data json.RawMessage) (*TargetChatCurrent, error) { + var resp TargetChatCurrent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTargetChatChosen(data json.RawMessage) (*TargetChatChosen, error) { + var resp TargetChatChosen + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTargetChatInternalLink(data json.RawMessage) (*TargetChatInternalLink, error) { + var resp TargetChatInternalLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputInlineQueryResultAnimation(data json.RawMessage) (*InputInlineQueryResultAnimation, error) { var resp InputInlineQueryResultAnimation @@ -15764,6 +15954,22 @@ func UnmarshalInlineQueryResults(data json.RawMessage) (*InlineQueryResults, err return &resp, err } +func UnmarshalPreparedInlineMessageId(data json.RawMessage) (*PreparedInlineMessageId, error) { + var resp PreparedInlineMessageId + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPreparedInlineMessage(data json.RawMessage) (*PreparedInlineMessage, error) { + var resp PreparedInlineMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallbackQueryPayloadData(data json.RawMessage) (*CallbackQueryPayloadData, error) { var resp CallbackQueryPayloadData @@ -17924,6 +18130,14 @@ func UnmarshalUserPrivacySettingRuleAllowContacts(data json.RawMessage) (*UserPr return &resp, err } +func UnmarshalUserPrivacySettingRuleAllowBots(data json.RawMessage) (*UserPrivacySettingRuleAllowBots, error) { + var resp UserPrivacySettingRuleAllowBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data json.RawMessage) (*UserPrivacySettingRuleAllowPremiumUsers, error) { var resp UserPrivacySettingRuleAllowPremiumUsers @@ -17964,6 +18178,14 @@ func UnmarshalUserPrivacySettingRuleRestrictContacts(data json.RawMessage) (*Use return &resp, err } +func UnmarshalUserPrivacySettingRuleRestrictBots(data json.RawMessage) (*UserPrivacySettingRuleRestrictBots, error) { + var resp UserPrivacySettingRuleRestrictBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingRuleRestrictUsers(data json.RawMessage) (*UserPrivacySettingRuleRestrictUsers, error) { var resp UserPrivacySettingRuleRestrictUsers @@ -18076,6 +18298,14 @@ func UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data json. return &resp, err } +func UnmarshalUserPrivacySettingAutosaveGifts(data json.RawMessage) (*UserPrivacySettingAutosaveGifts, error) { + var resp UserPrivacySettingAutosaveGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReadDatePrivacySettings(data json.RawMessage) (*ReadDatePrivacySettings, error) { var resp ReadDatePrivacySettings @@ -18444,30 +18674,6 @@ func UnmarshalReportStoryResultTextRequired(data json.RawMessage) (*ReportStoryR return &resp, err } -func UnmarshalTargetChatCurrent(data json.RawMessage) (*TargetChatCurrent, error) { - var resp TargetChatCurrent - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalTargetChatChosen(data json.RawMessage) (*TargetChatChosen, error) { - var resp TargetChatChosen - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalTargetChatInternalLink(data json.RawMessage) (*TargetChatInternalLink, error) { - var resp TargetChatInternalLink - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalInternalLinkTypeActiveSessions(data json.RawMessage) (*InternalLinkTypeActiveSessions, error) { var resp InternalLinkTypeActiveSessions @@ -21453,6 +21659,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeClosedVectorPath: return UnmarshalClosedVectorPath(data) + case TypeOutline: + return UnmarshalOutline(data) + case TypePollOption: return UnmarshalPollOption(data) @@ -21642,6 +21851,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeStarSubscriptionTypeChannel: + return UnmarshalStarSubscriptionTypeChannel(data) + + case TypeStarSubscriptionTypeBot: + return UnmarshalStarSubscriptionTypeBot(data) + case TypeStarSubscriptionPricing: return UnmarshalStarSubscriptionPricing(data) @@ -21708,6 +21923,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBotTransactionPurposeInvoicePayment: return UnmarshalBotTransactionPurposeInvoicePayment(data) + case TypeBotTransactionPurposeSubscription: + return UnmarshalBotTransactionPurposeSubscription(data) + case TypeChatTransactionPurposePaidMedia: return UnmarshalChatTransactionPurposePaidMedia(data) @@ -22410,6 +22628,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLoginUrlInfoRequestConfirmation: return UnmarshalLoginUrlInfoRequestConfirmation(data) + case TypeThemeParameters: + return UnmarshalThemeParameters(data) + + case TypeWebAppOpenModeCompact: + return UnmarshalWebAppOpenModeCompact(data) + + case TypeWebAppOpenModeFullSize: + return UnmarshalWebAppOpenModeFullSize(data) + + case TypeWebAppOpenModeFullScreen: + return UnmarshalWebAppOpenModeFullScreen(data) + case TypeFoundWebApp: return UnmarshalFoundWebApp(data) @@ -22419,6 +22649,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMainWebApp: return UnmarshalMainWebApp(data) + case TypeWebAppOpenParameters: + return UnmarshalWebAppOpenParameters(data) + case TypeMessageThreadInfo: return UnmarshalMessageThreadInfo(data) @@ -22761,9 +22994,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLocationAddress: return UnmarshalLocationAddress(data) - case TypeThemeParameters: - return UnmarshalThemeParameters(data) - case TypeLabeledPricePart: return UnmarshalLabeledPricePart(data) @@ -22809,6 +23039,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePaymentFormTypeStars: return UnmarshalPaymentFormTypeStars(data) + case TypePaymentFormTypeStarSubscription: + return UnmarshalPaymentFormTypeStarSubscription(data) + case TypePaymentForm: return UnmarshalPaymentForm(data) @@ -23997,6 +24230,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserLink: return UnmarshalUserLink(data) + case TypeTargetChatTypes: + return UnmarshalTargetChatTypes(data) + + case TypeTargetChatCurrent: + return UnmarshalTargetChatCurrent(data) + + case TypeTargetChatChosen: + return UnmarshalTargetChatChosen(data) + + case TypeTargetChatInternalLink: + return UnmarshalTargetChatInternalLink(data) + case TypeInputInlineQueryResultAnimation: return UnmarshalInputInlineQueryResultAnimation(data) @@ -24081,6 +24326,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInlineQueryResults: return UnmarshalInlineQueryResults(data) + case TypePreparedInlineMessageId: + return UnmarshalPreparedInlineMessageId(data) + + case TypePreparedInlineMessage: + return UnmarshalPreparedInlineMessage(data) + case TypeCallbackQueryPayloadData: return UnmarshalCallbackQueryPayloadData(data) @@ -24891,6 +25142,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingRuleAllowContacts: return UnmarshalUserPrivacySettingRuleAllowContacts(data) + case TypeUserPrivacySettingRuleAllowBots: + return UnmarshalUserPrivacySettingRuleAllowBots(data) + case TypeUserPrivacySettingRuleAllowPremiumUsers: return UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data) @@ -24906,6 +25160,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingRuleRestrictContacts: return UnmarshalUserPrivacySettingRuleRestrictContacts(data) + case TypeUserPrivacySettingRuleRestrictBots: + return UnmarshalUserPrivacySettingRuleRestrictBots(data) + case TypeUserPrivacySettingRuleRestrictUsers: return UnmarshalUserPrivacySettingRuleRestrictUsers(data) @@ -24948,6 +25205,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages: return UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data) + case TypeUserPrivacySettingAutosaveGifts: + return UnmarshalUserPrivacySettingAutosaveGifts(data) + case TypeReadDatePrivacySettings: return UnmarshalReadDatePrivacySettings(data) @@ -25086,15 +25346,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeReportStoryResultTextRequired: return UnmarshalReportStoryResultTextRequired(data) - case TypeTargetChatCurrent: - return UnmarshalTargetChatCurrent(data) - - case TypeTargetChatChosen: - return UnmarshalTargetChatChosen(data) - - case TypeTargetChatInternalLink: - return UnmarshalTargetChatInternalLink(data) - case TypeInternalLinkTypeActiveSessions: return UnmarshalInternalLinkTypeActiveSessions(data) diff --git a/data/td_api.tl b/data/td_api.tl index c7dd285..ee20b8d 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -357,9 +357,12 @@ stickerFullTypeMask mask_position:maskPosition = StickerFullType; stickerFullTypeCustomEmoji custom_emoji_id:int64 needs_repainting:Bool = StickerFullType; -//@description Represents a closed vector path. The path begins at the end point of the last command @commands List of vector path commands +//@description Represents a closed vector path. The path begins at the end point of the last command. The coordinate system origin is in the upper-left corner @commands List of vector path commands closedVectorPath commands:vector = ClosedVectorPath; +//@description Represents outline of an image @paths The list of closed vector paths +outline paths:vector = Outline; + //@description Describes one answer option of a poll //@text Option text; 1-100 characters. Only custom emoji entities are allowed @@ -427,10 +430,9 @@ photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Ph //@emoji Emoji corresponding to the sticker //@format Sticker format //@full_type Sticker's full type -//@outline Sticker's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner //@thumbnail Sticker thumbnail in WEBP or JPEG format; may be null //@sticker File containing the sticker -sticker id:int64 set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat full_type:StickerFullType outline:vector thumbnail:thumbnail sticker:file = Sticker; +sticker id:int64 set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat full_type:StickerFullType thumbnail:thumbnail sticker:file = Sticker; //@description Describes a video file //@duration Duration of the video, in seconds; as defined by the sender @@ -526,7 +528,7 @@ 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 +//@description Describes an alternative re-encoded quality of a video file //@width Video width //@height Video height //@codec Codec used for video file encoding, for example, "h264", "h265", or "av1" @@ -811,21 +813,35 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; +//@class StarSubscriptionType @description Describes type of subscription paid in Telegram Stars + +//@description Describes a subscription to a channel chat +//@can_reuse True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again +//@invite_link The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore +starSubscriptionTypeChannel can_reuse:Bool invite_link:string = StarSubscriptionType; + +//@description Describes a subscription in a bot or a business account +//@is_canceled_by_bot True, if the subscription was canceled by the bot and can't be extended +//@title Subscription invoice title +//@photo Subscription invoice photo +//@invoice_link The link to the subscription invoice +starSubscriptionTypeBot is_canceled_by_bot:Bool title:string photo:photo invoice_link:string = StarSubscriptionType; + + //@description Describes subscription plan paid in Telegram Stars //@period The number of seconds between consecutive Telegram Star debiting //@star_count The amount of Telegram Stars that must be paid for each period starSubscriptionPricing period:int32 star_count:int53 = StarSubscriptionPricing; -//@description Contains information about subscription to a channel chat paid in Telegram Stars +//@description Contains information about subscription to a channel chat, a bot, or a business account that was paid in Telegram Stars //@id Unique identifier of the subscription -//@chat_id Identifier of the channel chat that is subscribed +//@chat_id Identifier of the chat that is subscribed //@expiration_date Point in time (Unix timestamp) when the subscription will expire or expired -//@can_reuse True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again //@is_canceled True, if the subscription was canceled //@is_expiring True, if the subscription expires soon and there are no enough Telegram Stars on the user's balance to extend it -//@invite_link The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore //@pricing The subscription plan -starSubscription id:string chat_id:int53 expiration_date:int32 can_reuse:Bool is_canceled:Bool is_expiring:Bool invite_link:string pricing:starSubscriptionPricing = StarSubscription; +//@type Type of the subscription +starSubscription id:string chat_id:int53 expiration_date:int32 is_canceled:Bool is_expiring:Bool pricing:starSubscriptionPricing type:StarSubscriptionType = StarSubscription; //@description Represents a list of Telegram Star subscriptions //@star_count The amount of owned Telegram Stars @@ -918,11 +934,12 @@ starGiveawayPaymentOptions options:vector = StarGivea //@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 +//@is_for_birthday True, if the gift is a birthday gift //@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out //@total_count Number of total times the gift can be purchased by all users; 0 if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; //@description Contains a list of gifts that can be sent to another user @gifts The list of gifts gifts gifts:vector = Gifts; @@ -935,7 +952,7 @@ gifts gifts:vector = Gifts; //@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 +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the current user 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 @@ -964,6 +981,12 @@ botTransactionPurposePaidMedia media:vector payload:string = BotTrans //@invoice_payload Invoice payload; for bots only botTransactionPurposeInvoicePayment product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; +//@description User bought a subscription in a bot or a business account +//@period The number of seconds between consecutive Telegram Star debiting +//@product_info Information about the bought subscription; may be null if not applicable +//@invoice_payload Invoice payload; for bots only +botTransactionPurposeSubscription period:int32 product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; + //@class ChatTransactionPurpose @description Describes purpose of a transaction with a supergroup or a channel @@ -989,10 +1012,10 @@ chatTransactionPurposeGiveaway giveaway_message_id:int53 = ChatTransactionPurpos //@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 +//@description The user sold a gift received from another user or bot @gift The gift userTransactionPurposeGiftSell gift:gift = UserTransactionPurpose; -//@description The current user sent a gift to another user @gift The gift +//@description The user or the bot sent a gift to a user @gift The gift userTransactionPurposeGiftSend gift:gift = UserTransactionPurpose; @@ -1176,13 +1199,18 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null -//@can_get_revenue_statistics True, if the bot's revenue statistics are available +//@web_app_background_light_color Default light background color for bot Web Apps; -1 if not specified +//@web_app_background_dark_color Default dark background color for bot Web Apps; -1 if not specified +//@web_app_header_light_color Default light header color for bot Web Apps; -1 if not specified +//@web_app_header_dark_color Default dark header color for bot Web Apps; -1 if not specified +//@can_get_revenue_statistics True, if the bot's revenue statistics are available to the current user +//@can_manage_emoji_status True, if the bot can manage emoji status of the current user //@has_media_previews True, if the bot has media previews //@edit_commands_link The internal link, which can be used to edit bot commands; may be null //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights can_get_revenue_statistics:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -2357,6 +2385,37 @@ loginUrlInfoOpen url:string skip_confirmation:Bool = LoginUrlInfo; loginUrlInfoRequestConfirmation url:string domain:string bot_user_id:int53 request_write_access:Bool = LoginUrlInfo; +//@description Contains parameters of the application theme +//@background_color A color of the background in the RGB format +//@secondary_background_color A secondary color for the background in the RGB format +//@header_background_color A color of the header background in the RGB format +//@bottom_bar_background_color A color of the bottom bar background in the RGB format +//@section_background_color A color of the section background in the RGB format +//@section_separator_color A color of the section separator in the RGB format +//@text_color A color of text in the RGB format +//@accent_text_color An accent color of the text in the RGB format +//@section_header_text_color A color of text on the section headers in the RGB format +//@subtitle_text_color A color of the subtitle text in the RGB format +//@destructive_text_color A color of the text for destructive actions in the RGB format +//@hint_color A color of hints in the RGB format +//@link_color A color of links in the RGB format +//@button_color A color of the buttons in the RGB format +//@button_text_color A color of text on the buttons in the RGB format +themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 bottom_bar_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; + + +//@class WebAppOpenMode @description Describes mode in which a Web App is opened + +//@description The Web App is opened in the compact mode +webAppOpenModeCompact = WebAppOpenMode; + +//@description The Web App is opened in the full-size mode +webAppOpenModeFullSize = WebAppOpenMode; + +//@description The Web App is opened in the full-screen mode +webAppOpenModeFullScreen = WebAppOpenMode; + + //@description Contains information about a Web App found by its short name //@web_app The Web App //@request_write_access True, if the user must be asked for the permission to the bot to send them messages @@ -2366,8 +2425,14 @@ foundWebApp web_app:webApp request_write_access:Bool skip_confirmation:Bool = Fo //@description Contains information about a Web App @launch_id Unique identifier for the Web App launch @url A Web App URL to open in a web view webAppInfo launch_id:int64 url:string = WebAppInfo; -//@description Contains information about the main Web App of a bot @url URL of the Web App to open @is_compact True, if the Web App must always be opened in the compact mode instead of the full-size mode -mainWebApp url:string is_compact:Bool = MainWebApp; +//@description Contains information about the main Web App of a bot @url URL of the Web App to open @mode The mode in which the Web App must be opened +mainWebApp url:string mode:WebAppOpenMode = MainWebApp; + +//@description Options to be used when a Web App is opened +//@theme Preferred Web App theme; pass null to use the default theme +//@application_name Short name of the current application; 0-64 English letters, digits, and underscores +//@mode The mode in which the Web App is opened; pass null to open in webAppOpenModeFullSize +webAppOpenParameters theme:themeParameters application_name:string mode:WebAppOpenMode = WebAppOpenParameters; //@description Contains information about a message thread @@ -2946,31 +3011,13 @@ address country_code:string state:string city:string street_line1:string street_ locationAddress country_code:string state:string city:string street:string = LocationAddress; -//@description Contains parameters of the application theme -//@background_color A color of the background in the RGB format -//@secondary_background_color A secondary color for the background in the RGB format -//@header_background_color A color of the header background in the RGB format -//@bottom_bar_background_color A color of the bottom bar background in the RGB format -//@section_background_color A color of the section background in the RGB format -//@section_separator_color A color of the section separator in the RGB format -//@text_color A color of text in the RGB format -//@accent_text_color An accent color of the text in the RGB format -//@section_header_text_color A color of text on the section headers in the RGB format -//@subtitle_text_color A color of the subtitle text in the RGB format -//@destructive_text_color A color of the text for destructive actions in the RGB format -//@hint_color A color of hints in the RGB format -//@link_color A color of links in the RGB format -//@button_color A color of the buttons in the RGB format -//@button_text_color A color of text on the buttons in the RGB format -themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 bottom_bar_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; - - //@description Portion of the price of a product (e.g., "delivery cost", "tax amount") @label Label for this portion of the product price @amount Currency amount in the smallest units of the currency labeledPricePart label:string amount:int53 = LabeledPricePart; //@description Product invoice //@currency ISO 4217 currency code //@price_parts A list of objects used to calculate the total price of the product +//@subscription_period The number of seconds between consecutive Telegram Star debiting for subscription invoices; 0 if the invoice doesn't create subscription //@max_tip_amount The maximum allowed amount of tip in the smallest units of the currency //@suggested_tip_amounts Suggested amounts of tip in the smallest units of the currency //@recurring_payment_terms_of_service_url An HTTP URL with terms of service for recurring payments. If non-empty, the invoice payment will result in recurring payments and the user must accept the terms of service before allowed to pay @@ -2983,7 +3030,7 @@ labeledPricePart label:string amount:int53 = LabeledPricePart; //@send_phone_number_to_provider True, if the user's phone number will be sent to the provider //@send_email_address_to_provider True, if the user's email address will be sent to the provider //@is_flexible True, if the total price depends on the shipping method -invoice currency:string price_parts:vector max_tip_amount:int53 suggested_tip_amounts:vector recurring_payment_terms_of_service_url:string terms_of_service_url:string is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; +invoice currency:string price_parts:vector subscription_period:int32 max_tip_amount:int53 suggested_tip_amounts:vector recurring_payment_terms_of_service_url:string terms_of_service_url:string is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; //@description Order information //@name Name of the user @@ -3053,6 +3100,9 @@ paymentFormTypeRegular invoice:invoice payment_provider_user_id:int53 payment_pr //@description The payment form is for a payment in Telegram Stars @star_count Number of Telegram Stars that will be paid paymentFormTypeStars star_count:int53 = PaymentFormType; +//@description The payment form is for a payment in Telegram Stars for subscription @pricing Information about subscription plan +paymentFormTypeStarSubscription pricing:starSubscriptionPricing = PaymentFormType; + //@description Contains information about an invoice payment form //@id The payment form identifier @@ -3628,27 +3678,29 @@ messageCustomServiceAction text:string = MessageContent; //@description A new high score was achieved in a game @game_message_id Identifier of the message with the game, can be an identifier of a deleted message @game_id Identifier of the game; may be different from the games presented in the message with the game @score New score messageGameScore game_message_id:int53 game_id:int64 score:int32 = MessageContent; -//@description A payment has been completed +//@description A payment has been sent to a bot or a business account //@invoice_chat_id Identifier of the chat, containing the corresponding invoice message //@invoice_message_id Identifier of the message with the corresponding invoice; can be 0 or an identifier of a deleted message //@currency Currency for the price of the product //@total_amount Total price for the product, in the smallest units of the currency +//@subscription_until_date Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring //@is_recurring True, if this is a recurring payment //@is_first_recurring True, if this is the first recurring payment //@invoice_name Name of the invoice; may be empty if unknown -messagePaymentSuccessful invoice_chat_id:int53 invoice_message_id:int53 currency:string total_amount:int53 is_recurring:Bool is_first_recurring:Bool invoice_name:string = MessageContent; +messagePaymentSuccessful invoice_chat_id:int53 invoice_message_id:int53 currency:string total_amount:int53 subscription_until_date:int32 is_recurring:Bool is_first_recurring:Bool invoice_name:string = MessageContent; -//@description A payment has been completed; for bots only +//@description A payment has been received by the bot or the business account //@currency Currency for price of the product //@total_amount Total price for the product, in the smallest units of the currency +//@subscription_until_date Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring //@is_recurring True, if this is a recurring payment //@is_first_recurring True, if this is the first recurring payment //@invoice_payload Invoice payload -//@shipping_option_id Identifier of the shipping option chosen by the user; may be empty if not applicable -//@order_info Information about the order; may be null +//@shipping_option_id Identifier of the shipping option chosen by the user; may be empty if not applicable; for bots only +//@order_info Information about the order; may be null; for bots only //@telegram_payment_charge_id Telegram payment identifier //@provider_payment_charge_id Provider payment identifier -messagePaymentSuccessfulBot currency:string total_amount:int53 is_recurring:Bool is_first_recurring:Bool invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; +messagePaymentSuccessfulBot currency:string total_amount:int53 subscription_until_date:int32 is_recurring:Bool is_first_recurring:Bool invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; //@description A payment has been refunded //@owner_id Identifier of the previous owner of the Telegram Stars that refunds them @@ -3741,7 +3793,7 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@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 +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the receiver //@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 @@ -3984,7 +4036,7 @@ 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. The video is expected to be reencoded to MPEG4 format with H.264 codec by the sender +//@video Video to be sent. The video is expected to be re-encoded 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 @@ -4242,7 +4294,7 @@ emojis emojis:vector = Emojis; //@title Title of the sticker set //@name Name of the sticker set //@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed -//@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner +//@thumbnail_outline Sticker set thumbnail's outline; may be null if unknown //@is_owned True, if the sticker set is owned by the current user //@is_installed True, if the sticker set has been installed by the current user //@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously @@ -4253,14 +4305,14 @@ emojis emojis:vector = Emojis; //@is_viewed True for already viewed trending sticker sets //@stickers List of stickers in this set //@emojis A list of emojis corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; +stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:outline is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about a sticker set //@id Identifier of the sticker set //@title Title of the sticker set //@name Name of the sticker set //@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed -//@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner +//@thumbnail_outline Sticker set thumbnail's outline; may be null if unknown //@is_owned True, if the sticker set is owned by the current user //@is_installed True, if the sticker set has been installed by the current user //@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously @@ -4271,7 +4323,7 @@ stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outli //@is_viewed True for already viewed trending sticker sets //@size Total number of stickers in the set //@covers Up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full sticker set needs to be requested -stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; +stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:outline is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; //@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets stickerSets total_count:int32 sets:vector = StickerSets; @@ -5106,6 +5158,26 @@ httpUrl url:string = HttpUrl; userLink url:string expires_in:int32 = UserLink; +//@description Describes allowed types for the target chat +//@allow_user_chats True, if private chats with ordinary users are allowed +//@allow_bot_chats True, if private chats with other bots are allowed +//@allow_group_chats True, if basic group and supergroup chats are allowed +//@allow_channel_chats True, if channel chats are allowed +targetChatTypes allow_user_chats:Bool allow_bot_chats:Bool allow_group_chats:Bool allow_channel_chats:Bool = TargetChatTypes; + + +//@class TargetChat @description Describes the target chat to be opened + +//@description The currently opened chat needs to be kept +targetChatCurrent = TargetChat; + +//@description The chat needs to be chosen by the user among chats of the specified types @types Allowed types for the chat +targetChatChosen types:targetChatTypes = TargetChat; + +//@description The chat needs to be open with the provided internal link @link An internal link pointing to the chat +targetChatInternalLink link:InternalLinkType = TargetChat; + + //@class InputInlineQueryResult @description Represents a single result of an inline query; for bots only //@description Represents a link to an animated GIF or an animated (i.e., without sound) H.264/MPEG-4 AVC video @@ -5342,6 +5414,18 @@ inlineQueryResultsButton text:string type:InlineQueryResultsButtonType = InlineQ inlineQueryResults inline_query_id:int64 button:inlineQueryResultsButton results:vector next_offset:string = InlineQueryResults; +//@description Represents an inline message that can be sent via the bot +//@id Unique identifier for the message +//@expiration_date Point in time (Unix timestamp) when the message can't be used anymore +preparedInlineMessageId id:string expiration_date:int32 = PreparedInlineMessageId; + +//@description Represents a ready to send inline message. Use sendInlineQueryResultMessage to send the message +//@inline_query_id Unique identifier of the inline query to pass to sendInlineQueryResultMessage +//@result Resulted inline message of the query +//@chat_types Types of the chats to which the message can be sent +preparedInlineMessage inline_query_id:int64 result:InlineQueryResult chat_types:targetChatTypes = PreparedInlineMessage; + + //@class CallbackQueryPayload @description Represents a payload of a callback query //@description The payload for a general callback button @data Data that was attached to the callback button @@ -6409,6 +6493,9 @@ userPrivacySettingRuleAllowAll = UserPrivacySettingRule; //@description A rule to allow all contacts of the user to do something userPrivacySettingRuleAllowContacts = UserPrivacySettingRule; +//@description A rule to allow all bots to do something +userPrivacySettingRuleAllowBots = UserPrivacySettingRule; + //@description A rule to allow all Premium Users to do something; currently, allowed only for userPrivacySettingAllowChatInvites userPrivacySettingRuleAllowPremiumUsers = UserPrivacySettingRule; @@ -6424,6 +6511,9 @@ userPrivacySettingRuleRestrictAll = UserPrivacySettingRule; //@description A rule to restrict all contacts of the user from doing something userPrivacySettingRuleRestrictContacts = UserPrivacySettingRule; +//@description A rule to restrict all bots from doing something +userPrivacySettingRuleRestrictBots = UserPrivacySettingRule; + //@description A rule to restrict all specified users from doing something @user_ids The user identifiers, total number of users in all rules must not exceed 1000 userPrivacySettingRuleRestrictUsers user_ids:vector = UserPrivacySettingRule; @@ -6469,6 +6559,9 @@ userPrivacySettingAllowFindingByPhoneNumber = UserPrivacySetting; //@description A privacy setting for managing whether the user can receive voice and video messages in private chats; for Telegram Premium users only userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = UserPrivacySetting; +//@description A privacy setting for managing whether received gifts are automatically shown on the user's profile page +userPrivacySettingAutosaveGifts = UserPrivacySetting; + //@description Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting //@show_read_date True, if message read date is shown to other users in private chats. If false and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date @@ -6661,22 +6754,6 @@ reportStoryResultOptionRequired title:string options:vector = Repo 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 -targetChatCurrent = TargetChat; - -//@description The chat needs to be chosen by the user among chats of the specified types -//@allow_user_chats True, if private chats with ordinary users are allowed -//@allow_bot_chats True, if private chats with other bots are allowed -//@allow_group_chats True, if basic group and supergroup chats are allowed -//@allow_channel_chats True, if channel chats are allowed -targetChatChosen allow_user_chats:Bool allow_bot_chats:Bool allow_group_chats:Bool allow_channel_chats:Bool = TargetChat; - -//@description The chat needs to be open with the provided internal link @link An internal link pointing to the chat -targetChatInternalLink link:InternalLinkType = TargetChat; - - //@class InternalLinkType @description Describes an internal https://t.me or tg: link, which must be processed by the application in a special way //@description The link is a link to the Devices section of the application. Use getActiveSessions to get the list of active sessions and show them to the user @@ -6790,11 +6867,11 @@ internalLinkTypeLanguageSettings = InternalLinkType; //-If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, //-show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, //-then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. -//-Then, use getMainWebApp with the given start parameter and open the returned URL as a Web App +//-Then, use getMainWebApp with the given start parameter and mode and open the returned URL as a Web App //@bot_username Username of the bot //@start_parameter Start parameter to be passed to getMainWebApp -//@is_compact True, if the Web App must be opened in the compact mode instead of the full-size mode -internalLinkTypeMainWebApp bot_username:string start_parameter:string is_compact:Bool = InternalLinkType; +//@mode The mode to be passed to getMainWebApp +internalLinkTypeMainWebApp bot_username:string start_parameter:string mode:WebAppOpenMode = InternalLinkType; //@description The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link, //-and then open received forum topic or chat and show the message there @@ -6909,8 +6986,8 @@ internalLinkTypeVideoChat chat_username:string invite_hash:string is_live_stream //@bot_username Username of the bot that owns the Web App //@web_app_short_name Short name of the Web App //@start_parameter Start parameter to be passed to getWebAppLinkUrl -//@is_compact True, if the Web App must be opened in the compact mode instead of the full-size mode -internalLinkTypeWebApp bot_username:string web_app_short_name:string start_parameter:string is_compact:Bool = InternalLinkType; +//@mode The mode in which the Web App must be opened +internalLinkTypeWebApp bot_username:string web_app_short_name:string start_parameter:string mode:WebAppOpenMode = InternalLinkType; //@description Contains an HTTPS link to a message in a supergroup or channel, or a forum topic @link The link @is_public True, if the link will work for non-members of the chat @@ -9462,6 +9539,17 @@ getInlineQueryResults bot_user_id:int53 chat_id:int53 user_location:location que //@next_offset Offset for the next inline query; pass an empty string if there are no more results answerInlineQuery inline_query_id:int64 is_personal:Bool button:inlineQueryResultsButton results:vector cache_time:int32 next_offset:string = Ok; +//@description Saves an inline message to be sent by the given user; for bots only +//@user_id Identifier of the user +//@result The description of the message +//@chat_types Types of the chats to which the message can be sent +savePreparedInlineMessage user_id:int53 result:InputInlineQueryResult chat_types:targetChatTypes = PreparedInlineMessageId; + +//@description Saves an inline message to be sent by the given user; for bots only +//@bot_user_id Identifier of the bot that created the message +//@prepared_message_id Identifier of the prepared message +getPreparedInlineMessage bot_user_id:int53 prepared_message_id:string = PreparedInlineMessage; + //@description Returns the most grossing Web App bots //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -9473,30 +9561,30 @@ getGrossingWebAppBots offset:string limit:int32 = FoundUsers; //@web_app_short_name Short name of the Web App searchWebApp bot_user_id:int53 web_app_short_name:string = FoundWebApp; +//@description Returns a default placeholder for Web Apps of a bot; this is an offline request. Returns a 404 error if the placeholder isn't known @bot_user_id Identifier of the target bot +getWebAppPlaceholder bot_user_id:int53 = Outline; + //@description Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked //@chat_id Identifier of the chat in which the link was clicked; pass 0 if none //@bot_user_id Identifier of the target bot //@web_app_short_name Short name of the Web App //@start_parameter Start parameter from internalLinkTypeWebApp -//@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the current application; 0-64 English letters, digits, and underscores //@allow_write_access Pass true if the current user allowed the bot to send them messages -getWebAppLinkUrl chat_id:int53 bot_user_id:int53 web_app_short_name:string start_parameter:string theme:themeParameters application_name:string allow_write_access:Bool = HttpUrl; +//@parameters Parameters to use to open the Web App +getWebAppLinkUrl chat_id:int53 bot_user_id:int53 web_app_short_name:string start_parameter:string allow_write_access:Bool parameters:webAppOpenParameters = HttpUrl; //@description Returns information needed to open the main Web App of a bot //@chat_id Identifier of the chat in which the Web App is opened; pass 0 if none //@bot_user_id Identifier of the target bot //@start_parameter Start parameter from internalLinkTypeMainWebApp -//@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the current application; 0-64 English letters, digits, and underscores -getMainWebApp chat_id:int53 bot_user_id:int53 start_parameter:string theme:themeParameters application_name:string = MainWebApp; +//@parameters Parameters to use to open the Web App +getMainWebApp chat_id:int53 bot_user_id:int53 start_parameter:string parameters:webAppOpenParameters = MainWebApp; //@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button //@bot_user_id Identifier of the target bot //@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu -//@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the current application; 0-64 English letters, digits, and underscores -getWebAppUrl bot_user_id:int53 url:string theme:themeParameters application_name:string = HttpUrl; +//@parameters Parameters to use to open the Web App +getWebAppUrl bot_user_id:int53 url:string parameters:webAppOpenParameters = HttpUrl; //@description Sends data received from a keyboardButtonTypeWebApp Web App to a bot //@bot_user_id Identifier of the target bot @@ -9509,11 +9597,10 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats //@bot_user_id Identifier of the bot, providing the Web App //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise -//@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the current application; 0-64 English letters, digits, and underscores //@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none -openWebApp chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to:InputMessageReplyTo = WebAppInfo; +//@parameters Parameters to use to open the Web App +openWebApp chat_id:int53 bot_user_id:int53 url:string message_thread_id:int53 reply_to:InputMessageReplyTo parameters:webAppOpenParameters = WebAppInfo; //@description Informs TDLib that a previously opened Web App was closed @web_app_launch_id Identifier of Web App launch, received from openWebApp closeWebApp web_app_launch_id:int64 = Ok; @@ -9523,6 +9610,12 @@ closeWebApp web_app_launch_id:int64 = Ok; //@result The result of the query answerWebAppQuery web_app_query_id:string result:InputInlineQueryResult = SentWebAppMessage; +//@description Checks whether a file can be downloaded and saved locally by Web App request +//@bot_user_id Identifier of the bot, providing the Web App +//@file_name Name of the file +//@url URL of the file +checkWebAppFileDownload bot_user_id:int53 file_name:string url:string = Ok; + //@description Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires //@chat_id Identifier of the chat with the message @@ -10458,7 +10551,7 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@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; -//@description Returns RTMP URL for streaming to the chat; requires owner privileges @chat_id Chat identifier +//@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right @chat_id Chat identifier getVideoChatRtmpUrl chat_id:int53 = RtmpUrl; //@description Replaces the current RTMP URL for streaming to the chat; requires owner privileges @chat_id Chat identifier @@ -10643,6 +10736,12 @@ setUserPersonalProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; //@description Suggests a profile photo to another regular user with common messages @user_id User identifier @photo Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function suggestUserProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; +//@description Toggles whether the bot can manage emoji status of the current user @bot_user_id User identifier of the bot @can_manage_emoji_status Pass true if the bot is allowed to change emoji status of the user; pass false otherwise +toggleBotCanManageEmojiStatus bot_user_id:int53 can_manage_emoji_status:Bool = Ok; + +//@description Changes the emoji status of a user; for bots only @user_id Identifier of the user @emoji_status New emoji status; pass null to switch to the default badge +setUserEmojiStatus user_id:int53 emoji_status:emojiStatus = Ok; + //@description Searches a user by their phone number. Returns a 404 error if the user can't be found //@phone_number Phone number to search for @@ -10657,6 +10756,12 @@ sharePhoneNumber user_id:int53 = Ok; getUserProfilePhotos user_id:int53 offset:int32 limit:int32 = ChatPhotos; +//@description Returns outline of a sticker; this is an offline request. Returns a 404 error if the outline isn't known +//@sticker_file_id File identifier of the sticker +//@for_animated_emoji Pass true to get the outline scaled for animated emoji +//@for_clicked_animated_emoji_message Pass true to get the outline scaled for clicked animated emoji message +getStickerOutline sticker_file_id:int32 for_animated_emoji:Bool for_clicked_animated_emoji_message:Bool = Outline; + //@description Returns stickers from the installed sticker sets that correspond to any of the given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned //@sticker_type Type of the stickers to return //@query Search query; a space-separated list of emojis or a keyword prefix. If empty, returns all known installed stickers @@ -11278,8 +11383,10 @@ toggleGiftIsSaved sender_user_id:int53 message_id:int53 is_saved:Bool = Ok; 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 Creates a link for the given invoice; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which to send the request +//@invoice Information about the invoice of the type inputMessageInvoice +createInvoiceLink business_connection_id:string invoice:InputMessageContent = HttpUrl; //@description Refunds a previously done payment in Telegram Stars; for bots only //@user_id Identifier of the user that did the payment @@ -11786,12 +11893,18 @@ assignAppStoreTransaction receipt:bytes purpose:StorePaymentPurpose = Ok; //@purpose Transaction purpose assignGooglePlayTransaction package_name:string store_product_id:string purchase_token:string purpose:StorePaymentPurpose = Ok; -//@description Cancels or reenables Telegram Star subscription to a channel +//@description Cancels or re-enables Telegram Star subscription //@subscription_id Identifier of the subscription to change //@is_canceled New value of is_canceled editStarSubscription subscription_id:string is_canceled:Bool = Ok; -//@description Reuses an active subscription and joins the subscribed chat again @subscription_id Identifier of the subscription +//@description Cancels or re-enables Telegram Star subscription for a user; for bots only +//@user_id User identifier +//@telegram_payment_charge_id Telegram payment identifier of the subscription +//@is_canceled Pass true to cancel the subscription; pass false to allow the user to enable it +editUserStarSubscription user_id:int53 telegram_payment_charge_id:string is_canceled:Bool = Ok; + +//@description Reuses an active Telegram Star subscription to a channel chat and joins the chat again @subscription_id Identifier of the subscription reuseStarSubscription subscription_id:string = Ok; From 4b010c3b4336bce177b208f9db3a3707a0457f23 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Mon, 18 Nov 2024 13:15:17 +0800 Subject: [PATCH 04/29] Support FreeBSD --- client/tdlib.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/tdlib.go b/client/tdlib.go index adf0a0d..c9c07db 100644 --- a/client/tdlib.go +++ b/client/tdlib.go @@ -1,9 +1,11 @@ package client //#cgo linux CFLAGS: -I/usr/local/include +//#cgo freebsd CFLAGS: -I/usr/local/include //#cgo darwin CFLAGS: -I/usr/local/include //#cgo windows CFLAGS: -IE:/src/tdlib -IE:/src/tdlib/build //#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo freebsd LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm //#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm //#cgo windows LDFLAGS: -LE:/src/tdlib/build/Release -ltdjson //#include From 930f3352f321da987d6655a376650ddc7be95166 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 12 Dec 2024 14:18:11 +0800 Subject: [PATCH 05/29] Update go mod --- go.mod | 4 ++-- go.sum | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 204c57c..2b1a523 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/c0re100/gotdlib go 1.16 require ( - github.com/google/uuid v1.3.1 - golang.org/x/crypto v0.13.0 + github.com/google/uuid v1.6.0 + golang.org/x/crypto v0.31.0 ) diff --git a/go.sum b/go.sum index 26cc704..131bad5 100644 --- a/go.sum +++ b/go.sum @@ -1,20 +1,34 @@ -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -22,22 +36,34 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 58adcc480457a7667690521f0768cc50a3bab8e9 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 15 Dec 2024 02:12:12 +0800 Subject: [PATCH 06/29] Update to TDLib 1.8.41 --- client/function.go | 251 ++++++- client/type.go | 1638 +++++++++++++++++++++++++++-------------- client/unmarshaler.go | 664 +++++++++++------ data/td_api.tl | 353 ++++++--- 4 files changed, 2033 insertions(+), 873 deletions(-) diff --git a/client/function.go b/client/function.go index 5159be1..5b97dd5 100755 --- a/client/function.go +++ b/client/function.go @@ -7084,7 +7084,7 @@ type GetPreparedInlineMessageRequest struct { PreparedMessageId string `json:"prepared_message_id"` } -// Saves an inline message to be sent by the given user; for bots only +// Saves an inline message to be sent by the given user func (client *Client) GetPreparedInlineMessage(req *GetPreparedInlineMessageRequest) (*PreparedInlineMessage, error) { result, err := client.Send(Request{ meta: meta{ @@ -8021,6 +8021,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(result.Data) + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(result.Data) + case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(result.Data) @@ -10897,7 +10900,7 @@ func (client *Client) EditStoryCover(req *EditStoryCoverRequest) (*Ok, error) { type SetStoryPrivacySettingsRequest struct { // Identifier of the story StoryId int32 `json:"story_id"` - // The new privacy settigs for the story + // The new privacy settings for the story PrivacySettings StoryPrivacySettings `json:"privacy_settings"` } @@ -13393,7 +13396,7 @@ type CreateVideoChatRequest struct { Title string `json:"title"` // 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 + // Pass true to create an RTMP stream instead of an ordinary video chat IsRtmpStream bool `json:"is_rtmp_stream"` } @@ -14861,8 +14864,14 @@ func (client *Client) GetAllStickerEmojis(req *GetAllStickerEmojisRequest) (*Emo type SearchStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` - // Space-separated list of emojis to search for; must be non-empty + // Space-separated list of emojis to search for Emojis string `json:"emojis"` + // Query to search for; may be empty to search for emoji only + Query string `json:"query"` + // List of possible IETF language tags of the user's input language; may be empty if unknown + InputLanguageCodes []string `json:"input_language_codes"` + // The offset from which to return the stickers; must be non-negative + Offset int32 `json:"offset"` // The maximum number of stickers to be returned; 0-100 Limit int32 `json:"limit"` } @@ -14876,6 +14885,9 @@ func (client *Client) SearchStickers(req *SearchStickersRequest) (*Stickers, err Data: map[string]interface{}{ "sticker_type": req.StickerType, "emojis": req.Emojis, + "query": req.Query, + "input_language_codes": req.InputLanguageCodes, + "offset": req.Offset, "limit": req.Limit, }, }) @@ -15796,6 +15808,25 @@ func (client *Client) GetRecentInlineBots() (*Users, error) { return UnmarshalUsers(result.Data) } +// Returns the list of bots owned by the current user +func (client *Client) GetOwnedBots() (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getOwnedBots", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + type SearchHashtagsRequest struct { // Hashtag prefix to search for Prefix string `json:"prefix"` @@ -22230,6 +22261,218 @@ func (client *Client) ReuseStarSubscription(req *ReuseStarSubscriptionRequest) ( return UnmarshalOk(result.Data) } +type SetChatAffiliateProgramRequest struct { + // Identifier of the chat with an owned bot for which affiliate program is changed + ChatId int64 `json:"chat_id"` + // Parameters of the affiliate program; pass null to close the currently active program. If there is an active program, then commission and program duration can only be increased. If the active program is scheduled to be closed, then it can't be changed anymore + Parameters *AffiliateProgramParameters `json:"parameters"` +} + +// Changes affiliate program for a bot +func (client *Client) SetChatAffiliateProgram(req *SetChatAffiliateProgramRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SearchChatAffiliateProgramRequest struct { + // Username of the chat + Username string `json:"username"` + // The referrer from an internalLinkTypeChatAffiliateProgram link + Referrer string `json:"referrer"` +} + +// Searches a chat with an affiliate program. Returns the chat if found and the program is active +func (client *Client) SearchChatAffiliateProgram(req *SearchChatAffiliateProgramRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "username": req.Username, + "referrer": req.Referrer, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type SearchAffiliateProgramsRequest struct { + // Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Sort order for the results + SortOrder AffiliateProgramSortOrder `json:"sort_order"` + // Offset of the first affiliate program 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 affiliate programs to return + Limit int32 `json:"limit"` +} + +// Searches affiliate programs that can be applied to the given chat +func (client *Client) SearchAffiliatePrograms(req *SearchAffiliateProgramsRequest) (*FoundAffiliatePrograms, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchAffiliatePrograms", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "sort_order": req.SortOrder, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundAffiliatePrograms(result.Data) +} + +type ConnectChatAffiliateProgramRequest struct { + // Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Identifier of the bot, which affiliate program is connected + BotUserId int64 `json:"bot_user_id"` +} + +// Connects an affiliate program to the given chat. Returns information about the connected affiliate program +func (client *Client) ConnectChatAffiliateProgram(req *ConnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "connectChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliateProgram(result.Data) +} + +type DisconnectChatAffiliateProgramRequest struct { + // Identifier of the chat for which the affiliate program is connected + ChatId int64 `json:"chat_id"` + // The referral link of the affiliate program + Url string `json:"url"` +} + +// Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +func (client *Client) DisconnectChatAffiliateProgram(req *DisconnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "disconnectChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliateProgram(result.Data) +} + +type GetChatAffiliateProgramRequest struct { + // Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Identifier of the bot that created the program + BotUserId int64 `json:"bot_user_id"` +} + +// Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program +func (client *Client) GetChatAffiliateProgram(req *GetChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatAffiliateProgram", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliateProgram(result.Data) +} + +type GetChatAffiliateProgramsRequest struct { + // Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right + ChatId int64 `json:"chat_id"` + // Offset of the first affiliate program 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 affiliate programs to return + Limit int32 `json:"limit"` +} + +// Returns affiliate programs that were connected to the given chat +func (client *Client) GetChatAffiliatePrograms(req *GetChatAffiliateProgramsRequest) (*ChatAffiliatePrograms, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatAffiliatePrograms", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAffiliatePrograms(result.Data) +} + type GetBusinessFeaturesRequest struct { // Source of the request; pass null if the method is called from settings or some non-standard source Source BusinessFeature `json:"source"` diff --git a/client/type.go b/client/type.go index 7f43b1a..e2c1ee7 100755 --- a/client/type.go +++ b/client/type.go @@ -24,11 +24,9 @@ const ( ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" ClassStarSubscriptionType = "StarSubscriptionType" + ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" ClassStarTransactionDirection = "StarTransactionDirection" - ClassBotTransactionPurpose = "BotTransactionPurpose" - ClassChatTransactionPurpose = "ChatTransactionPurpose" - ClassUserTransactionPurpose = "UserTransactionPurpose" - ClassStarTransactionPartner = "StarTransactionPartner" + ClassStarTransactionType = "StarTransactionType" ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" ClassGiveawayInfo = "GiveawayInfo" ClassGiveawayPrize = "GiveawayPrize" @@ -237,9 +235,17 @@ const ( ClassChatPhotos = "ChatPhotos" ClassChatPermissions = "ChatPermissions" ClassChatAdministratorRights = "ChatAdministratorRights" + ClassStarAmount = "StarAmount" ClassStarSubscriptionPricing = "StarSubscriptionPricing" ClassStarSubscription = "StarSubscription" ClassStarSubscriptions = "StarSubscriptions" + ClassAffiliateProgramParameters = "AffiliateProgramParameters" + ClassAffiliateProgramInfo = "AffiliateProgramInfo" + ClassAffiliateInfo = "AffiliateInfo" + ClassFoundAffiliateProgram = "FoundAffiliateProgram" + ClassFoundAffiliatePrograms = "FoundAffiliatePrograms" + ClassChatAffiliateProgram = "ChatAffiliateProgram" + ClassChatAffiliatePrograms = "ChatAffiliatePrograms" ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" @@ -713,11 +719,22 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeStarAmount = "starAmount" TypeStarSubscriptionTypeChannel = "starSubscriptionTypeChannel" TypeStarSubscriptionTypeBot = "starSubscriptionTypeBot" TypeStarSubscriptionPricing = "starSubscriptionPricing" TypeStarSubscription = "starSubscription" TypeStarSubscriptions = "starSubscriptions" + TypeAffiliateProgramSortOrderProfitability = "affiliateProgramSortOrderProfitability" + TypeAffiliateProgramSortOrderCreationDate = "affiliateProgramSortOrderCreationDate" + TypeAffiliateProgramSortOrderRevenue = "affiliateProgramSortOrderRevenue" + TypeAffiliateProgramParameters = "affiliateProgramParameters" + TypeAffiliateProgramInfo = "affiliateProgramInfo" + TypeAffiliateInfo = "affiliateInfo" + TypeFoundAffiliateProgram = "foundAffiliateProgram" + TypeFoundAffiliatePrograms = "foundAffiliatePrograms" + TypeChatAffiliateProgram = "chatAffiliateProgram" + TypeChatAffiliatePrograms = "chatAffiliatePrograms" TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" @@ -735,27 +752,31 @@ const ( TypeUserGifts = "userGifts" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" - TypeBotTransactionPurposePaidMedia = "botTransactionPurposePaidMedia" - TypeBotTransactionPurposeInvoicePayment = "botTransactionPurposeInvoicePayment" - TypeBotTransactionPurposeSubscription = "botTransactionPurposeSubscription" - TypeChatTransactionPurposePaidMedia = "chatTransactionPurposePaidMedia" - TypeChatTransactionPurposeJoin = "chatTransactionPurposeJoin" - TypeChatTransactionPurposeReaction = "chatTransactionPurposeReaction" - TypeChatTransactionPurposeGiveaway = "chatTransactionPurposeGiveaway" - TypeUserTransactionPurposeGiftedStars = "userTransactionPurposeGiftedStars" - TypeUserTransactionPurposeGiftSell = "userTransactionPurposeGiftSell" - TypeUserTransactionPurposeGiftSend = "userTransactionPurposeGiftSend" - TypeStarTransactionPartnerTelegram = "starTransactionPartnerTelegram" - TypeStarTransactionPartnerAppStore = "starTransactionPartnerAppStore" - TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" - TypeStarTransactionPartnerFragment = "starTransactionPartnerFragment" - TypeStarTransactionPartnerTelegramAds = "starTransactionPartnerTelegramAds" - TypeStarTransactionPartnerTelegramApi = "starTransactionPartnerTelegramApi" - TypeStarTransactionPartnerBot = "starTransactionPartnerBot" - TypeStarTransactionPartnerBusiness = "starTransactionPartnerBusiness" - TypeStarTransactionPartnerChat = "starTransactionPartnerChat" - TypeStarTransactionPartnerUser = "starTransactionPartnerUser" - TypeStarTransactionPartnerUnsupported = "starTransactionPartnerUnsupported" + TypeStarTransactionTypePremiumBotDeposit = "starTransactionTypePremiumBotDeposit" + TypeStarTransactionTypeAppStoreDeposit = "starTransactionTypeAppStoreDeposit" + TypeStarTransactionTypeGooglePlayDeposit = "starTransactionTypeGooglePlayDeposit" + TypeStarTransactionTypeFragmentDeposit = "starTransactionTypeFragmentDeposit" + TypeStarTransactionTypeUserDeposit = "starTransactionTypeUserDeposit" + TypeStarTransactionTypeGiveawayDeposit = "starTransactionTypeGiveawayDeposit" + TypeStarTransactionTypeFragmentWithdrawal = "starTransactionTypeFragmentWithdrawal" + TypeStarTransactionTypeTelegramAdsWithdrawal = "starTransactionTypeTelegramAdsWithdrawal" + TypeStarTransactionTypeTelegramApiUsage = "starTransactionTypeTelegramApiUsage" + TypeStarTransactionTypeBotPaidMediaPurchase = "starTransactionTypeBotPaidMediaPurchase" + TypeStarTransactionTypeBotPaidMediaSale = "starTransactionTypeBotPaidMediaSale" + TypeStarTransactionTypeChannelPaidMediaPurchase = "starTransactionTypeChannelPaidMediaPurchase" + TypeStarTransactionTypeChannelPaidMediaSale = "starTransactionTypeChannelPaidMediaSale" + TypeStarTransactionTypeBotInvoicePurchase = "starTransactionTypeBotInvoicePurchase" + TypeStarTransactionTypeBotInvoiceSale = "starTransactionTypeBotInvoiceSale" + TypeStarTransactionTypeBotSubscriptionPurchase = "starTransactionTypeBotSubscriptionPurchase" + TypeStarTransactionTypeBotSubscriptionSale = "starTransactionTypeBotSubscriptionSale" + TypeStarTransactionTypeChannelSubscriptionPurchase = "starTransactionTypeChannelSubscriptionPurchase" + TypeStarTransactionTypeChannelSubscriptionSale = "starTransactionTypeChannelSubscriptionSale" + TypeStarTransactionTypeGiftPurchase = "starTransactionTypeGiftPurchase" + TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" + TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" + TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" + TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" + TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" TypeGiveawayParticipantStatusEligible = "giveawayParticipantStatusEligible" @@ -1888,6 +1909,7 @@ const ( TypeInternalLinkTypeBusinessChat = "internalLinkTypeBusinessChat" TypeInternalLinkTypeBuyStars = "internalLinkTypeBuyStars" TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" + TypeInternalLinkTypeChatAffiliateProgram = "internalLinkTypeChatAffiliateProgram" TypeInternalLinkTypeChatBoost = "internalLinkTypeChatBoost" TypeInternalLinkTypeChatFolderInvite = "internalLinkTypeChatFolderInvite" TypeInternalLinkTypeChatFolderSettings = "internalLinkTypeChatFolderSettings" @@ -1941,6 +1963,10 @@ const ( TypeFileTypeSecret = "fileTypeSecret" TypeFileTypeSecretThumbnail = "fileTypeSecretThumbnail" TypeFileTypeSecure = "fileTypeSecure" + TypeFileTypeSelfDestructingPhoto = "fileTypeSelfDestructingPhoto" + TypeFileTypeSelfDestructingVideo = "fileTypeSelfDestructingVideo" + TypeFileTypeSelfDestructingVideoNote = "fileTypeSelfDestructingVideoNote" + TypeFileTypeSelfDestructingVoiceNote = "fileTypeSelfDestructingVoiceNote" TypeFileTypeSticker = "fileTypeSticker" TypeFileTypeThumbnail = "fileTypeThumbnail" TypeFileTypeUnknown = "fileTypeUnknown" @@ -2310,29 +2336,19 @@ type StarSubscriptionType interface { StarSubscriptionTypeType() string } +// Describes the order of the found affiliate programs +type AffiliateProgramSortOrder interface { + AffiliateProgramSortOrderType() string +} + // Describes direction of a transaction with Telegram Stars type StarTransactionDirection interface { StarTransactionDirectionType() string } -// Describes purpose of a transaction with a bot -type BotTransactionPurpose interface { - BotTransactionPurposeType() string -} - -// Describes purpose of a transaction with a supergroup or a channel -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 +// Describes type of transaction with Telegram Stars +type StarTransactionType interface { + StarTransactionTypeType() string } // Contains information about status of a user in a giveaway @@ -7297,6 +7313,31 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes a possibly non-integer amount of Telegram Stars +type StarAmount struct { + meta + // The integer amount of Telegram Stars rounded to 0 + StarCount int64 `json:"star_count"` + // The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999 + NanostarCount int32 `json:"nanostar_count"` +} + +func (entity *StarAmount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarAmount + + return json.Marshal((*stub)(entity)) +} + +func (*StarAmount) GetClass() string { + return ClassStarAmount +} + +func (*StarAmount) GetType() string { + return TypeStarAmount +} + // Describes a subscription to a channel chat type StarSubscriptionTypeChannel struct { meta @@ -7452,7 +7493,7 @@ func (starSubscription *StarSubscription) UnmarshalJSON(data []byte) error { type StarSubscriptions struct { meta // The amount of owned Telegram Stars - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` // List of subscriptions for Telegram Stars Subscriptions []*StarSubscription `json:"subscriptions"` // The number of Telegram Stars required to buy to extend subscriptions expiring soon @@ -7477,6 +7518,274 @@ func (*StarSubscriptions) GetType() string { return TypeStarSubscriptions } +// The affiliate programs must be sorted by the profitability +type AffiliateProgramSortOrderProfitability struct{ + meta +} + +func (entity *AffiliateProgramSortOrderProfitability) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramSortOrderProfitability + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramSortOrderProfitability) GetClass() string { + return ClassAffiliateProgramSortOrder +} + +func (*AffiliateProgramSortOrderProfitability) GetType() string { + return TypeAffiliateProgramSortOrderProfitability +} + +func (*AffiliateProgramSortOrderProfitability) AffiliateProgramSortOrderType() string { + return TypeAffiliateProgramSortOrderProfitability +} + +// The affiliate programs must be sorted by creation date +type AffiliateProgramSortOrderCreationDate struct{ + meta +} + +func (entity *AffiliateProgramSortOrderCreationDate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramSortOrderCreationDate + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramSortOrderCreationDate) GetClass() string { + return ClassAffiliateProgramSortOrder +} + +func (*AffiliateProgramSortOrderCreationDate) GetType() string { + return TypeAffiliateProgramSortOrderCreationDate +} + +func (*AffiliateProgramSortOrderCreationDate) AffiliateProgramSortOrderType() string { + return TypeAffiliateProgramSortOrderCreationDate +} + +// The affiliate programs must be sorted by the expected revenue +type AffiliateProgramSortOrderRevenue struct{ + meta +} + +func (entity *AffiliateProgramSortOrderRevenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramSortOrderRevenue + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramSortOrderRevenue) GetClass() string { + return ClassAffiliateProgramSortOrder +} + +func (*AffiliateProgramSortOrderRevenue) GetType() string { + return TypeAffiliateProgramSortOrderRevenue +} + +func (*AffiliateProgramSortOrderRevenue) AffiliateProgramSortOrderType() string { + return TypeAffiliateProgramSortOrderRevenue +} + +// Describes parameters of an affiliate program +type AffiliateProgramParameters struct { + meta + // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner; getOption("affiliate_program_commission_per_mille_min")-getOption("affiliate_program_commission_per_mille_max") + CommissionPerMille int32 `json:"commission_per_mille"` + // Number of months the program will be active; 0-36. If 0, then the program is eternal + MonthCount int32 `json:"month_count"` +} + +func (entity *AffiliateProgramParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramParameters + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramParameters) GetClass() string { + return ClassAffiliateProgramParameters +} + +func (*AffiliateProgramParameters) GetType() string { + return TypeAffiliateProgramParameters +} + +// Contains information about an active affiliate program +type AffiliateProgramInfo struct { + meta + // Parameters of the affiliate program + Parameters *AffiliateProgramParameters `json:"parameters"` + // Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. If positive, then the program can't be connected using connectChatAffiliateProgram, but active connections will work until the date + EndDate int32 `json:"end_date"` + // The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program + DailyRevenuePerUserAmount *StarAmount `json:"daily_revenue_per_user_amount"` +} + +func (entity *AffiliateProgramInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateProgramInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateProgramInfo) GetClass() string { + return ClassAffiliateProgramInfo +} + +func (*AffiliateProgramInfo) GetType() string { + return TypeAffiliateProgramInfo +} + +// Contains information about an affiliate that received commission from a Telegram Star transaction +type AffiliateInfo struct { + meta + // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner + CommissionPerMille int32 `json:"commission_per_mille"` + // Identifier of the chat which received the commission + AffiliateChatId int64 `json:"affiliate_chat_id"` + // The amount of Telegram Stars that were received by the affiliate; can be negative for refunds + StarAmount *StarAmount `json:"star_amount"` +} + +func (entity *AffiliateInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateInfo) GetClass() string { + return ClassAffiliateInfo +} + +func (*AffiliateInfo) GetType() string { + return TypeAffiliateInfo +} + +// Describes a found affiliate program +type FoundAffiliateProgram struct { + meta + // User identifier of the bot created the program + BotUserId int64 `json:"bot_user_id"` + // Information about the affiliate program + Parameters *AffiliateProgramInfo `json:"parameters"` +} + +func (entity *FoundAffiliateProgram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundAffiliateProgram + + return json.Marshal((*stub)(entity)) +} + +func (*FoundAffiliateProgram) GetClass() string { + return ClassFoundAffiliateProgram +} + +func (*FoundAffiliateProgram) GetType() string { + return TypeFoundAffiliateProgram +} + +// Represents a list of found affiliate programs +type FoundAffiliatePrograms struct { + meta + // The total number of found affiliate programs + TotalCount int32 `json:"total_count"` + // The list of affiliate programs + Programs []*FoundAffiliateProgram `json:"programs"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *FoundAffiliatePrograms) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundAffiliatePrograms + + return json.Marshal((*stub)(entity)) +} + +func (*FoundAffiliatePrograms) GetClass() string { + return ClassFoundAffiliatePrograms +} + +func (*FoundAffiliatePrograms) GetType() string { + return TypeFoundAffiliatePrograms +} + +// Describes an affiliate program that was connected to a chat +type ChatAffiliateProgram struct { + meta + // The link that can be used to refer users if the program is still active + Url string `json:"url"` + // User identifier of the bot created the program + BotUserId int64 `json:"bot_user_id"` + // The parameters of the affiliate program + Parameters *AffiliateProgramParameters `json:"parameters"` + // Point in time (Unix timestamp) when the affiliate program was connected + ConnectionDate int32 `json:"connection_date"` + // True, if the program was canceled by the bot, or disconnected by the chat owner and isn't available anymore + IsDisconnected bool `json:"is_disconnected"` + // The number of users that used the affiliate program + UserCount JsonInt64 `json:"user_count"` + // The number of Telegram Stars that were earned by the affiliate program + RevenueStarCount JsonInt64 `json:"revenue_star_count"` +} + +func (entity *ChatAffiliateProgram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatAffiliateProgram + + return json.Marshal((*stub)(entity)) +} + +func (*ChatAffiliateProgram) GetClass() string { + return ClassChatAffiliateProgram +} + +func (*ChatAffiliateProgram) GetType() string { + return TypeChatAffiliateProgram +} + +// Represents a list of affiliate programs that were connected to a chat +type ChatAffiliatePrograms struct { + meta + // The total number of affiliate programs that were connected to the chat + TotalCount int32 `json:"total_count"` + // The list of connected affiliate programs + Programs []*ChatAffiliateProgram `json:"programs"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *ChatAffiliatePrograms) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatAffiliatePrograms + + return json.Marshal((*stub)(entity)) +} + +func (*ChatAffiliatePrograms) GetClass() string { + return ClassChatAffiliatePrograms +} + +func (*ChatAffiliatePrograms) GetType() string { + return TypeChatAffiliatePrograms +} + // Contains information about a product that can be paid with invoice type ProductInfo struct { meta @@ -8034,427 +8343,192 @@ func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { return TypeStarTransactionDirectionOutgoing } -// Paid media were bought -type BotTransactionPurposePaidMedia struct { +// The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only +type StarTransactionTypePremiumBotDeposit struct{ meta - // The bought media if the transaction wasn't refunded - Media []PaidMedia `json:"media"` - // Bot-provided payload; for bots only - Payload string `json:"payload"` } -func (entity *BotTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypePremiumBotDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BotTransactionPurposePaidMedia + type stub StarTransactionTypePremiumBotDeposit return json.Marshal((*stub)(entity)) } -func (*BotTransactionPurposePaidMedia) GetClass() string { - return ClassBotTransactionPurpose +func (*StarTransactionTypePremiumBotDeposit) GetClass() string { + return ClassStarTransactionType } -func (*BotTransactionPurposePaidMedia) GetType() string { - return TypeBotTransactionPurposePaidMedia +func (*StarTransactionTypePremiumBotDeposit) GetType() string { + return TypeStarTransactionTypePremiumBotDeposit } -func (*BotTransactionPurposePaidMedia) BotTransactionPurposeType() string { - return TypeBotTransactionPurposePaidMedia +func (*StarTransactionTypePremiumBotDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypePremiumBotDeposit } -func (botTransactionPurposePaidMedia *BotTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { - var tmp struct { - Media []json.RawMessage `json:"media"` - Payload string `json:"payload"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - botTransactionPurposePaidMedia.Payload = tmp.Payload - - fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - botTransactionPurposePaidMedia.Media = fieldMedia - - return nil -} - -// User bought a product from the bot -type BotTransactionPurposeInvoicePayment struct { +// The transaction is a deposit of Telegram Stars from App Store; for regular users only +type StarTransactionTypeAppStoreDeposit struct{ meta - // Information about the bought product; may be null if not applicable - ProductInfo *ProductInfo `json:"product_info"` - // Invoice payload; for bots only - InvoicePayload []byte `json:"invoice_payload"` } -func (entity *BotTransactionPurposeInvoicePayment) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeAppStoreDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BotTransactionPurposeInvoicePayment + type stub StarTransactionTypeAppStoreDeposit return json.Marshal((*stub)(entity)) } -func (*BotTransactionPurposeInvoicePayment) GetClass() string { - return ClassBotTransactionPurpose +func (*StarTransactionTypeAppStoreDeposit) GetClass() string { + return ClassStarTransactionType } -func (*BotTransactionPurposeInvoicePayment) GetType() string { - return TypeBotTransactionPurposeInvoicePayment +func (*StarTransactionTypeAppStoreDeposit) GetType() string { + return TypeStarTransactionTypeAppStoreDeposit } -func (*BotTransactionPurposeInvoicePayment) BotTransactionPurposeType() string { - return TypeBotTransactionPurposeInvoicePayment +func (*StarTransactionTypeAppStoreDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeAppStoreDeposit } -// User bought a subscription in a bot or a business account -type BotTransactionPurposeSubscription struct { +// The transaction is a deposit of Telegram Stars from Google Play; for regular users only +type StarTransactionTypeGooglePlayDeposit struct{ meta - // The number of seconds between consecutive Telegram Star debiting - Period int32 `json:"period"` - // Information about the bought subscription; may be null if not applicable - ProductInfo *ProductInfo `json:"product_info"` - // Invoice payload; for bots only - InvoicePayload []byte `json:"invoice_payload"` } -func (entity *BotTransactionPurposeSubscription) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeGooglePlayDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub BotTransactionPurposeSubscription + type stub StarTransactionTypeGooglePlayDeposit return json.Marshal((*stub)(entity)) } -func (*BotTransactionPurposeSubscription) GetClass() string { - return ClassBotTransactionPurpose +func (*StarTransactionTypeGooglePlayDeposit) GetClass() string { + return ClassStarTransactionType } -func (*BotTransactionPurposeSubscription) GetType() string { - return TypeBotTransactionPurposeSubscription +func (*StarTransactionTypeGooglePlayDeposit) GetType() string { + return TypeStarTransactionTypeGooglePlayDeposit } -func (*BotTransactionPurposeSubscription) BotTransactionPurposeType() string { - return TypeBotTransactionPurposeSubscription +func (*StarTransactionTypeGooglePlayDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeGooglePlayDeposit } -// Paid media were bought -type ChatTransactionPurposePaidMedia struct { +// The transaction is a deposit of Telegram Stars from Fragment; for regular users and bots only +type StarTransactionTypeFragmentDeposit struct{ meta - // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message - MessageId int64 `json:"message_id"` - // The bought media if the transaction wasn't refunded - Media []PaidMedia `json:"media"` } -func (entity *ChatTransactionPurposePaidMedia) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeFragmentDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatTransactionPurposePaidMedia + type stub StarTransactionTypeFragmentDeposit return json.Marshal((*stub)(entity)) } -func (*ChatTransactionPurposePaidMedia) GetClass() string { - return ClassChatTransactionPurpose +func (*StarTransactionTypeFragmentDeposit) GetClass() string { + return ClassStarTransactionType } -func (*ChatTransactionPurposePaidMedia) GetType() string { - return TypeChatTransactionPurposePaidMedia +func (*StarTransactionTypeFragmentDeposit) GetType() string { + return TypeStarTransactionTypeFragmentDeposit } -func (*ChatTransactionPurposePaidMedia) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposePaidMedia +func (*StarTransactionTypeFragmentDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeFragmentDeposit } -func (chatTransactionPurposePaidMedia *ChatTransactionPurposePaidMedia) UnmarshalJSON(data []byte) error { - var tmp struct { - MessageId int64 `json:"message_id"` - Media []json.RawMessage `json:"media"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - chatTransactionPurposePaidMedia.MessageId = tmp.MessageId - - fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - chatTransactionPurposePaidMedia.Media = fieldMedia - - return nil -} - -// User joined the channel and subscribed to regular payments in Telegram Stars -type ChatTransactionPurposeJoin struct { +// The transaction is a deposit of Telegram Stars by another user; for regular users only +type StarTransactionTypeUserDeposit struct { meta - // The number of seconds between consecutive Telegram Star debiting - Period int32 `json:"period"` -} - -func (entity *ChatTransactionPurposeJoin) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTransactionPurposeJoin - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTransactionPurposeJoin) GetClass() string { - return ClassChatTransactionPurpose -} - -func (*ChatTransactionPurposeJoin) GetType() string { - return TypeChatTransactionPurposeJoin -} - -func (*ChatTransactionPurposeJoin) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposeJoin -} - -// User paid for a reaction -type ChatTransactionPurposeReaction struct { - meta - // Identifier of the reacted message; can be 0 or an identifier of a deleted message - MessageId int64 `json:"message_id"` -} - -func (entity *ChatTransactionPurposeReaction) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTransactionPurposeReaction - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTransactionPurposeReaction) GetClass() string { - return ClassChatTransactionPurpose -} - -func (*ChatTransactionPurposeReaction) GetType() string { - return TypeChatTransactionPurposeReaction -} - -func (*ChatTransactionPurposeReaction) ChatTransactionPurposeType() string { - return TypeChatTransactionPurposeReaction -} - -// User received Telegram Stars from a giveaway -type ChatTransactionPurposeGiveaway struct { - meta - // Identifier of the message with giveaway; can be 0 or an identifier of a deleted message - GiveawayMessageId int64 `json:"giveaway_message_id"` -} - -func (entity *ChatTransactionPurposeGiveaway) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTransactionPurposeGiveaway - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTransactionPurposeGiveaway) GetClass() string { - return ClassChatTransactionPurpose -} - -func (*ChatTransactionPurposeGiveaway) GetType() string { - return TypeChatTransactionPurposeGiveaway -} - -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 + // Identifier of the user that gifted Telegram Stars; 0 if the user was anonymous + UserId int64 `json:"user_id"` + // The sticker to be shown in the transaction information; may be null if unknown Sticker *Sticker `json:"sticker"` } -func (entity *UserTransactionPurposeGiftedStars) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeUserDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UserTransactionPurposeGiftedStars + type stub StarTransactionTypeUserDeposit return json.Marshal((*stub)(entity)) } -func (*UserTransactionPurposeGiftedStars) GetClass() string { - return ClassUserTransactionPurpose +func (*StarTransactionTypeUserDeposit) GetClass() string { + return ClassStarTransactionType } -func (*UserTransactionPurposeGiftedStars) GetType() string { - return TypeUserTransactionPurposeGiftedStars +func (*StarTransactionTypeUserDeposit) GetType() string { + return TypeStarTransactionTypeUserDeposit } -func (*UserTransactionPurposeGiftedStars) UserTransactionPurposeType() string { - return TypeUserTransactionPurposeGiftedStars +func (*StarTransactionTypeUserDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeUserDeposit } -// The user sold a gift received from another user or bot -type UserTransactionPurposeGiftSell struct { +// The transaction is a deposit of Telegram Stars from a giveaway; for regular users only +type StarTransactionTypeGiveawayDeposit struct { meta - // The gift - Gift *Gift `json:"gift"` + // Identifier of a supergroup or a channel chat that created the giveaway + ChatId int64 `json:"chat_id"` + // Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message + GiveawayMessageId int64 `json:"giveaway_message_id"` } -func (entity *UserTransactionPurposeGiftSell) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeGiveawayDeposit) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UserTransactionPurposeGiftSell + type stub StarTransactionTypeGiveawayDeposit return json.Marshal((*stub)(entity)) } -func (*UserTransactionPurposeGiftSell) GetClass() string { - return ClassUserTransactionPurpose +func (*StarTransactionTypeGiveawayDeposit) GetClass() string { + return ClassStarTransactionType } -func (*UserTransactionPurposeGiftSell) GetType() string { - return TypeUserTransactionPurposeGiftSell +func (*StarTransactionTypeGiveawayDeposit) GetType() string { + return TypeStarTransactionTypeGiveawayDeposit } -func (*UserTransactionPurposeGiftSell) UserTransactionPurposeType() string { - return TypeUserTransactionPurposeGiftSell +func (*StarTransactionTypeGiveawayDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiveawayDeposit } -// The user or the bot sent a gift to a user -type UserTransactionPurposeGiftSend struct { +// The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only +type StarTransactionTypeFragmentWithdrawal 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 -} - -func (entity *StarTransactionPartnerTelegram) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerTelegram - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerTelegram) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerTelegram) GetType() string { - return TypeStarTransactionPartnerTelegram -} - -func (*StarTransactionPartnerTelegram) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerTelegram -} - -// The transaction is a transaction with App Store -type StarTransactionPartnerAppStore struct{ - meta -} - -func (entity *StarTransactionPartnerAppStore) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerAppStore - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerAppStore) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerAppStore) GetType() string { - return TypeStarTransactionPartnerAppStore -} - -func (*StarTransactionPartnerAppStore) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerAppStore -} - -// The transaction is a transaction with Google Play -type StarTransactionPartnerGooglePlay struct{ - meta -} - -func (entity *StarTransactionPartnerGooglePlay) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerGooglePlay - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerGooglePlay) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerGooglePlay) GetType() string { - return TypeStarTransactionPartnerGooglePlay -} - -func (*StarTransactionPartnerGooglePlay) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerGooglePlay -} - -// The transaction is a transaction with Fragment -type StarTransactionPartnerFragment struct { - meta - // State of the withdrawal; may be null for refunds from Fragment or for Telegram Stars bought on Fragment + // State of the withdrawal; may be null for refunds from Fragment WithdrawalState RevenueWithdrawalState `json:"withdrawal_state"` } -func (entity *StarTransactionPartnerFragment) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeFragmentWithdrawal) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerFragment + type stub StarTransactionTypeFragmentWithdrawal return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerFragment) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeFragmentWithdrawal) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerFragment) GetType() string { - return TypeStarTransactionPartnerFragment +func (*StarTransactionTypeFragmentWithdrawal) GetType() string { + return TypeStarTransactionTypeFragmentWithdrawal } -func (*StarTransactionPartnerFragment) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerFragment +func (*StarTransactionTypeFragmentWithdrawal) StarTransactionTypeType() string { + return TypeStarTransactionTypeFragmentWithdrawal } -func (starTransactionPartnerFragment *StarTransactionPartnerFragment) UnmarshalJSON(data []byte) error { +func (starTransactionTypeFragmentWithdrawal *StarTransactionTypeFragmentWithdrawal) UnmarshalJSON(data []byte) error { var tmp struct { WithdrawalState json.RawMessage `json:"withdrawal_state"` } @@ -8465,141 +8539,93 @@ func (starTransactionPartnerFragment *StarTransactionPartnerFragment) UnmarshalJ } fieldWithdrawalState, _ := UnmarshalRevenueWithdrawalState(tmp.WithdrawalState) - starTransactionPartnerFragment.WithdrawalState = fieldWithdrawalState + starTransactionTypeFragmentWithdrawal.WithdrawalState = fieldWithdrawalState return nil } -// The transaction is a transaction with Telegram Ad platform -type StarTransactionPartnerTelegramAds struct{ +// The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only +type StarTransactionTypeTelegramAdsWithdrawal struct{ meta } -func (entity *StarTransactionPartnerTelegramAds) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeTelegramAdsWithdrawal) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerTelegramAds + type stub StarTransactionTypeTelegramAdsWithdrawal return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerTelegramAds) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeTelegramAdsWithdrawal) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerTelegramAds) GetType() string { - return TypeStarTransactionPartnerTelegramAds +func (*StarTransactionTypeTelegramAdsWithdrawal) GetType() string { + return TypeStarTransactionTypeTelegramAdsWithdrawal } -func (*StarTransactionPartnerTelegramAds) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerTelegramAds +func (*StarTransactionTypeTelegramAdsWithdrawal) StarTransactionTypeType() string { + return TypeStarTransactionTypeTelegramAdsWithdrawal } -// The transaction is a transaction with Telegram for API usage -type StarTransactionPartnerTelegramApi struct { +// The transaction is a payment for Telegram API usage; for bots only +type StarTransactionTypeTelegramApiUsage struct { meta // The number of billed requests RequestCount int32 `json:"request_count"` } -func (entity *StarTransactionPartnerTelegramApi) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeTelegramApiUsage) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerTelegramApi + type stub StarTransactionTypeTelegramApiUsage return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerTelegramApi) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeTelegramApiUsage) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerTelegramApi) GetType() string { - return TypeStarTransactionPartnerTelegramApi +func (*StarTransactionTypeTelegramApiUsage) GetType() string { + return TypeStarTransactionTypeTelegramApiUsage } -func (*StarTransactionPartnerTelegramApi) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerTelegramApi +func (*StarTransactionTypeTelegramApiUsage) StarTransactionTypeType() string { + return TypeStarTransactionTypeTelegramApiUsage } -// The transaction is a transaction with a bot -type StarTransactionPartnerBot struct { +// The transaction is a purchase of paid media from a bot or a business account by the current user; for regular users only +type StarTransactionTypeBotPaidMediaPurchase struct { meta - // Identifier of the bot - UserId int64 `json:"user_id"` - // Purpose of the transaction - Purpose BotTransactionPurpose `json:"purpose"` -} - -func (entity *StarTransactionPartnerBot) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerBot - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerBot) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerBot) GetType() string { - return TypeStarTransactionPartnerBot -} - -func (*StarTransactionPartnerBot) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerBot -} - -func (starTransactionPartnerBot *StarTransactionPartnerBot) 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 - } - - starTransactionPartnerBot.UserId = tmp.UserId - - fieldPurpose, _ := UnmarshalBotTransactionPurpose(tmp.Purpose) - starTransactionPartnerBot.Purpose = fieldPurpose - - return nil -} - -// The transaction is a transaction with a business account -type StarTransactionPartnerBusiness struct { - meta - // Identifier of the business account user + // Identifier of the bot or the business account user that sent the paid media UserId int64 `json:"user_id"` // The bought media if the transaction wasn't refunded Media []PaidMedia `json:"media"` } -func (entity *StarTransactionPartnerBusiness) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeBotPaidMediaPurchase) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerBusiness + type stub StarTransactionTypeBotPaidMediaPurchase return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerBusiness) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeBotPaidMediaPurchase) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerBusiness) GetType() string { - return TypeStarTransactionPartnerBusiness +func (*StarTransactionTypeBotPaidMediaPurchase) GetType() string { + return TypeStarTransactionTypeBotPaidMediaPurchase } -func (*StarTransactionPartnerBusiness) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerBusiness +func (*StarTransactionTypeBotPaidMediaPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotPaidMediaPurchase } -func (starTransactionPartnerBusiness *StarTransactionPartnerBusiness) UnmarshalJSON(data []byte) error { +func (starTransactionTypeBotPaidMediaPurchase *StarTransactionTypeBotPaidMediaPurchase) UnmarshalJSON(data []byte) error { var tmp struct { UserId int64 `json:"user_id"` Media []json.RawMessage `json:"media"` @@ -8610,95 +8636,53 @@ func (starTransactionPartnerBusiness *StarTransactionPartnerBusiness) UnmarshalJ return err } - starTransactionPartnerBusiness.UserId = tmp.UserId + starTransactionTypeBotPaidMediaPurchase.UserId = tmp.UserId fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) - starTransactionPartnerBusiness.Media = fieldMedia + starTransactionTypeBotPaidMediaPurchase.Media = fieldMedia return nil } -// The transaction is a transaction with a supergroup or a channel chat -type StarTransactionPartnerChat struct { +// The transaction is a sale of paid media by the bot or a business account managed by the bot; for bots only +type StarTransactionTypeBotPaidMediaSale struct { meta - // Identifier of the chat - ChatId int64 `json:"chat_id"` - // Purpose of the transaction - Purpose ChatTransactionPurpose `json:"purpose"` -} - -func (entity *StarTransactionPartnerChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StarTransactionPartnerChat - - return json.Marshal((*stub)(entity)) -} - -func (*StarTransactionPartnerChat) GetClass() string { - return ClassStarTransactionPartner -} - -func (*StarTransactionPartnerChat) GetType() string { - return TypeStarTransactionPartnerChat -} - -func (*StarTransactionPartnerChat) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerChat -} - -func (starTransactionPartnerChat *StarTransactionPartnerChat) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatId int64 `json:"chat_id"` - Purpose json.RawMessage `json:"purpose"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - starTransactionPartnerChat.ChatId = tmp.ChatId - - fieldPurpose, _ := UnmarshalChatTransactionPurpose(tmp.Purpose) - starTransactionPartnerChat.Purpose = fieldPurpose - - return nil -} - -// The transaction is a transaction with another user -type StarTransactionPartnerUser struct { - meta - // Identifier of the user; 0 if the user was anonymous + // Identifier of the user that bought the media UserId int64 `json:"user_id"` - // Purpose of the transaction - Purpose UserTransactionPurpose `json:"purpose"` + // The bought media + Media []PaidMedia `json:"media"` + // Bot-provided payload + Payload string `json:"payload"` + // Information about the affiliate which received commission from the transaction; may be null if none + Affiliate *AffiliateInfo `json:"affiliate"` } -func (entity *StarTransactionPartnerUser) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeBotPaidMediaSale) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerUser + type stub StarTransactionTypeBotPaidMediaSale return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerUser) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeBotPaidMediaSale) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerUser) GetType() string { - return TypeStarTransactionPartnerUser +func (*StarTransactionTypeBotPaidMediaSale) GetType() string { + return TypeStarTransactionTypeBotPaidMediaSale } -func (*StarTransactionPartnerUser) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerUser +func (*StarTransactionTypeBotPaidMediaSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotPaidMediaSale } -func (starTransactionPartnerUser *StarTransactionPartnerUser) UnmarshalJSON(data []byte) error { +func (starTransactionTypeBotPaidMediaSale *StarTransactionTypeBotPaidMediaSale) UnmarshalJSON(data []byte) error { var tmp struct { UserId int64 `json:"user_id"` - Purpose json.RawMessage `json:"purpose"` + Media []json.RawMessage `json:"media"` + Payload string `json:"payload"` + Affiliate *AffiliateInfo `json:"affiliate"` } err := json.Unmarshal(data, &tmp) @@ -8706,37 +8690,474 @@ func (starTransactionPartnerUser *StarTransactionPartnerUser) UnmarshalJSON(data return err } - starTransactionPartnerUser.UserId = tmp.UserId + starTransactionTypeBotPaidMediaSale.UserId = tmp.UserId + starTransactionTypeBotPaidMediaSale.Payload = tmp.Payload + starTransactionTypeBotPaidMediaSale.Affiliate = tmp.Affiliate - fieldPurpose, _ := UnmarshalUserTransactionPurpose(tmp.Purpose) - starTransactionPartnerUser.Purpose = fieldPurpose + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeBotPaidMediaSale.Media = fieldMedia return nil } -// The transaction is a transaction with unknown partner -type StarTransactionPartnerUnsupported struct{ +// The transaction is a purchase of paid media from a channel by the current user; for regular users only +type StarTransactionTypeChannelPaidMediaPurchase struct { meta + // Identifier of the channel chat that sent the paid media + ChatId int64 `json:"chat_id"` + // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` + // The bought media if the transaction wasn't refunded + Media []PaidMedia `json:"media"` } -func (entity *StarTransactionPartnerUnsupported) MarshalJSON() ([]byte, error) { +func (entity *StarTransactionTypeChannelPaidMediaPurchase) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionPartnerUnsupported + type stub StarTransactionTypeChannelPaidMediaPurchase return json.Marshal((*stub)(entity)) } -func (*StarTransactionPartnerUnsupported) GetClass() string { - return ClassStarTransactionPartner +func (*StarTransactionTypeChannelPaidMediaPurchase) GetClass() string { + return ClassStarTransactionType } -func (*StarTransactionPartnerUnsupported) GetType() string { - return TypeStarTransactionPartnerUnsupported +func (*StarTransactionTypeChannelPaidMediaPurchase) GetType() string { + return TypeStarTransactionTypeChannelPaidMediaPurchase } -func (*StarTransactionPartnerUnsupported) StarTransactionPartnerType() string { - return TypeStarTransactionPartnerUnsupported +func (*StarTransactionTypeChannelPaidMediaPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidMediaPurchase +} + +func (starTransactionTypeChannelPaidMediaPurchase *StarTransactionTypeChannelPaidMediaPurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageId int64 `json:"message_id"` + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeChannelPaidMediaPurchase.ChatId = tmp.ChatId + starTransactionTypeChannelPaidMediaPurchase.MessageId = tmp.MessageId + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeChannelPaidMediaPurchase.Media = fieldMedia + + return nil +} + +// The transaction is a sale of paid media by the channel chat; for channel chats only +type StarTransactionTypeChannelPaidMediaSale struct { + meta + // Identifier of the user that bought the media + UserId int64 `json:"user_id"` + // Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` + // The bought media + Media []PaidMedia `json:"media"` +} + +func (entity *StarTransactionTypeChannelPaidMediaSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelPaidMediaSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelPaidMediaSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelPaidMediaSale) GetType() string { + return TypeStarTransactionTypeChannelPaidMediaSale +} + +func (*StarTransactionTypeChannelPaidMediaSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidMediaSale +} + +func (starTransactionTypeChannelPaidMediaSale *StarTransactionTypeChannelPaidMediaSale) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + MessageId int64 `json:"message_id"` + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeChannelPaidMediaSale.UserId = tmp.UserId + starTransactionTypeChannelPaidMediaSale.MessageId = tmp.MessageId + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeChannelPaidMediaSale.Media = fieldMedia + + return nil +} + +// The transaction is a purchase of a product from a bot or a business account by the current user; for regular users only +type StarTransactionTypeBotInvoicePurchase struct { + meta + // Identifier of the bot or the business account user that created the invoice + UserId int64 `json:"user_id"` + // Information about the bought product + ProductInfo *ProductInfo `json:"product_info"` +} + +func (entity *StarTransactionTypeBotInvoicePurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotInvoicePurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotInvoicePurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotInvoicePurchase) GetType() string { + return TypeStarTransactionTypeBotInvoicePurchase +} + +func (*StarTransactionTypeBotInvoicePurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotInvoicePurchase +} + +// The transaction is a sale of a product by the bot; for bots only +type StarTransactionTypeBotInvoiceSale struct { + meta + // Identifier of the user that bought the product + UserId int64 `json:"user_id"` + // Information about the bought product + ProductInfo *ProductInfo `json:"product_info"` + // Invoice payload + InvoicePayload []byte `json:"invoice_payload"` + // Information about the affiliate which received commission from the transaction; may be null if none + Affiliate *AffiliateInfo `json:"affiliate"` +} + +func (entity *StarTransactionTypeBotInvoiceSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotInvoiceSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotInvoiceSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotInvoiceSale) GetType() string { + return TypeStarTransactionTypeBotInvoiceSale +} + +func (*StarTransactionTypeBotInvoiceSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotInvoiceSale +} + +// The transaction is a purchase of a subscription from a bot or a business account by the current user; for regular users only +type StarTransactionTypeBotSubscriptionPurchase struct { + meta + // Identifier of the bot or the business account user that created the subscription link + UserId int64 `json:"user_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` + // Information about the bought subscription + ProductInfo *ProductInfo `json:"product_info"` +} + +func (entity *StarTransactionTypeBotSubscriptionPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotSubscriptionPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotSubscriptionPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotSubscriptionPurchase) GetType() string { + return TypeStarTransactionTypeBotSubscriptionPurchase +} + +func (*StarTransactionTypeBotSubscriptionPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotSubscriptionPurchase +} + +// The transaction is a sale of a subscription by the bot; for bots only +type StarTransactionTypeBotSubscriptionSale struct { + meta + // Identifier of the user that bought the subscription + UserId int64 `json:"user_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` + // Information about the bought subscription + ProductInfo *ProductInfo `json:"product_info"` + // Invoice payload + InvoicePayload []byte `json:"invoice_payload"` + // Information about the affiliate which received commission from the transaction; may be null if none + Affiliate *AffiliateInfo `json:"affiliate"` +} + +func (entity *StarTransactionTypeBotSubscriptionSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotSubscriptionSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotSubscriptionSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotSubscriptionSale) GetType() string { + return TypeStarTransactionTypeBotSubscriptionSale +} + +func (*StarTransactionTypeBotSubscriptionSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotSubscriptionSale +} + +// The transaction is a purchase of a subscription to a channel chat by the current user; for regular users only +type StarTransactionTypeChannelSubscriptionPurchase struct { + meta + // Identifier of the channel chat that created the subscription + ChatId int64 `json:"chat_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` +} + +func (entity *StarTransactionTypeChannelSubscriptionPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelSubscriptionPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelSubscriptionPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelSubscriptionPurchase) GetType() string { + return TypeStarTransactionTypeChannelSubscriptionPurchase +} + +func (*StarTransactionTypeChannelSubscriptionPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelSubscriptionPurchase +} + +// The transaction is a sale of a subscription by the channel chat; for channel chats only +type StarTransactionTypeChannelSubscriptionSale struct { + meta + // Identifier of the user that bought the subscription + UserId int64 `json:"user_id"` + // The number of seconds between consecutive Telegram Star debitings + SubscriptionPeriod int32 `json:"subscription_period"` +} + +func (entity *StarTransactionTypeChannelSubscriptionSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelSubscriptionSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelSubscriptionSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelSubscriptionSale) GetType() string { + return TypeStarTransactionTypeChannelSubscriptionSale +} + +func (*StarTransactionTypeChannelSubscriptionSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelSubscriptionSale +} + +// The transaction is a purchase of a gift to another user; for regular users and bots only +type StarTransactionTypeGiftPurchase struct { + meta + // Identifier of the user that received the gift + UserId int64 `json:"user_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftPurchase) GetType() string { + return TypeStarTransactionTypeGiftPurchase +} + +func (*StarTransactionTypeGiftPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftPurchase +} + +// The transaction is a sale of a gift received from another user or bot; for regular users only +type StarTransactionTypeGiftSale struct { + meta + // Identifier of the user that sent the gift + UserId int64 `json:"user_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftSale) GetType() string { + return TypeStarTransactionTypeGiftSale +} + +func (*StarTransactionTypeGiftSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftSale +} + +// The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only +type StarTransactionTypeChannelPaidReactionSend struct { + meta + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Identifier of the reacted message; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` +} + +func (entity *StarTransactionTypeChannelPaidReactionSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelPaidReactionSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelPaidReactionSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelPaidReactionSend) GetType() string { + return TypeStarTransactionTypeChannelPaidReactionSend +} + +func (*StarTransactionTypeChannelPaidReactionSend) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidReactionSend +} + +// The transaction is a receiving of a paid reaction to a message by the channel chat; for channel chats only +type StarTransactionTypeChannelPaidReactionReceive struct { + meta + // Identifier of the user that added the paid reaction + UserId int64 `json:"user_id"` + // Identifier of the reacted message; can be 0 or an identifier of a deleted message + MessageId int64 `json:"message_id"` +} + +func (entity *StarTransactionTypeChannelPaidReactionReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelPaidReactionReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelPaidReactionReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelPaidReactionReceive) GetType() string { + return TypeStarTransactionTypeChannelPaidReactionReceive +} + +func (*StarTransactionTypeChannelPaidReactionReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypeChannelPaidReactionReceive +} + +// The transaction is a receiving of a commission from an affiliate program; for regular users, bots and channel chats only +type StarTransactionTypeAffiliateProgramCommission struct { + meta + // Identifier of the chat that created the affiliate program + ChatId int64 `json:"chat_id"` + // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner + CommissionPerMille int32 `json:"commission_per_mille"` +} + +func (entity *StarTransactionTypeAffiliateProgramCommission) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeAffiliateProgramCommission + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeAffiliateProgramCommission) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeAffiliateProgramCommission) GetType() string { + return TypeStarTransactionTypeAffiliateProgramCommission +} + +func (*StarTransactionTypeAffiliateProgramCommission) StarTransactionTypeType() string { + return TypeStarTransactionTypeAffiliateProgramCommission +} + +// The transaction is a transaction of an unsupported type +type StarTransactionTypeUnsupported struct{ + meta +} + +func (entity *StarTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUnsupported) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUnsupported) GetType() string { + return TypeStarTransactionTypeUnsupported +} + +func (*StarTransactionTypeUnsupported) StarTransactionTypeType() string { + return TypeStarTransactionTypeUnsupported } // Represents a transaction changing the amount of owned Telegram Stars @@ -8745,13 +9166,13 @@ type StarTransaction struct { // Unique identifier of the transaction Id string `json:"id"` // The amount of added owned Telegram Stars; negative for outgoing transactions - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` // True, if the transaction is a refund of a previous transaction IsRefund bool `json:"is_refund"` // Point in time (Unix timestamp) when the transaction was completed Date int32 `json:"date"` - // Source of the incoming transaction, or its recipient for outgoing transactions - Partner StarTransactionPartner `json:"partner"` + // Type of the transaction + Type StarTransactionType `json:"type"` } func (entity *StarTransaction) MarshalJSON() ([]byte, error) { @@ -8773,10 +9194,10 @@ func (*StarTransaction) GetType() string { func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { var tmp struct { Id string `json:"id"` - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` IsRefund bool `json:"is_refund"` Date int32 `json:"date"` - Partner json.RawMessage `json:"partner"` + Type json.RawMessage `json:"type"` } err := json.Unmarshal(data, &tmp) @@ -8785,12 +9206,12 @@ func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { } starTransaction.Id = tmp.Id - starTransaction.StarCount = tmp.StarCount + starTransaction.StarAmount = tmp.StarAmount starTransaction.IsRefund = tmp.IsRefund starTransaction.Date = tmp.Date - fieldPartner, _ := UnmarshalStarTransactionPartner(tmp.Partner) - starTransaction.Partner = fieldPartner + fieldType, _ := UnmarshalStarTransactionType(tmp.Type) + starTransaction.Type = fieldType return nil } @@ -8799,7 +9220,7 @@ func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { type StarTransactions struct { meta // The amount of owned Telegram Stars - StarCount int64 `json:"star_count"` + StarAmount *StarAmount `json:"star_amount"` // List of transactions with Telegram Stars Transactions []*StarTransaction `json:"transactions"` // The offset for the next request. If empty, then there are no more results @@ -9283,15 +9704,15 @@ type User struct { Status UserStatus `json:"status"` // Profile photo of the user; may be null ProfilePhoto *ProfilePhoto `json:"profile_photo"` - // Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only + // Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview AccentColorId int32 `json:"accent_color_id"` - // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. For Telegram Premium users only + // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` - // Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only + // Identifier of the accent color for the user's profile; -1 if none ProfileAccentColorId int32 `json:"profile_accent_color_id"` - // Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none. For Telegram Premium users only + // Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` - // Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only + // Emoji status to be shown instead of the default Telegram Premium badge; may be null EmojiStatus *EmojiStatus `json:"emoji_status"` // The user is a contact of the current user IsContact bool `json:"is_contact"` @@ -9439,6 +9860,8 @@ type BotInfo struct { DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` // Default administrator rights for adding the bot to channels; may be null DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + // Information about the affiliate program of the bot; may be null if none + AffiliateProgram *AffiliateProgramInfo `json:"affiliate_program"` // Default light background color for bot Web Apps; -1 if not specified WebAppBackgroundLightColor int32 `json:"web_app_background_light_color"` // Default dark background color for bot Web Apps; -1 if not specified @@ -9490,6 +9913,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { PrivacyPolicyUrl string `json:"privacy_policy_url"` DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` + AffiliateProgram *AffiliateProgramInfo `json:"affiliate_program"` WebAppBackgroundLightColor int32 `json:"web_app_background_light_color"` WebAppBackgroundDarkColor int32 `json:"web_app_background_dark_color"` WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` @@ -9517,6 +9941,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.PrivacyPolicyUrl = tmp.PrivacyPolicyUrl botInfo.DefaultGroupAdministratorRights = tmp.DefaultGroupAdministratorRights botInfo.DefaultChannelAdministratorRights = tmp.DefaultChannelAdministratorRights + botInfo.AffiliateProgram = tmp.AffiliateProgram botInfo.WebAppBackgroundLightColor = tmp.WebAppBackgroundLightColor botInfo.WebAppBackgroundDarkColor = tmp.WebAppBackgroundDarkColor botInfo.WebAppHeaderLightColor = tmp.WebAppHeaderLightColor @@ -34198,7 +34623,7 @@ func (*TargetChatTypes) GetType() string { return TypeTargetChatTypes } -// The currently opened chat needs to be kept +// The currently opened chat and forum topic must be kept type TargetChatCurrent struct{ meta } @@ -45817,6 +46242,35 @@ func (*InternalLinkTypeChangePhoneNumber) InternalLinkTypeType() string { return TypeInternalLinkTypeChangePhoneNumber } +// The link is an affiliate program link. Call searchChatAffiliateProgram with the given username and referrer to process the link +type InternalLinkTypeChatAffiliateProgram struct { + meta + // Username to be passed to searchChatAffiliateProgram + Username string `json:"username"` + // Referrer to be passed to searchChatAffiliateProgram + Referrer string `json:"referrer"` +} + +func (entity *InternalLinkTypeChatAffiliateProgram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeChatAffiliateProgram + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeChatAffiliateProgram) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeChatAffiliateProgram) GetType() string { + return TypeInternalLinkTypeChatAffiliateProgram +} + +func (*InternalLinkTypeChatAffiliateProgram) InternalLinkTypeType() string { + return TypeInternalLinkTypeChatAffiliateProgram +} + // The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. If the chat is found, then call getChatBoostStatus and getAvailableChatBoostSlots to get the current boost status and check whether the chat can be boosted. If the user wants to boost the chat and the chat can be boosted, then call boostChat type InternalLinkTypeChatBoost struct { meta @@ -47309,6 +47763,106 @@ func (*FileTypeSecure) FileTypeType() string { return TypeFileTypeSecure } +// The file is a self-destructing photo in a private chat +type FileTypeSelfDestructingPhoto struct{ + meta +} + +func (entity *FileTypeSelfDestructingPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingPhoto) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingPhoto) GetType() string { + return TypeFileTypeSelfDestructingPhoto +} + +func (*FileTypeSelfDestructingPhoto) FileTypeType() string { + return TypeFileTypeSelfDestructingPhoto +} + +// The file is a self-destructing video in a private chat +type FileTypeSelfDestructingVideo struct{ + meta +} + +func (entity *FileTypeSelfDestructingVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingVideo + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingVideo) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingVideo) GetType() string { + return TypeFileTypeSelfDestructingVideo +} + +func (*FileTypeSelfDestructingVideo) FileTypeType() string { + return TypeFileTypeSelfDestructingVideo +} + +// The file is a self-destructing video note in a private chat +type FileTypeSelfDestructingVideoNote struct{ + meta +} + +func (entity *FileTypeSelfDestructingVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingVideoNote) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingVideoNote) GetType() string { + return TypeFileTypeSelfDestructingVideoNote +} + +func (*FileTypeSelfDestructingVideoNote) FileTypeType() string { + return TypeFileTypeSelfDestructingVideoNote +} + +// The file is a self-destructing voice note in a private chat +type FileTypeSelfDestructingVoiceNote struct{ + meta +} + +func (entity *FileTypeSelfDestructingVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSelfDestructingVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSelfDestructingVoiceNote) GetClass() string { + return ClassFileType +} + +func (*FileTypeSelfDestructingVoiceNote) GetType() string { + return TypeFileTypeSelfDestructingVoiceNote +} + +func (*FileTypeSelfDestructingVoiceNote) FileTypeType() string { + return TypeFileTypeSelfDestructingVoiceNote +} + // The file is a sticker type FileTypeSticker struct{ meta @@ -50505,12 +51059,12 @@ func (*ChatRevenueTransactions) GetType() string { // Contains information about Telegram Stars earned by a bot or a chat type StarRevenueStatus struct { meta - // Total number of Telegram Stars earned - TotalCount int64 `json:"total_count"` - // The number of Telegram Stars that aren't withdrawn yet - CurrentCount int64 `json:"current_count"` - // The number of Telegram Stars that are available for withdrawal - AvailableCount int64 `json:"available_count"` + // Total amount of Telegram Stars earned + TotalAmount *StarAmount `json:"total_amount"` + // The amount of Telegram Stars that aren't withdrawn yet + CurrentAmount *StarAmount `json:"current_amount"` + // The amount of Telegram Stars that are available for withdrawal + AvailableAmount *StarAmount `json:"available_amount"` // True, if Telegram Stars can be withdrawn now or later WithdrawalEnabled bool `json:"withdrawal_enabled"` // Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can be started now @@ -54482,7 +55036,7 @@ type UpdateAccentColors struct { meta // Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported and aren't included in the list. The exact colors for the accent colors with identifiers 0-6 must be taken from the app theme Colors []*AccentColor `json:"colors"` - // The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order + // The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specified order AvailableAccentColorIds []int32 `json:"available_accent_color_ids"` } @@ -54511,7 +55065,7 @@ type UpdateProfileAccentColors struct { meta // Information about supported colors Colors []*ProfileAccentColor `json:"colors"` - // The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specififed order + // The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specified order AvailableAccentColorIds []int32 `json:"available_accent_color_ids"` } @@ -54877,8 +55431,8 @@ func (*UpdateActiveLiveLocationMessages) UpdateType() string { // The number of Telegram Stars owned by the current user has changed type UpdateOwnedStarCount struct { meta - // The new number of Telegram Stars owned - StarCount int64 `json:"star_count"` + // The new amount of owned Telegram Stars + StarAmount *StarAmount `json:"star_amount"` } func (entity *UpdateOwnedStarCount) MarshalJSON() ([]byte, error) { diff --git a/client/unmarshaler.go b/client/unmarshaler.go index c30f7ad..ec11136 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -693,6 +693,43 @@ func UnmarshalListOfStarSubscriptionType(dataList []json.RawMessage) ([]StarSubs return list, nil } +func UnmarshalAffiliateProgramSortOrder(data json.RawMessage) (AffiliateProgramSortOrder, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeAffiliateProgramSortOrderProfitability: + return UnmarshalAffiliateProgramSortOrderProfitability(data) + + case TypeAffiliateProgramSortOrderCreationDate: + return UnmarshalAffiliateProgramSortOrderCreationDate(data) + + case TypeAffiliateProgramSortOrderRevenue: + return UnmarshalAffiliateProgramSortOrderRevenue(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]AffiliateProgramSortOrder, error) { + list := []AffiliateProgramSortOrder{} + + for _, data := range dataList { + entity, err := UnmarshalAffiliateProgramSortOrder(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { var meta meta @@ -727,7 +764,7 @@ func UnmarshalListOfStarTransactionDirection(dataList []json.RawMessage) ([]Star return list, nil } -func UnmarshalBotTransactionPurpose(data json.RawMessage) (BotTransactionPurpose, error) { +func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -736,163 +773,91 @@ func UnmarshalBotTransactionPurpose(data json.RawMessage) (BotTransactionPurpose } switch meta.Type { - case TypeBotTransactionPurposePaidMedia: - return UnmarshalBotTransactionPurposePaidMedia(data) + case TypeStarTransactionTypePremiumBotDeposit: + return UnmarshalStarTransactionTypePremiumBotDeposit(data) - case TypeBotTransactionPurposeInvoicePayment: - return UnmarshalBotTransactionPurposeInvoicePayment(data) + case TypeStarTransactionTypeAppStoreDeposit: + return UnmarshalStarTransactionTypeAppStoreDeposit(data) - case TypeBotTransactionPurposeSubscription: - return UnmarshalBotTransactionPurposeSubscription(data) + case TypeStarTransactionTypeGooglePlayDeposit: + return UnmarshalStarTransactionTypeGooglePlayDeposit(data) + + case TypeStarTransactionTypeFragmentDeposit: + return UnmarshalStarTransactionTypeFragmentDeposit(data) + + case TypeStarTransactionTypeUserDeposit: + return UnmarshalStarTransactionTypeUserDeposit(data) + + case TypeStarTransactionTypeGiveawayDeposit: + return UnmarshalStarTransactionTypeGiveawayDeposit(data) + + case TypeStarTransactionTypeFragmentWithdrawal: + return UnmarshalStarTransactionTypeFragmentWithdrawal(data) + + case TypeStarTransactionTypeTelegramAdsWithdrawal: + return UnmarshalStarTransactionTypeTelegramAdsWithdrawal(data) + + case TypeStarTransactionTypeTelegramApiUsage: + return UnmarshalStarTransactionTypeTelegramApiUsage(data) + + case TypeStarTransactionTypeBotPaidMediaPurchase: + return UnmarshalStarTransactionTypeBotPaidMediaPurchase(data) + + case TypeStarTransactionTypeBotPaidMediaSale: + return UnmarshalStarTransactionTypeBotPaidMediaSale(data) + + case TypeStarTransactionTypeChannelPaidMediaPurchase: + return UnmarshalStarTransactionTypeChannelPaidMediaPurchase(data) + + case TypeStarTransactionTypeChannelPaidMediaSale: + return UnmarshalStarTransactionTypeChannelPaidMediaSale(data) + + case TypeStarTransactionTypeBotInvoicePurchase: + return UnmarshalStarTransactionTypeBotInvoicePurchase(data) + + case TypeStarTransactionTypeBotInvoiceSale: + return UnmarshalStarTransactionTypeBotInvoiceSale(data) + + case TypeStarTransactionTypeBotSubscriptionPurchase: + return UnmarshalStarTransactionTypeBotSubscriptionPurchase(data) + + case TypeStarTransactionTypeBotSubscriptionSale: + return UnmarshalStarTransactionTypeBotSubscriptionSale(data) + + case TypeStarTransactionTypeChannelSubscriptionPurchase: + return UnmarshalStarTransactionTypeChannelSubscriptionPurchase(data) + + case TypeStarTransactionTypeChannelSubscriptionSale: + return UnmarshalStarTransactionTypeChannelSubscriptionSale(data) + + case TypeStarTransactionTypeGiftPurchase: + return UnmarshalStarTransactionTypeGiftPurchase(data) + + case TypeStarTransactionTypeGiftSale: + return UnmarshalStarTransactionTypeGiftSale(data) + + case TypeStarTransactionTypeChannelPaidReactionSend: + return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) + + case TypeStarTransactionTypeChannelPaidReactionReceive: + return UnmarshalStarTransactionTypeChannelPaidReactionReceive(data) + + case TypeStarTransactionTypeAffiliateProgramCommission: + return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + + case TypeStarTransactionTypeUnsupported: + return UnmarshalStarTransactionTypeUnsupported(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfBotTransactionPurpose(dataList []json.RawMessage) ([]BotTransactionPurpose, error) { - list := []BotTransactionPurpose{} +func UnmarshalListOfStarTransactionType(dataList []json.RawMessage) ([]StarTransactionType, error) { + list := []StarTransactionType{} for _, data := range dataList { - entity, err := UnmarshalBotTransactionPurpose(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalChatTransactionPurpose(data json.RawMessage) (ChatTransactionPurpose, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeChatTransactionPurposePaidMedia: - return UnmarshalChatTransactionPurposePaidMedia(data) - - case TypeChatTransactionPurposeJoin: - return UnmarshalChatTransactionPurposeJoin(data) - - case TypeChatTransactionPurposeReaction: - return UnmarshalChatTransactionPurposeReaction(data) - - case TypeChatTransactionPurposeGiveaway: - return UnmarshalChatTransactionPurposeGiveaway(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfChatTransactionPurpose(dataList []json.RawMessage) ([]ChatTransactionPurpose, error) { - list := []ChatTransactionPurpose{} - - for _, data := range dataList { - entity, err := UnmarshalChatTransactionPurpose(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - 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 - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeStarTransactionPartnerTelegram: - return UnmarshalStarTransactionPartnerTelegram(data) - - case TypeStarTransactionPartnerAppStore: - return UnmarshalStarTransactionPartnerAppStore(data) - - case TypeStarTransactionPartnerGooglePlay: - return UnmarshalStarTransactionPartnerGooglePlay(data) - - case TypeStarTransactionPartnerFragment: - return UnmarshalStarTransactionPartnerFragment(data) - - case TypeStarTransactionPartnerTelegramAds: - return UnmarshalStarTransactionPartnerTelegramAds(data) - - case TypeStarTransactionPartnerTelegramApi: - return UnmarshalStarTransactionPartnerTelegramApi(data) - - case TypeStarTransactionPartnerBot: - return UnmarshalStarTransactionPartnerBot(data) - - case TypeStarTransactionPartnerBusiness: - return UnmarshalStarTransactionPartnerBusiness(data) - - case TypeStarTransactionPartnerChat: - return UnmarshalStarTransactionPartnerChat(data) - - case TypeStarTransactionPartnerUser: - return UnmarshalStarTransactionPartnerUser(data) - - case TypeStarTransactionPartnerUnsupported: - return UnmarshalStarTransactionPartnerUnsupported(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfStarTransactionPartner(dataList []json.RawMessage) ([]StarTransactionPartner, error) { - list := []StarTransactionPartner{} - - for _, data := range dataList { - entity, err := UnmarshalStarTransactionPartner(data) + entity, err := UnmarshalStarTransactionType(data) if err != nil { return nil, err } @@ -6816,6 +6781,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(data) + case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(data) @@ -7016,6 +6984,18 @@ func UnmarshalFileType(data json.RawMessage) (FileType, error) { case TypeFileTypeSecure: return UnmarshalFileTypeSecure(data) + case TypeFileTypeSelfDestructingPhoto: + return UnmarshalFileTypeSelfDestructingPhoto(data) + + case TypeFileTypeSelfDestructingVideo: + return UnmarshalFileTypeSelfDestructingVideo(data) + + case TypeFileTypeSelfDestructingVideoNote: + return UnmarshalFileTypeSelfDestructingVideoNote(data) + + case TypeFileTypeSelfDestructingVoiceNote: + return UnmarshalFileTypeSelfDestructingVoiceNote(data) + case TypeFileTypeSticker: return UnmarshalFileTypeSticker(data) @@ -9354,6 +9334,14 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalStarAmount(data json.RawMessage) (*StarAmount, error) { + var resp StarAmount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarSubscriptionTypeChannel(data json.RawMessage) (*StarSubscriptionTypeChannel, error) { var resp StarSubscriptionTypeChannel @@ -9394,6 +9382,86 @@ func UnmarshalStarSubscriptions(data json.RawMessage) (*StarSubscriptions, error return &resp, err } +func UnmarshalAffiliateProgramSortOrderProfitability(data json.RawMessage) (*AffiliateProgramSortOrderProfitability, error) { + var resp AffiliateProgramSortOrderProfitability + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramSortOrderCreationDate(data json.RawMessage) (*AffiliateProgramSortOrderCreationDate, error) { + var resp AffiliateProgramSortOrderCreationDate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramSortOrderRevenue(data json.RawMessage) (*AffiliateProgramSortOrderRevenue, error) { + var resp AffiliateProgramSortOrderRevenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramParameters(data json.RawMessage) (*AffiliateProgramParameters, error) { + var resp AffiliateProgramParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateProgramInfo(data json.RawMessage) (*AffiliateProgramInfo, error) { + var resp AffiliateProgramInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateInfo(data json.RawMessage) (*AffiliateInfo, error) { + var resp AffiliateInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFoundAffiliateProgram(data json.RawMessage) (*FoundAffiliateProgram, error) { + var resp FoundAffiliateProgram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFoundAffiliatePrograms(data json.RawMessage) (*FoundAffiliatePrograms, error) { + var resp FoundAffiliatePrograms + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatAffiliateProgram(data json.RawMessage) (*ChatAffiliateProgram, error) { + var resp ChatAffiliateProgram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatAffiliatePrograms(data json.RawMessage) (*ChatAffiliatePrograms, error) { + var resp ChatAffiliatePrograms + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalProductInfo(data json.RawMessage) (*ProductInfo, error) { var resp ProductInfo @@ -9530,168 +9598,200 @@ func UnmarshalStarTransactionDirectionOutgoing(data json.RawMessage) (*StarTrans return &resp, err } -func UnmarshalBotTransactionPurposePaidMedia(data json.RawMessage) (*BotTransactionPurposePaidMedia, error) { - var resp BotTransactionPurposePaidMedia +func UnmarshalStarTransactionTypePremiumBotDeposit(data json.RawMessage) (*StarTransactionTypePremiumBotDeposit, error) { + var resp StarTransactionTypePremiumBotDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalBotTransactionPurposeInvoicePayment(data json.RawMessage) (*BotTransactionPurposeInvoicePayment, error) { - var resp BotTransactionPurposeInvoicePayment +func UnmarshalStarTransactionTypeAppStoreDeposit(data json.RawMessage) (*StarTransactionTypeAppStoreDeposit, error) { + var resp StarTransactionTypeAppStoreDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalBotTransactionPurposeSubscription(data json.RawMessage) (*BotTransactionPurposeSubscription, error) { - var resp BotTransactionPurposeSubscription +func UnmarshalStarTransactionTypeGooglePlayDeposit(data json.RawMessage) (*StarTransactionTypeGooglePlayDeposit, error) { + var resp StarTransactionTypeGooglePlayDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposePaidMedia(data json.RawMessage) (*ChatTransactionPurposePaidMedia, error) { - var resp ChatTransactionPurposePaidMedia +func UnmarshalStarTransactionTypeFragmentDeposit(data json.RawMessage) (*StarTransactionTypeFragmentDeposit, error) { + var resp StarTransactionTypeFragmentDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposeJoin(data json.RawMessage) (*ChatTransactionPurposeJoin, error) { - var resp ChatTransactionPurposeJoin +func UnmarshalStarTransactionTypeUserDeposit(data json.RawMessage) (*StarTransactionTypeUserDeposit, error) { + var resp StarTransactionTypeUserDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposeReaction(data json.RawMessage) (*ChatTransactionPurposeReaction, error) { - var resp ChatTransactionPurposeReaction +func UnmarshalStarTransactionTypeGiveawayDeposit(data json.RawMessage) (*StarTransactionTypeGiveawayDeposit, error) { + var resp StarTransactionTypeGiveawayDeposit err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTransactionPurposeGiveaway(data json.RawMessage) (*ChatTransactionPurposeGiveaway, error) { - var resp ChatTransactionPurposeGiveaway +func UnmarshalStarTransactionTypeFragmentWithdrawal(data json.RawMessage) (*StarTransactionTypeFragmentWithdrawal, error) { + var resp StarTransactionTypeFragmentWithdrawal err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserTransactionPurposeGiftedStars(data json.RawMessage) (*UserTransactionPurposeGiftedStars, error) { - var resp UserTransactionPurposeGiftedStars +func UnmarshalStarTransactionTypeTelegramAdsWithdrawal(data json.RawMessage) (*StarTransactionTypeTelegramAdsWithdrawal, error) { + var resp StarTransactionTypeTelegramAdsWithdrawal err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserTransactionPurposeGiftSell(data json.RawMessage) (*UserTransactionPurposeGiftSell, error) { - var resp UserTransactionPurposeGiftSell +func UnmarshalStarTransactionTypeTelegramApiUsage(data json.RawMessage) (*StarTransactionTypeTelegramApiUsage, error) { + var resp StarTransactionTypeTelegramApiUsage err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserTransactionPurposeGiftSend(data json.RawMessage) (*UserTransactionPurposeGiftSend, error) { - var resp UserTransactionPurposeGiftSend +func UnmarshalStarTransactionTypeBotPaidMediaPurchase(data json.RawMessage) (*StarTransactionTypeBotPaidMediaPurchase, error) { + var resp StarTransactionTypeBotPaidMediaPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerTelegram(data json.RawMessage) (*StarTransactionPartnerTelegram, error) { - var resp StarTransactionPartnerTelegram +func UnmarshalStarTransactionTypeBotPaidMediaSale(data json.RawMessage) (*StarTransactionTypeBotPaidMediaSale, error) { + var resp StarTransactionTypeBotPaidMediaSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerAppStore(data json.RawMessage) (*StarTransactionPartnerAppStore, error) { - var resp StarTransactionPartnerAppStore +func UnmarshalStarTransactionTypeChannelPaidMediaPurchase(data json.RawMessage) (*StarTransactionTypeChannelPaidMediaPurchase, error) { + var resp StarTransactionTypeChannelPaidMediaPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerGooglePlay(data json.RawMessage) (*StarTransactionPartnerGooglePlay, error) { - var resp StarTransactionPartnerGooglePlay +func UnmarshalStarTransactionTypeChannelPaidMediaSale(data json.RawMessage) (*StarTransactionTypeChannelPaidMediaSale, error) { + var resp StarTransactionTypeChannelPaidMediaSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerFragment(data json.RawMessage) (*StarTransactionPartnerFragment, error) { - var resp StarTransactionPartnerFragment +func UnmarshalStarTransactionTypeBotInvoicePurchase(data json.RawMessage) (*StarTransactionTypeBotInvoicePurchase, error) { + var resp StarTransactionTypeBotInvoicePurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerTelegramAds(data json.RawMessage) (*StarTransactionPartnerTelegramAds, error) { - var resp StarTransactionPartnerTelegramAds +func UnmarshalStarTransactionTypeBotInvoiceSale(data json.RawMessage) (*StarTransactionTypeBotInvoiceSale, error) { + var resp StarTransactionTypeBotInvoiceSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerTelegramApi(data json.RawMessage) (*StarTransactionPartnerTelegramApi, error) { - var resp StarTransactionPartnerTelegramApi +func UnmarshalStarTransactionTypeBotSubscriptionPurchase(data json.RawMessage) (*StarTransactionTypeBotSubscriptionPurchase, error) { + var resp StarTransactionTypeBotSubscriptionPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerBot(data json.RawMessage) (*StarTransactionPartnerBot, error) { - var resp StarTransactionPartnerBot +func UnmarshalStarTransactionTypeBotSubscriptionSale(data json.RawMessage) (*StarTransactionTypeBotSubscriptionSale, error) { + var resp StarTransactionTypeBotSubscriptionSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerBusiness(data json.RawMessage) (*StarTransactionPartnerBusiness, error) { - var resp StarTransactionPartnerBusiness +func UnmarshalStarTransactionTypeChannelSubscriptionPurchase(data json.RawMessage) (*StarTransactionTypeChannelSubscriptionPurchase, error) { + var resp StarTransactionTypeChannelSubscriptionPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerChat(data json.RawMessage) (*StarTransactionPartnerChat, error) { - var resp StarTransactionPartnerChat +func UnmarshalStarTransactionTypeChannelSubscriptionSale(data json.RawMessage) (*StarTransactionTypeChannelSubscriptionSale, error) { + var resp StarTransactionTypeChannelSubscriptionSale err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerUser(data json.RawMessage) (*StarTransactionPartnerUser, error) { - var resp StarTransactionPartnerUser +func UnmarshalStarTransactionTypeGiftPurchase(data json.RawMessage) (*StarTransactionTypeGiftPurchase, error) { + var resp StarTransactionTypeGiftPurchase err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionPartnerUnsupported(data json.RawMessage) (*StarTransactionPartnerUnsupported, error) { - var resp StarTransactionPartnerUnsupported +func UnmarshalStarTransactionTypeGiftSale(data json.RawMessage) (*StarTransactionTypeGiftSale, error) { + var resp StarTransactionTypeGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeChannelPaidReactionSend(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionSend, error) { + var resp StarTransactionTypeChannelPaidReactionSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeChannelPaidReactionReceive(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionReceive, error) { + var resp StarTransactionTypeChannelPaidReactionReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeAffiliateProgramCommission(data json.RawMessage) (*StarTransactionTypeAffiliateProgramCommission, error) { + var resp StarTransactionTypeAffiliateProgramCommission + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { + var resp StarTransactionTypeUnsupported err := json.Unmarshal(data, &resp) @@ -18754,6 +18854,14 @@ func UnmarshalInternalLinkTypeChangePhoneNumber(data json.RawMessage) (*Internal return &resp, err } +func UnmarshalInternalLinkTypeChatAffiliateProgram(data json.RawMessage) (*InternalLinkTypeChatAffiliateProgram, error) { + var resp InternalLinkTypeChatAffiliateProgram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeChatBoost(data json.RawMessage) (*InternalLinkTypeChatBoost, error) { var resp InternalLinkTypeChatBoost @@ -19178,6 +19286,38 @@ func UnmarshalFileTypeSecure(data json.RawMessage) (*FileTypeSecure, error) { return &resp, err } +func UnmarshalFileTypeSelfDestructingPhoto(data json.RawMessage) (*FileTypeSelfDestructingPhoto, error) { + var resp FileTypeSelfDestructingPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSelfDestructingVideo(data json.RawMessage) (*FileTypeSelfDestructingVideo, error) { + var resp FileTypeSelfDestructingVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSelfDestructingVideoNote(data json.RawMessage) (*FileTypeSelfDestructingVideoNote, error) { + var resp FileTypeSelfDestructingVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSelfDestructingVoiceNote(data json.RawMessage) (*FileTypeSelfDestructingVoiceNote, error) { + var resp FileTypeSelfDestructingVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFileTypeSticker(data json.RawMessage) (*FileTypeSticker, error) { var resp FileTypeSticker @@ -21851,6 +21991,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeStarAmount: + return UnmarshalStarAmount(data) + case TypeStarSubscriptionTypeChannel: return UnmarshalStarSubscriptionTypeChannel(data) @@ -21866,6 +22009,36 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarSubscriptions: return UnmarshalStarSubscriptions(data) + case TypeAffiliateProgramSortOrderProfitability: + return UnmarshalAffiliateProgramSortOrderProfitability(data) + + case TypeAffiliateProgramSortOrderCreationDate: + return UnmarshalAffiliateProgramSortOrderCreationDate(data) + + case TypeAffiliateProgramSortOrderRevenue: + return UnmarshalAffiliateProgramSortOrderRevenue(data) + + case TypeAffiliateProgramParameters: + return UnmarshalAffiliateProgramParameters(data) + + case TypeAffiliateProgramInfo: + return UnmarshalAffiliateProgramInfo(data) + + case TypeAffiliateInfo: + return UnmarshalAffiliateInfo(data) + + case TypeFoundAffiliateProgram: + return UnmarshalFoundAffiliateProgram(data) + + case TypeFoundAffiliatePrograms: + return UnmarshalFoundAffiliatePrograms(data) + + case TypeChatAffiliateProgram: + return UnmarshalChatAffiliateProgram(data) + + case TypeChatAffiliatePrograms: + return UnmarshalChatAffiliatePrograms(data) + case TypeProductInfo: return UnmarshalProductInfo(data) @@ -21917,68 +22090,80 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionDirectionOutgoing: return UnmarshalStarTransactionDirectionOutgoing(data) - case TypeBotTransactionPurposePaidMedia: - return UnmarshalBotTransactionPurposePaidMedia(data) + case TypeStarTransactionTypePremiumBotDeposit: + return UnmarshalStarTransactionTypePremiumBotDeposit(data) - case TypeBotTransactionPurposeInvoicePayment: - return UnmarshalBotTransactionPurposeInvoicePayment(data) + case TypeStarTransactionTypeAppStoreDeposit: + return UnmarshalStarTransactionTypeAppStoreDeposit(data) - case TypeBotTransactionPurposeSubscription: - return UnmarshalBotTransactionPurposeSubscription(data) + case TypeStarTransactionTypeGooglePlayDeposit: + return UnmarshalStarTransactionTypeGooglePlayDeposit(data) - case TypeChatTransactionPurposePaidMedia: - return UnmarshalChatTransactionPurposePaidMedia(data) + case TypeStarTransactionTypeFragmentDeposit: + return UnmarshalStarTransactionTypeFragmentDeposit(data) - case TypeChatTransactionPurposeJoin: - return UnmarshalChatTransactionPurposeJoin(data) + case TypeStarTransactionTypeUserDeposit: + return UnmarshalStarTransactionTypeUserDeposit(data) - case TypeChatTransactionPurposeReaction: - return UnmarshalChatTransactionPurposeReaction(data) + case TypeStarTransactionTypeGiveawayDeposit: + return UnmarshalStarTransactionTypeGiveawayDeposit(data) - case TypeChatTransactionPurposeGiveaway: - return UnmarshalChatTransactionPurposeGiveaway(data) + case TypeStarTransactionTypeFragmentWithdrawal: + return UnmarshalStarTransactionTypeFragmentWithdrawal(data) - case TypeUserTransactionPurposeGiftedStars: - return UnmarshalUserTransactionPurposeGiftedStars(data) + case TypeStarTransactionTypeTelegramAdsWithdrawal: + return UnmarshalStarTransactionTypeTelegramAdsWithdrawal(data) - case TypeUserTransactionPurposeGiftSell: - return UnmarshalUserTransactionPurposeGiftSell(data) + case TypeStarTransactionTypeTelegramApiUsage: + return UnmarshalStarTransactionTypeTelegramApiUsage(data) - case TypeUserTransactionPurposeGiftSend: - return UnmarshalUserTransactionPurposeGiftSend(data) + case TypeStarTransactionTypeBotPaidMediaPurchase: + return UnmarshalStarTransactionTypeBotPaidMediaPurchase(data) - case TypeStarTransactionPartnerTelegram: - return UnmarshalStarTransactionPartnerTelegram(data) + case TypeStarTransactionTypeBotPaidMediaSale: + return UnmarshalStarTransactionTypeBotPaidMediaSale(data) - case TypeStarTransactionPartnerAppStore: - return UnmarshalStarTransactionPartnerAppStore(data) + case TypeStarTransactionTypeChannelPaidMediaPurchase: + return UnmarshalStarTransactionTypeChannelPaidMediaPurchase(data) - case TypeStarTransactionPartnerGooglePlay: - return UnmarshalStarTransactionPartnerGooglePlay(data) + case TypeStarTransactionTypeChannelPaidMediaSale: + return UnmarshalStarTransactionTypeChannelPaidMediaSale(data) - case TypeStarTransactionPartnerFragment: - return UnmarshalStarTransactionPartnerFragment(data) + case TypeStarTransactionTypeBotInvoicePurchase: + return UnmarshalStarTransactionTypeBotInvoicePurchase(data) - case TypeStarTransactionPartnerTelegramAds: - return UnmarshalStarTransactionPartnerTelegramAds(data) + case TypeStarTransactionTypeBotInvoiceSale: + return UnmarshalStarTransactionTypeBotInvoiceSale(data) - case TypeStarTransactionPartnerTelegramApi: - return UnmarshalStarTransactionPartnerTelegramApi(data) + case TypeStarTransactionTypeBotSubscriptionPurchase: + return UnmarshalStarTransactionTypeBotSubscriptionPurchase(data) - case TypeStarTransactionPartnerBot: - return UnmarshalStarTransactionPartnerBot(data) + case TypeStarTransactionTypeBotSubscriptionSale: + return UnmarshalStarTransactionTypeBotSubscriptionSale(data) - case TypeStarTransactionPartnerBusiness: - return UnmarshalStarTransactionPartnerBusiness(data) + case TypeStarTransactionTypeChannelSubscriptionPurchase: + return UnmarshalStarTransactionTypeChannelSubscriptionPurchase(data) - case TypeStarTransactionPartnerChat: - return UnmarshalStarTransactionPartnerChat(data) + case TypeStarTransactionTypeChannelSubscriptionSale: + return UnmarshalStarTransactionTypeChannelSubscriptionSale(data) - case TypeStarTransactionPartnerUser: - return UnmarshalStarTransactionPartnerUser(data) + case TypeStarTransactionTypeGiftPurchase: + return UnmarshalStarTransactionTypeGiftPurchase(data) - case TypeStarTransactionPartnerUnsupported: - return UnmarshalStarTransactionPartnerUnsupported(data) + case TypeStarTransactionTypeGiftSale: + return UnmarshalStarTransactionTypeGiftSale(data) + + case TypeStarTransactionTypeChannelPaidReactionSend: + return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) + + case TypeStarTransactionTypeChannelPaidReactionReceive: + return UnmarshalStarTransactionTypeChannelPaidReactionReceive(data) + + case TypeStarTransactionTypeAffiliateProgramCommission: + return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + + case TypeStarTransactionTypeUnsupported: + return UnmarshalStarTransactionTypeUnsupported(data) case TypeStarTransaction: return UnmarshalStarTransaction(data) @@ -25376,6 +25561,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(data) + case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(data) @@ -25535,6 +25723,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFileTypeSecure: return UnmarshalFileTypeSecure(data) + case TypeFileTypeSelfDestructingPhoto: + return UnmarshalFileTypeSelfDestructingPhoto(data) + + case TypeFileTypeSelfDestructingVideo: + return UnmarshalFileTypeSelfDestructingVideo(data) + + case TypeFileTypeSelfDestructingVideoNote: + return UnmarshalFileTypeSelfDestructingVideoNote(data) + + case TypeFileTypeSelfDestructingVoiceNote: + return UnmarshalFileTypeSelfDestructingVoiceNote(data) + case TypeFileTypeSticker: return UnmarshalFileTypeSticker(data) diff --git a/data/td_api.tl b/data/td_api.tl index ee20b8d..1512e66 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -813,6 +813,12 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; +//@description Describes a possibly non-integer amount of Telegram Stars +//@star_count The integer amount of Telegram Stars rounded to 0 +//@nanostar_count The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999 +starAmount star_count:int53 nanostar_count:int32 = StarAmount; + + //@class StarSubscriptionType @description Describes type of subscription paid in Telegram Stars //@description Describes a subscription to a channel chat @@ -844,11 +850,70 @@ starSubscriptionPricing period:int32 star_count:int53 = StarSubscriptionPricing; starSubscription id:string chat_id:int53 expiration_date:int32 is_canceled:Bool is_expiring:Bool pricing:starSubscriptionPricing type:StarSubscriptionType = StarSubscription; //@description Represents a list of Telegram Star subscriptions -//@star_count The amount of owned Telegram Stars +//@star_amount The amount of owned Telegram Stars //@subscriptions List of subscriptions for Telegram Stars //@required_star_count The number of Telegram Stars required to buy to extend subscriptions expiring soon //@next_offset The offset for the next request. If empty, then there are no more results -starSubscriptions star_count:int53 subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; +starSubscriptions star_amount:starAmount subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; + + +//@class AffiliateProgramSortOrder @description Describes the order of the found affiliate programs + +//@description The affiliate programs must be sorted by the profitability +affiliateProgramSortOrderProfitability = AffiliateProgramSortOrder; + +//@description The affiliate programs must be sorted by creation date +affiliateProgramSortOrderCreationDate = AffiliateProgramSortOrder; + +//@description The affiliate programs must be sorted by the expected revenue +affiliateProgramSortOrderRevenue = AffiliateProgramSortOrder; + + +//@description Describes parameters of an affiliate program +//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner; +//-getOption("affiliate_program_commission_per_mille_min")-getOption("affiliate_program_commission_per_mille_max") +//@month_count Number of months the program will be active; 0-36. If 0, then the program is eternal +affiliateProgramParameters commission_per_mille:int32 month_count:int32 = AffiliateProgramParameters; + +//@description Contains information about an active affiliate program +//@parameters Parameters of the affiliate program +//@end_date Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. +//-If positive, then the program can't be connected using connectChatAffiliateProgram, but active connections will work until the date +//@daily_revenue_per_user_amount The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program +affiliateProgramInfo parameters:affiliateProgramParameters end_date:int32 daily_revenue_per_user_amount:starAmount = AffiliateProgramInfo; + +//@description Contains information about an affiliate that received commission from a Telegram Star transaction +//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner +//@affiliate_chat_id Identifier of the chat which received the commission +//@star_amount The amount of Telegram Stars that were received by the affiliate; can be negative for refunds +affiliateInfo commission_per_mille:int32 affiliate_chat_id:int53 star_amount:starAmount = AffiliateInfo; + +//@description Describes a found affiliate program +//@bot_user_id User identifier of the bot created the program +//@parameters Information about the affiliate program +foundAffiliateProgram bot_user_id:int53 parameters:affiliateProgramInfo = FoundAffiliateProgram; + +//@description Represents a list of found affiliate programs +//@total_count The total number of found affiliate programs +//@programs The list of affiliate programs +//@next_offset The offset for the next request. If empty, then there are no more results +foundAffiliatePrograms total_count:int32 programs:vector next_offset:string = FoundAffiliatePrograms; + +//@description Describes an affiliate program that was connected to a chat +//@url The link that can be used to refer users if the program is still active +//@bot_user_id User identifier of the bot created the program +//@parameters The parameters of the affiliate program +//@connection_date Point in time (Unix timestamp) when the affiliate program was connected +//@is_disconnected True, if the program was canceled by the bot, or disconnected by the chat owner and isn't available anymore +//@user_count The number of users that used the affiliate program +//@revenue_star_count The number of Telegram Stars that were earned by the affiliate program +chatAffiliateProgram url:string bot_user_id:int53 parameters:affiliateProgramParameters connection_date:int32 is_disconnected:Bool user_count:int64 revenue_star_count:int64 = ChatAffiliateProgram; + +//@description Represents a list of affiliate programs that were connected to a chat +//@total_count The total number of affiliate programs that were connected to the chat +//@programs The list of connected affiliate programs +//@next_offset The offset for the next request. If empty, then there are no more results +chatAffiliatePrograms total_count:int32 programs:vector next_offset:string = ChatAffiliatePrograms; //@description Contains information about a product that can be paid with invoice @@ -971,103 +1036,137 @@ starTransactionDirectionIncoming = StarTransactionDirection; starTransactionDirectionOutgoing = StarTransactionDirection; -//@class BotTransactionPurpose @description Describes purpose of a transaction with a bot +//@class StarTransactionType @description Describes type of transaction with Telegram Stars -//@description Paid media were bought @media The bought media if the transaction wasn't refunded @payload Bot-provided payload; for bots only -botTransactionPurposePaidMedia media:vector payload:string = BotTransactionPurpose; +//@description The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only +starTransactionTypePremiumBotDeposit = StarTransactionType; -//@description User bought a product from the bot -//@product_info Information about the bought product; may be null if not applicable -//@invoice_payload Invoice payload; for bots only -botTransactionPurposeInvoicePayment product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; +//@description The transaction is a deposit of Telegram Stars from App Store; for regular users only +starTransactionTypeAppStoreDeposit = StarTransactionType; -//@description User bought a subscription in a bot or a business account -//@period The number of seconds between consecutive Telegram Star debiting -//@product_info Information about the bought subscription; may be null if not applicable -//@invoice_payload Invoice payload; for bots only -botTransactionPurposeSubscription period:int32 product_info:productInfo invoice_payload:bytes = BotTransactionPurpose; +//@description The transaction is a deposit of Telegram Stars from Google Play; for regular users only +starTransactionTypeGooglePlayDeposit = StarTransactionType; +//@description The transaction is a deposit of Telegram Stars from Fragment; for regular users and bots only +starTransactionTypeFragmentDeposit = StarTransactionType; -//@class ChatTransactionPurpose @description Describes purpose of a transaction with a supergroup or a channel +//@description The transaction is a deposit of Telegram Stars by another user; for regular users only +//@user_id Identifier of the user that gifted Telegram Stars; 0 if the user was anonymous +//@sticker The sticker to be shown in the transaction information; may be null if unknown +starTransactionTypeUserDeposit user_id:int53 sticker:sticker = StarTransactionType; -//@description Paid media were bought +//@description The transaction is a deposit of Telegram Stars from a giveaway; for regular users only +//@chat_id Identifier of a supergroup or a channel chat that created the giveaway +//@giveaway_message_id Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message +starTransactionTypeGiveawayDeposit chat_id:int53 giveaway_message_id:int53 = StarTransactionType; + +//@description The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only @withdrawal_state State of the withdrawal; may be null for refunds from Fragment +starTransactionTypeFragmentWithdrawal withdrawal_state:RevenueWithdrawalState = StarTransactionType; + +//@description The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only +starTransactionTypeTelegramAdsWithdrawal = StarTransactionType; + +//@description The transaction is a payment for Telegram API usage; for bots only @request_count The number of billed requests +starTransactionTypeTelegramApiUsage request_count:int32 = StarTransactionType; + +//@description The transaction is a purchase of paid media from a bot or a business account by the current user; for regular users only +//@user_id Identifier of the bot or the business account user that sent the paid media +//@media The bought media if the transaction wasn't refunded +starTransactionTypeBotPaidMediaPurchase user_id:int53 media:vector = StarTransactionType; + +//@description The transaction is a sale of paid media by the bot or a business account managed by the bot; for bots only +//@user_id Identifier of the user that bought the media +//@media The bought media +//@payload Bot-provided payload +//@affiliate Information about the affiliate which received commission from the transaction; may be null if none +starTransactionTypeBotPaidMediaSale user_id:int53 media:vector payload:string affiliate:affiliateInfo = StarTransactionType; + +//@description The transaction is a purchase of paid media from a channel by the current user; for regular users only +//@chat_id Identifier of the channel chat that sent the paid media //@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message //@media The bought media if the transaction wasn't refunded -chatTransactionPurposePaidMedia message_id:int53 media:vector = ChatTransactionPurpose; +starTransactionTypeChannelPaidMediaPurchase chat_id:int53 message_id:int53 media:vector = StarTransactionType; -//@description User joined the channel and subscribed to regular payments in Telegram Stars -//@period The number of seconds between consecutive Telegram Star debiting -chatTransactionPurposeJoin period:int32 = ChatTransactionPurpose; +//@description The transaction is a sale of paid media by the channel chat; for channel chats only +//@user_id Identifier of the user that bought the media +//@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message +//@media The bought media +starTransactionTypeChannelPaidMediaSale user_id:int53 message_id:int53 media:vector = StarTransactionType; -//@description User paid for a reaction +//@description The transaction is a purchase of a product from a bot or a business account by the current user; for regular users only +//@user_id Identifier of the bot or the business account user that created the invoice +//@product_info Information about the bought product +starTransactionTypeBotInvoicePurchase user_id:int53 product_info:productInfo = StarTransactionType; + +//@description The transaction is a sale of a product by the bot; for bots only +//@user_id Identifier of the user that bought the product +//@product_info Information about the bought product +//@invoice_payload Invoice payload +//@affiliate Information about the affiliate which received commission from the transaction; may be null if none +starTransactionTypeBotInvoiceSale user_id:int53 product_info:productInfo invoice_payload:bytes affiliate:affiliateInfo = StarTransactionType; + +//@description The transaction is a purchase of a subscription from a bot or a business account by the current user; for regular users only +//@user_id Identifier of the bot or the business account user that created the subscription link +//@subscription_period The number of seconds between consecutive Telegram Star debitings +//@product_info Information about the bought subscription +starTransactionTypeBotSubscriptionPurchase user_id:int53 subscription_period:int32 product_info:productInfo = StarTransactionType; + +//@description The transaction is a sale of a subscription by the bot; for bots only +//@user_id Identifier of the user that bought the subscription +//@subscription_period The number of seconds between consecutive Telegram Star debitings +//@product_info Information about the bought subscription +//@invoice_payload Invoice payload +//@affiliate Information about the affiliate which received commission from the transaction; may be null if none +starTransactionTypeBotSubscriptionSale user_id:int53 subscription_period:int32 product_info:productInfo invoice_payload:bytes affiliate:affiliateInfo = StarTransactionType; + +//@description The transaction is a purchase of a subscription to a channel chat by the current user; for regular users only +//@chat_id Identifier of the channel chat that created the subscription +//@subscription_period The number of seconds between consecutive Telegram Star debitings +starTransactionTypeChannelSubscriptionPurchase chat_id:int53 subscription_period:int32 = StarTransactionType; + +//@description The transaction is a sale of a subscription by the channel chat; for channel chats only +//@user_id Identifier of the user that bought the subscription +//@subscription_period The number of seconds between consecutive Telegram Star debitings +starTransactionTypeChannelSubscriptionSale user_id:int53 subscription_period:int32 = StarTransactionType; + +//@description The transaction is a purchase of a gift to another user; for regular users and bots only @user_id Identifier of the user that received the gift @gift The gift +starTransactionTypeGiftPurchase user_id:int53 gift:gift = StarTransactionType; + +//@description The transaction is a sale of a gift received from another user or bot; for regular users only @user_id Identifier of the user that sent the gift @gift The gift +starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; + +//@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only +//@chat_id Identifier of the channel chat //@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message -chatTransactionPurposeReaction message_id:int53 = ChatTransactionPurpose; +starTransactionTypeChannelPaidReactionSend chat_id:int53 message_id:int53 = StarTransactionType; -//@description User received Telegram Stars from a giveaway @giveaway_message_id Identifier of the message with giveaway; can be 0 or an identifier of a deleted message -chatTransactionPurposeGiveaway giveaway_message_id:int53 = ChatTransactionPurpose; +//@description The transaction is a receiving of a paid reaction to a message by the channel chat; for channel chats only +//@user_id Identifier of the user that added the paid reaction +//@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message +starTransactionTypeChannelPaidReactionReceive user_id:int53 message_id:int53 = StarTransactionType; +//@description The transaction is a receiving of a commission from an affiliate program; for regular users, bots and channel chats only +//@chat_id Identifier of the chat that created the affiliate program +//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner +starTransactionTypeAffiliateProgramCommission chat_id:int53 commission_per_mille:int32 = StarTransactionType; -//@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 user sold a gift received from another user or bot @gift The gift -userTransactionPurposeGiftSell gift:gift = UserTransactionPurpose; - -//@description The user or the bot sent a gift to a 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 -starTransactionPartnerTelegram = StarTransactionPartner; - -//@description The transaction is a transaction with App Store -starTransactionPartnerAppStore = StarTransactionPartner; - -//@description The transaction is a transaction with Google Play -starTransactionPartnerGooglePlay = StarTransactionPartner; - -//@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment or for Telegram Stars bought on Fragment -starTransactionPartnerFragment withdrawal_state:RevenueWithdrawalState = StarTransactionPartner; - -//@description The transaction is a transaction with Telegram Ad platform -starTransactionPartnerTelegramAds = StarTransactionPartner; - -//@description The transaction is a transaction with Telegram for API usage @request_count The number of billed requests -starTransactionPartnerTelegramApi request_count:int32 = StarTransactionPartner; - -//@description The transaction is a transaction with a bot @user_id Identifier of the bot @purpose Purpose of the transaction -starTransactionPartnerBot user_id:int53 purpose:BotTransactionPurpose = StarTransactionPartner; - -//@description The transaction is a transaction with a business account @user_id Identifier of the business account user @media The bought media if the transaction wasn't refunded -starTransactionPartnerBusiness user_id:int53 media:vector = StarTransactionPartner; - -//@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 transaction 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; +//@description The transaction is a transaction of an unsupported type +starTransactionTypeUnsupported = StarTransactionType; //@description Represents a transaction changing the amount of owned Telegram Stars //@id Unique identifier of the transaction -//@star_count The amount of added owned Telegram Stars; negative for outgoing transactions +//@star_amount The amount of added owned Telegram Stars; negative for outgoing transactions //@is_refund True, if the transaction is a refund of a previous transaction //@date Point in time (Unix timestamp) when the transaction was completed -//@partner Source of the incoming transaction, or its recipient for outgoing transactions -starTransaction id:string star_count:int53 is_refund:Bool date:int32 partner:StarTransactionPartner = StarTransaction; +//@type Type of the transaction +starTransaction id:string star_amount:starAmount is_refund:Bool date:int32 type:StarTransactionType = StarTransaction; //@description Represents a list of Telegram Star transactions -//@star_count The amount of owned Telegram Stars +//@star_amount The amount of owned Telegram Stars //@transactions List of transactions with Telegram Stars //@next_offset The offset for the next request. If empty, then there are no more results -starTransactions star_count:int53 transactions:vector next_offset:string = StarTransactions; +starTransactions star_amount:starAmount transactions:vector next_offset:string = StarTransactions; //@class GiveawayParticipantStatus @description Contains information about status of a user in a giveaway @@ -1165,11 +1264,11 @@ usernames active_usernames:vector disabled_usernames:vector edit //@phone_number Phone number of the user //@status Current online status of the user //@profile_photo Profile photo of the user; may be null -//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. For Telegram Premium users only -//@profile_accent_color_id Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only -//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none. For Telegram Premium users only -//@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only +//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none +//@profile_accent_color_id Identifier of the accent color for the user's profile; -1 if none +//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none +//@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null //@is_contact The user is a contact of the current user //@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user //@is_close_friend The user is a close friend of the current user; implies that the user is a contact @@ -1199,6 +1298,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null +//@affiliate_program Information about the affiliate program of the bot; may be null if none //@web_app_background_light_color Default light background color for bot Web Apps; -1 if not specified //@web_app_background_dark_color Default dark background color for bot Web Apps; -1 if not specified //@web_app_header_light_color Default light header color for bot Web Apps; -1 if not specified @@ -1210,7 +1310,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights affiliate_program:affiliateProgramInfo web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -5168,7 +5268,7 @@ targetChatTypes allow_user_chats:Bool allow_bot_chats:Bool allow_group_chats:Boo //@class TargetChat @description Describes the target chat to be opened -//@description The currently opened chat needs to be kept +//@description The currently opened chat and forum topic must be kept targetChatCurrent = TargetChat; //@description The chat needs to be chosen by the user among chats of the specified types @types Allowed types for the chat @@ -6815,6 +6915,11 @@ internalLinkTypeBuyStars star_count:int53 purpose:string = InternalLinkType; //@description The link is a link to the change phone number section of the application internalLinkTypeChangePhoneNumber = InternalLinkType; +//@description The link is an affiliate program link. Call searchChatAffiliateProgram with the given username and referrer to process the link +//@username Username to be passed to searchChatAffiliateProgram +//@referrer Referrer to be passed to searchChatAffiliateProgram +internalLinkTypeChatAffiliateProgram username:string referrer:string = InternalLinkType; + //@description The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. //-If the chat is found, then call getChatBoostStatus and getAvailableChatBoostSlots to get the current boost status and check whether the chat can be boosted. //-If the user wants to boost the chat and the chat can be boosted, then call boostChat @@ -7060,6 +7165,18 @@ fileTypeSecretThumbnail = FileType; //@description The file is a file from Secure storage used for storing Telegram Passport files fileTypeSecure = FileType; +//@description The file is a self-destructing photo in a private chat +fileTypeSelfDestructingPhoto = FileType; + +//@description The file is a self-destructing video in a private chat +fileTypeSelfDestructingVideo = FileType; + +//@description The file is a self-destructing video note in a private chat +fileTypeSelfDestructingVideoNote = FileType; + +//@description The file is a self-destructing voice note in a private chat +fileTypeSelfDestructingVoiceNote = FileType; + //@description The file is a sticker fileTypeSticker = FileType; @@ -7558,12 +7675,12 @@ chatRevenueTransactions total_count:int32 transactions:vector = Update; //@description The list of supported accent colors has changed //@colors Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported //-and aren't included in the list. The exact colors for the accent colors with identifiers 0-6 must be taken from the app theme -//@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order +//@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specified order updateAccentColors colors:vector available_accent_color_ids:vector = Update; //@description The list of supported accent colors for user profiles has changed //@colors Information about supported colors -//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specififed order +//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specified order updateProfileAccentColors colors:vector available_accent_color_ids:vector = Update; //@description Some language pack strings have been updated @localization_target Localization target to which the language pack belongs @language_pack_id Identifier of the updated language pack @strings List of changed language pack strings; empty if all strings have changed @@ -8097,8 +8214,8 @@ updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = U //@messages The list of messages with active live locations updateActiveLiveLocationMessages messages:vector = Update; -//@description The number of Telegram Stars owned by the current user has changed @star_count The new number of Telegram Stars owned -updateOwnedStarCount star_count:int53 = Update; +//@description The number of Telegram Stars owned by the current user has changed @star_amount The new amount of owned Telegram Stars +updateOwnedStarCount star_amount:starAmount = Update; //@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions //@chat_id Identifier of the chat @@ -9545,7 +9662,7 @@ answerInlineQuery inline_query_id:int64 is_personal:Bool button:inlineQueryResul //@chat_types Types of the chats to which the message can be sent savePreparedInlineMessage user_id:int53 result:InputInlineQueryResult chat_types:targetChatTypes = PreparedInlineMessageId; -//@description Saves an inline message to be sent by the given user; for bots only +//@description Saves an inline message to be sent by the given user //@bot_user_id Identifier of the bot that created the message //@prepared_message_id Identifier of the prepared message getPreparedInlineMessage bot_user_id:int53 prepared_message_id:string = PreparedInlineMessage; @@ -10120,7 +10237,7 @@ editStoryCover story_sender_chat_id:int53 story_id:int32 cover_frame_timestamp:d //@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true //@story_id Identifier of the story -//@privacy_settings The new privacy settigs for the story +//@privacy_settings The new privacy settings for the story setStoryPrivacySettings story_id:int32 privacy_settings:StoryPrivacySettings = Ok; //@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_posted_to_chat_page == true @@ -10548,7 +10665,7 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@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 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 +//@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; //@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right @chat_id Chat identifier @@ -10778,9 +10895,12 @@ getAllStickerEmojis sticker_type:StickerType query:string chat_id:int53 return_o //@description Searches for stickers from public sticker sets that correspond to any of the given emoji //@sticker_type Type of the stickers to return -//@emojis Space-separated list of emojis to search for; must be non-empty +//@emojis Space-separated list of emojis to search for +//@query Query to search for; may be empty to search for emoji only +//@input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown +//@offset The offset from which to return the stickers; must be non-negative //@limit The maximum number of stickers to be returned; 0-100 -searchStickers sticker_type:StickerType emojis:string limit:int32 = Stickers; +searchStickers sticker_type:StickerType emojis:string query:string input_language_codes:vector offset:int32 limit:int32 = Stickers; //@description Returns greeting stickers from regular sticker sets that can be used for the start page of other users getGreetingStickers = Stickers; @@ -10910,6 +11030,9 @@ removeSavedAnimation animation:InputFile = Ok; //@description Returns up to 20 recently used inline bots in the order of their last usage getRecentInlineBots = Users; +//@description Returns the list of bots owned by the current user +getOwnedBots = Users; + //@description Searches for recently used hashtags by their prefix @prefix Hashtag prefix to search for @limit The maximum number of hashtags to be returned searchHashtags prefix:string limit:int32 = Hashtags; @@ -11908,6 +12031,46 @@ editUserStarSubscription user_id:int53 telegram_payment_charge_id:string is_canc reuseStarSubscription subscription_id:string = Ok; +//@description Changes affiliate program for a bot +//@chat_id Identifier of the chat with an owned bot for which affiliate program is changed +//@parameters Parameters of the affiliate program; pass null to close the currently active program. If there is an active program, then commission and program duration can only be increased. +//-If the active program is scheduled to be closed, then it can't be changed anymore +setChatAffiliateProgram chat_id:int53 parameters:affiliateProgramParameters = Ok; + +//@description Searches a chat with an affiliate program. Returns the chat if found and the program is active +//@username Username of the chat +//@referrer The referrer from an internalLinkTypeChatAffiliateProgram link +searchChatAffiliateProgram username:string referrer:string = Chat; + +//@description Searches affiliate programs that can be applied to the given chat +//@chat_id Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@sort_order Sort order for the results +//@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of affiliate programs to return +searchAffiliatePrograms chat_id:int53 sort_order:AffiliateProgramSortOrder offset:string limit:int32 = FoundAffiliatePrograms; + +//@description Connects an affiliate program to the given chat. Returns information about the connected affiliate program +//@chat_id Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@bot_user_id Identifier of the bot, which affiliate program is connected +connectChatAffiliateProgram chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; + +//@description Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +//@chat_id Identifier of the chat for which the affiliate program is connected +//@url The referral link of the affiliate program +disconnectChatAffiliateProgram chat_id:int53 url:string = ChatAffiliateProgram; + +//@description Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program +//@chat_id Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@bot_user_id Identifier of the bot that created the program +getChatAffiliateProgram chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; + +//@description Returns affiliate programs that were connected to the given chat +//@chat_id Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of affiliate programs to return +getChatAffiliatePrograms chat_id:int53 offset:string limit:int32 = ChatAffiliatePrograms; + + //@description Returns information about features, available to Business users @source Source of the request; pass null if the method is called from settings or some non-standard source getBusinessFeatures source:BusinessFeature = BusinessFeatures; From 626ffe1a7b529e3094efd74794c10bf241fe020d Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 3 Jan 2025 06:02:55 +0800 Subject: [PATCH 07/29] Update to TDLib 1.8.42 --- client/function.go | 290 ++++++++++-- client/type.go | 1004 +++++++++++++++++++++++++++++++++++++---- client/unmarshaler.go | 431 +++++++++++++++++- data/td_api.tl | 324 ++++++++++--- 4 files changed, 1854 insertions(+), 195 deletions(-) diff --git a/client/function.go b/client/function.go index 5b97dd5..c8ffa78 100755 --- a/client/function.go +++ b/client/function.go @@ -2696,8 +2696,6 @@ func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Found type SearchMessagesRequest struct { // Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported ChatList ChatList `json:"chat_list"` - // Pass true to search only for messages in channels - OnlyInChannels bool `json:"only_in_channels"` // Query to search for Query string `json:"query"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -2706,6 +2704,8 @@ type SearchMessagesRequest struct { Limit int32 `json:"limit"` // Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function Filter SearchMessagesFilter `json:"filter"` + // Additional filter for type of the chat of the searched messages; pass null to search for messages in all chats + ChatTypeFilter SearchMessagesChatTypeFilter `json:"chat_type_filter"` // If not 0, the minimum date of the messages to return MinDate int32 `json:"min_date"` // If not 0, the maximum date of the messages to return @@ -2720,11 +2720,11 @@ func (client *Client) SearchMessages(req *SearchMessagesRequest) (*FoundMessages }, Data: map[string]interface{}{ "chat_list": req.ChatList, - "only_in_channels": req.OnlyInChannels, "query": req.Query, "offset": req.Offset, "limit": req.Limit, "filter": req.Filter, + "chat_type_filter": req.ChatTypeFilter, "min_date": req.MinDate, "max_date": req.MaxDate, }, @@ -13120,6 +13120,8 @@ type CreateCallRequest struct { Protocol *CallProtocol `json:"protocol"` // Pass true to create a video call IsVideo bool `json:"is_video"` + // Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored + GroupCallId int32 `json:"group_call_id"` } // Creates a new call @@ -13132,6 +13134,7 @@ func (client *Client) CreateCall(req *CreateCallRequest) (*CallId, error) { "user_id": req.UserId, "protocol": req.Protocol, "is_video": req.IsVideo, + "group_call_id": req.GroupCallId, }, }) if err != nil { @@ -13424,6 +13427,32 @@ func (client *Client) CreateVideoChat(req *CreateVideoChatRequest) (*GroupCallId return UnmarshalGroupCallId(result.Data) } +type CreateGroupCallRequest struct { + // Call identifier + CallId int32 `json:"call_id"` +} + +// Creates a group call from a one-to-one call +func (client *Client) CreateGroupCall(req *CreateGroupCallRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createGroupCall", + }, + Data: map[string]interface{}{ + "call_id": req.CallId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetVideoChatRtmpUrlRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -17596,6 +17625,67 @@ func (client *Client) GetBotInfoShortDescription(req *GetBotInfoShortDescription return UnmarshalText(result.Data) } +type SetMessageSenderBotVerificationRequest struct { + // Identifier of the owned bot, which will verify the user or the chat + BotUserId int64 `json:"bot_user_id"` + // Identifier of the user or the supergroup or channel chat, which will be verified by the bot + VerifiedId MessageSender `json:"verified_id"` + // Custom description of verification reason; 0-getOption("bot_verification_custom_description_length_max"). If empty, then "was verified by organization "organization_name"" will be used as description. Can be specified only if the bot is allowed to provide custom description + CustomDescription string `json:"custom_description"` +} + +// Changes the verification status of a user or a chat by an owned bot +func (client *Client) SetMessageSenderBotVerification(req *SetMessageSenderBotVerificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMessageSenderBotVerification", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "verified_id": req.VerifiedId, + "custom_description": req.CustomDescription, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveMessageSenderBotVerificationRequest struct { + // Identifier of the owned bot, which verified the user or the chat + BotUserId int64 `json:"bot_user_id"` + // Identifier of the user or the supergroup or channel chat, which verification is removed + VerifiedId MessageSender `json:"verified_id"` +} + +// Removes the verification status of a user or a chat by an owned bot +func (client *Client) RemoveMessageSenderBotVerification(req *RemoveMessageSenderBotVerificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeMessageSenderBotVerification", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "verified_id": req.VerifiedId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns all active sessions of the current user func (client *Client) GetActiveSessions() (*Sessions, error) { result, err := client.Send(Request{ @@ -18693,6 +18783,8 @@ type SendGiftRequest struct { 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"` + // Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free + PayForUpgrade bool `json:"pay_for_upgrade"` } // Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out @@ -18706,6 +18798,7 @@ func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { "user_id": req.UserId, "text": req.Text, "is_private": req.IsPrivate, + "pay_for_upgrade": req.PayForUpgrade, }, }) if err != nil { @@ -18780,6 +18873,99 @@ func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, err return UnmarshalOk(result.Data) } +type GetGiftUpgradePreviewRequest struct { + // Identifier of the gift + GiftId JsonInt64 `json:"gift_id"` +} + +// Returns examples of possible upgraded gifts for a regular gift +func (client *Client) GetGiftUpgradePreview(req *GetGiftUpgradePreviewRequest) (*GiftUpgradePreview, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftUpgradePreview", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftUpgradePreview(result.Data) +} + +type UpgradeGiftRequest 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 keep the original gift text, sender and receiver in the upgraded gift + KeepOriginalDetails bool `json:"keep_original_details"` +} + +// Upgrades a gift received by the current user. Unless the gift has prepaid_upgrade_star_count > 0, the user must pay gift.upgrade_star_count Telegram Stars for the upgrade +func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "upgradeGift", + }, + Data: map[string]interface{}{ + "sender_user_id": req.SenderUserId, + "message_id": req.MessageId, + "keep_original_details": req.KeepOriginalDetails, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpgradeGiftResult(result.Data) +} + +type TransferGiftRequest struct { + // Identifier of the user that sent the gift + SenderUserId int64 `json:"sender_user_id"` + // Identifier of the message with the upgraded gift in the chat with the user + MessageId int64 `json:"message_id"` + // Identifier of the user that will receive the gift + ReceiverUserId int64 `json:"receiver_user_id"` + // The amount of Telegram Stars required for the transfer + StarCount int64 `json:"star_count"` +} + +// Sends a gift upgraded by the current user to another user +func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "transferGift", + }, + Data: map[string]interface{}{ + "sender_user_id": req.SenderUserId, + "message_id": req.MessageId, + "receiver_user_id": req.ReceiverUserId, + "star_count": req.StarCount, + }, + }) + 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"` @@ -18812,6 +18998,32 @@ func (client *Client) GetUserGifts(req *GetUserGiftsRequest) (*UserGifts, error) return UnmarshalUserGifts(result.Data) } +type GetUserGiftRequest struct { + // Identifier of the message with the gift + MessageId int64 `json:"message_id"` +} + +// Returns information about a gift received or sent by the current user +func (client *Client) GetUserGift(req *GetUserGiftRequest) (*UserGift, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserGift", + }, + Data: map[string]interface{}{ + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUserGift(result.Data) +} + type CreateInvoiceLinkRequest struct { // Unique identifier of business connection on behalf of which to send the request BusinessConnectionId string `json:"business_connection_id"` @@ -22320,8 +22532,8 @@ func (client *Client) SearchChatAffiliateProgram(req *SearchChatAffiliateProgram } type SearchAffiliateProgramsRequest struct { - // Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right - ChatId int64 `json:"chat_id"` + // The affiliate for which affiliate programs are searched for + Affiliate AffiliateType `json:"affiliate"` // Sort order for the results SortOrder AffiliateProgramSortOrder `json:"sort_order"` // Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results @@ -22330,14 +22542,14 @@ type SearchAffiliateProgramsRequest struct { Limit int32 `json:"limit"` } -// Searches affiliate programs that can be applied to the given chat +// Searches affiliate programs that can be connected to the given affiliate func (client *Client) SearchAffiliatePrograms(req *SearchAffiliateProgramsRequest) (*FoundAffiliatePrograms, error) { result, err := client.Send(Request{ meta: meta{ Type: "searchAffiliatePrograms", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, + "affiliate": req.Affiliate, "sort_order": req.SortOrder, "offset": req.Offset, "limit": req.Limit, @@ -22354,21 +22566,21 @@ func (client *Client) SearchAffiliatePrograms(req *SearchAffiliateProgramsReques return UnmarshalFoundAffiliatePrograms(result.Data) } -type ConnectChatAffiliateProgramRequest struct { - // Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right - ChatId int64 `json:"chat_id"` +type ConnectAffiliateProgramRequest struct { + // The affiliate to which the affiliate program will be connected + Affiliate AffiliateType `json:"affiliate"` // Identifier of the bot, which affiliate program is connected BotUserId int64 `json:"bot_user_id"` } -// Connects an affiliate program to the given chat. Returns information about the connected affiliate program -func (client *Client) ConnectChatAffiliateProgram(req *ConnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { +// Connects an affiliate program to the given affiliate. Returns information about the connected affiliate program +func (client *Client) ConnectAffiliateProgram(req *ConnectAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { result, err := client.Send(Request{ meta: meta{ - Type: "connectChatAffiliateProgram", + Type: "connectAffiliateProgram", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, + "affiliate": req.Affiliate, "bot_user_id": req.BotUserId, }, }) @@ -22380,24 +22592,24 @@ func (client *Client) ConnectChatAffiliateProgram(req *ConnectChatAffiliateProgr return nil, buildResponseError(result.Data) } - return UnmarshalChatAffiliateProgram(result.Data) + return UnmarshalConnectedAffiliateProgram(result.Data) } -type DisconnectChatAffiliateProgramRequest struct { - // Identifier of the chat for which the affiliate program is connected - ChatId int64 `json:"chat_id"` +type DisconnectAffiliateProgramRequest struct { + // The affiliate to which the affiliate program is connected + Affiliate AffiliateType `json:"affiliate"` // The referral link of the affiliate program Url string `json:"url"` } -// Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program -func (client *Client) DisconnectChatAffiliateProgram(req *DisconnectChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { +// Disconnects an affiliate program from the given affiliate and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +func (client *Client) DisconnectAffiliateProgram(req *DisconnectAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { result, err := client.Send(Request{ meta: meta{ - Type: "disconnectChatAffiliateProgram", + Type: "disconnectAffiliateProgram", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, + "affiliate": req.Affiliate, "url": req.Url, }, }) @@ -22409,24 +22621,24 @@ func (client *Client) DisconnectChatAffiliateProgram(req *DisconnectChatAffiliat return nil, buildResponseError(result.Data) } - return UnmarshalChatAffiliateProgram(result.Data) + return UnmarshalConnectedAffiliateProgram(result.Data) } -type GetChatAffiliateProgramRequest struct { - // Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right - ChatId int64 `json:"chat_id"` +type GetConnectedAffiliateProgramRequest struct { + // The affiliate to which the affiliate program will be connected + Affiliate AffiliateType `json:"affiliate"` // Identifier of the bot that created the program BotUserId int64 `json:"bot_user_id"` } -// Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program -func (client *Client) GetChatAffiliateProgram(req *GetChatAffiliateProgramRequest) (*ChatAffiliateProgram, error) { +// Returns an affiliate program that were connected to the given affiliate by identifier of the bot that created the program +func (client *Client) GetConnectedAffiliateProgram(req *GetConnectedAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatAffiliateProgram", + Type: "getConnectedAffiliateProgram", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, + "affiliate": req.Affiliate, "bot_user_id": req.BotUserId, }, }) @@ -22438,26 +22650,26 @@ func (client *Client) GetChatAffiliateProgram(req *GetChatAffiliateProgramReques return nil, buildResponseError(result.Data) } - return UnmarshalChatAffiliateProgram(result.Data) + return UnmarshalConnectedAffiliateProgram(result.Data) } -type GetChatAffiliateProgramsRequest struct { - // Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right - ChatId int64 `json:"chat_id"` +type GetConnectedAffiliateProgramsRequest struct { + // The affiliate to which the affiliate program were connected + Affiliate AffiliateType `json:"affiliate"` // Offset of the first affiliate program 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 affiliate programs to return Limit int32 `json:"limit"` } -// Returns affiliate programs that were connected to the given chat -func (client *Client) GetChatAffiliatePrograms(req *GetChatAffiliateProgramsRequest) (*ChatAffiliatePrograms, error) { +// Returns affiliate programs that were connected to the given affiliate +func (client *Client) GetConnectedAffiliatePrograms(req *GetConnectedAffiliateProgramsRequest) (*ConnectedAffiliatePrograms, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatAffiliatePrograms", + Type: "getConnectedAffiliatePrograms", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, + "affiliate": req.Affiliate, "offset": req.Offset, "limit": req.Limit, }, @@ -22470,7 +22682,7 @@ func (client *Client) GetChatAffiliatePrograms(req *GetChatAffiliateProgramsRequ return nil, buildResponseError(result.Data) } - return UnmarshalChatAffiliatePrograms(result.Data) + return UnmarshalConnectedAffiliatePrograms(result.Data) } type GetBusinessFeaturesRequest struct { diff --git a/client/type.go b/client/type.go index e2c1ee7..0b77de8 100755 --- a/client/type.go +++ b/client/type.go @@ -24,7 +24,9 @@ const ( ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" ClassStarSubscriptionType = "StarSubscriptionType" + ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassSentGift = "SentGift" ClassStarTransactionDirection = "StarTransactionDirection" ClassStarTransactionType = "StarTransactionType" ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" @@ -84,6 +86,7 @@ const ( ClassMessageSelfDestructType = "MessageSelfDestructType" ClassInputMessageContent = "InputMessageContent" ClassSearchMessagesFilter = "SearchMessagesFilter" + ClassSearchMessagesChatTypeFilter = "SearchMessagesChatTypeFilter" ClassChatAction = "ChatAction" ClassUserStatus = "UserStatus" ClassEmojiCategorySource = "EmojiCategorySource" @@ -212,6 +215,9 @@ const ( ClassBotCommand = "BotCommand" ClassBotCommands = "BotCommands" ClassBotMenuButton = "BotMenuButton" + ClassBotVerificationParameters = "BotVerificationParameters" + ClassBotVerification = "BotVerification" + ClassVerificationStatus = "VerificationStatus" ClassChatLocation = "ChatLocation" ClassBirthdate = "Birthdate" ClassCloseBirthdayUser = "CloseBirthdayUser" @@ -244,8 +250,8 @@ const ( ClassAffiliateInfo = "AffiliateInfo" ClassFoundAffiliateProgram = "FoundAffiliateProgram" ClassFoundAffiliatePrograms = "FoundAffiliatePrograms" - ClassChatAffiliateProgram = "ChatAffiliateProgram" - ClassChatAffiliatePrograms = "ChatAffiliatePrograms" + ClassConnectedAffiliateProgram = "ConnectedAffiliateProgram" + ClassConnectedAffiliatePrograms = "ConnectedAffiliatePrograms" ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" @@ -257,10 +263,17 @@ const ( ClassStarGiveawayWinnerOption = "StarGiveawayWinnerOption" ClassStarGiveawayPaymentOption = "StarGiveawayPaymentOption" ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" + ClassUpgradedGiftModel = "UpgradedGiftModel" + ClassUpgradedGiftSymbol = "UpgradedGiftSymbol" + ClassUpgradedGiftBackdrop = "UpgradedGiftBackdrop" + ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" ClassGift = "Gift" ClassGifts = "Gifts" + ClassUpgradedGift = "UpgradedGift" + ClassUpgradeGiftResult = "UpgradeGiftResult" ClassUserGift = "UserGift" ClassUserGifts = "UserGifts" + ClassGiftUpgradePreview = "GiftUpgradePreview" ClassStarTransaction = "StarTransaction" ClassStarTransactions = "StarTransactions" ClassAccentColor = "AccentColor" @@ -334,6 +347,7 @@ const ( ClassReactionNotificationSettings = "ReactionNotificationSettings" ClassDraftMessage = "DraftMessage" ClassChatFolderIcon = "ChatFolderIcon" + ClassChatFolderName = "ChatFolderName" ClassChatFolder = "ChatFolder" ClassChatFolderInfo = "ChatFolderInfo" ClassChatFolderInviteLink = "ChatFolderInviteLink" @@ -687,6 +701,9 @@ const ( TypeBotCommand = "botCommand" TypeBotCommands = "botCommands" TypeBotMenuButton = "botMenuButton" + TypeBotVerificationParameters = "botVerificationParameters" + TypeBotVerification = "botVerification" + TypeVerificationStatus = "verificationStatus" TypeChatLocation = "chatLocation" TypeBirthdate = "birthdate" TypeCloseBirthdayUser = "closeBirthdayUser" @@ -725,6 +742,9 @@ const ( TypeStarSubscriptionPricing = "starSubscriptionPricing" TypeStarSubscription = "starSubscription" TypeStarSubscriptions = "starSubscriptions" + TypeAffiliateTypeCurrentUser = "affiliateTypeCurrentUser" + TypeAffiliateTypeBot = "affiliateTypeBot" + TypeAffiliateTypeChannel = "affiliateTypeChannel" TypeAffiliateProgramSortOrderProfitability = "affiliateProgramSortOrderProfitability" TypeAffiliateProgramSortOrderCreationDate = "affiliateProgramSortOrderCreationDate" TypeAffiliateProgramSortOrderRevenue = "affiliateProgramSortOrderRevenue" @@ -733,8 +753,8 @@ const ( TypeAffiliateInfo = "affiliateInfo" TypeFoundAffiliateProgram = "foundAffiliateProgram" TypeFoundAffiliatePrograms = "foundAffiliatePrograms" - TypeChatAffiliateProgram = "chatAffiliateProgram" - TypeChatAffiliatePrograms = "chatAffiliatePrograms" + TypeConnectedAffiliateProgram = "connectedAffiliateProgram" + TypeConnectedAffiliatePrograms = "connectedAffiliatePrograms" TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" @@ -746,10 +766,19 @@ const ( TypeStarGiveawayWinnerOption = "starGiveawayWinnerOption" TypeStarGiveawayPaymentOption = "starGiveawayPaymentOption" TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" + TypeUpgradedGiftModel = "upgradedGiftModel" + TypeUpgradedGiftSymbol = "upgradedGiftSymbol" + TypeUpgradedGiftBackdrop = "upgradedGiftBackdrop" + TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" TypeGift = "gift" TypeGifts = "gifts" + TypeUpgradedGift = "upgradedGift" + TypeUpgradeGiftResult = "upgradeGiftResult" + TypeSentGiftRegular = "sentGiftRegular" + TypeSentGiftUpgraded = "sentGiftUpgraded" TypeUserGift = "userGift" TypeUserGifts = "userGifts" + TypeGiftUpgradePreview = "giftUpgradePreview" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" TypeStarTransactionTypePremiumBotDeposit = "starTransactionTypePremiumBotDeposit" @@ -772,7 +801,9 @@ const ( TypeStarTransactionTypeChannelSubscriptionPurchase = "starTransactionTypeChannelSubscriptionPurchase" TypeStarTransactionTypeChannelSubscriptionSale = "starTransactionTypeChannelSubscriptionSale" TypeStarTransactionTypeGiftPurchase = "starTransactionTypeGiftPurchase" + TypeStarTransactionTypeGiftTransfer = "starTransactionTypeGiftTransfer" TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" + TypeStarTransactionTypeGiftUpgrade = "starTransactionTypeGiftUpgrade" TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" @@ -934,6 +965,7 @@ const ( TypeChatTypeSupergroup = "chatTypeSupergroup" TypeChatTypeSecret = "chatTypeSecret" TypeChatFolderIcon = "chatFolderIcon" + TypeChatFolderName = "chatFolderName" TypeChatFolder = "chatFolder" TypeChatFolderInfo = "chatFolderInfo" TypeChatFolderInviteLink = "chatFolderInviteLink" @@ -1282,6 +1314,8 @@ const ( TypeMessageGiftedStars = "messageGiftedStars" TypeMessageGiveawayPrizeStars = "messageGiveawayPrizeStars" TypeMessageGift = "messageGift" + TypeMessageUpgradedGift = "messageUpgradedGift" + TypeMessageRefundedUpgradedGift = "messageRefundedUpgradedGift" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1362,6 +1396,9 @@ const ( TypeSearchMessagesFilterUnreadReaction = "searchMessagesFilterUnreadReaction" TypeSearchMessagesFilterFailedToSend = "searchMessagesFilterFailedToSend" TypeSearchMessagesFilterPinned = "searchMessagesFilterPinned" + TypeSearchMessagesChatTypeFilterPrivate = "searchMessagesChatTypeFilterPrivate" + TypeSearchMessagesChatTypeFilterGroup = "searchMessagesChatTypeFilterGroup" + TypeSearchMessagesChatTypeFilterChannel = "searchMessagesChatTypeFilterChannel" TypeChatActionTyping = "chatActionTyping" TypeChatActionRecordingVideo = "chatActionRecordingVideo" TypeChatActionUploadingVideo = "chatActionUploadingVideo" @@ -1467,6 +1504,7 @@ const ( TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected" TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp" + TypeCallDiscardReasonAllowGroupCall = "callDiscardReasonAllowGroupCall" TypeCallProtocol = "callProtocol" TypeCallServerTypeTelegramReflector = "callServerTypeTelegramReflector" TypeCallServerTypeWebrtc = "callServerTypeWebrtc" @@ -1782,6 +1820,7 @@ const ( TypePushMessageContentPremiumGiftCode = "pushMessageContentPremiumGiftCode" TypePushMessageContentGiveaway = "pushMessageContentGiveaway" TypePushMessageContentGift = "pushMessageContentGift" + TypePushMessageContentUpgradedGift = "pushMessageContentUpgradedGift" TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken" TypePushMessageContentSticker = "pushMessageContentSticker" TypePushMessageContentStory = "pushMessageContentStory" @@ -2029,6 +2068,7 @@ const ( TypeSuggestedActionSubscribeToAnnualPremium = "suggestedActionSubscribeToAnnualPremium" TypeSuggestedActionGiftPremiumForChristmas = "suggestedActionGiftPremiumForChristmas" TypeSuggestedActionSetBirthdate = "suggestedActionSetBirthdate" + TypeSuggestedActionSetProfilePhoto = "suggestedActionSetProfilePhoto" TypeSuggestedActionExtendPremium = "suggestedActionExtendPremium" TypeSuggestedActionExtendStarSubscriptions = "suggestedActionExtendStarSubscriptions" TypeCount = "count" @@ -2336,11 +2376,21 @@ type StarSubscriptionType interface { StarSubscriptionTypeType() string } +// Describes type of affiliate for an affiliate program +type AffiliateType interface { + AffiliateTypeType() string +} + // Describes the order of the found affiliate programs type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Represents a gift received by a user +type SentGift interface { + SentGiftType() string +} + // Describes direction of a transaction with Telegram Stars type StarTransactionDirection interface { StarTransactionDirectionType() string @@ -2636,6 +2686,11 @@ type SearchMessagesFilter interface { SearchMessagesFilterType() string } +// Represents a filter for type of the chats in which to search messages +type SearchMessagesChatTypeFilter interface { + SearchMessagesChatTypeFilterType() string +} + // Describes the different types of activity in a chat type ChatAction interface { ChatActionType() string @@ -6288,6 +6343,91 @@ func (*BotMenuButton) GetType() string { return TypeBotMenuButton } +// Describes parameters of verification that is provided by a bot +type BotVerificationParameters struct { + meta + // Identifier of the custom emoji that is used as the verification sign + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + // Name of the organization that provides verification + OrganizationName string `json:"organization_name"` + // Default custom description of verification reason to be used as placeholder in setMessageSenderBotVerification; may be null if none + DefaultCustomDescription *FormattedText `json:"default_custom_description"` + // True, if the bot is allowed to provide custom description for verified entities + CanSetCustomDescription bool `json:"can_set_custom_description"` +} + +func (entity *BotVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*BotVerificationParameters) GetClass() string { + return ClassBotVerificationParameters +} + +func (*BotVerificationParameters) GetType() string { + return TypeBotVerificationParameters +} + +// Describes verification status provided by a bot +type BotVerification struct { + meta + // Identifier of the bot that provided the verification + BotUserId int64 `json:"bot_user_id"` + // Identifier of the custom emoji that is used as the verification sign + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + // Custom description of verification reason set by the bot + CustomDescription *FormattedText `json:"custom_description"` +} + +func (entity *BotVerification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotVerification + + return json.Marshal((*stub)(entity)) +} + +func (*BotVerification) GetClass() string { + return ClassBotVerification +} + +func (*BotVerification) GetType() string { + return TypeBotVerification +} + +// Contains information about verification status of a chat or a user +type VerificationStatus struct { + meta + // True, if the chat or the user is verified by Telegram + IsVerified bool `json:"is_verified"` + // True, if the chat or the user is marked as scam by Telegram + IsScam bool `json:"is_scam"` + // True, if the chat or the user is marked as fake by Telegram + IsFake bool `json:"is_fake"` + // Identifier of the custom emoji to be shown as verification sign provided by a bot for the user; 0 if none + BotVerificationIconCustomEmojiId JsonInt64 `json:"bot_verification_icon_custom_emoji_id"` +} + +func (entity *VerificationStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VerificationStatus + + return json.Marshal((*stub)(entity)) +} + +func (*VerificationStatus) GetClass() string { + return ClassVerificationStatus +} + +func (*VerificationStatus) GetType() string { + return TypeVerificationStatus +} + // Represents a location to which a chat is connected type ChatLocation struct { meta @@ -7518,6 +7658,85 @@ func (*StarSubscriptions) GetType() string { return TypeStarSubscriptions } +// The affiliate is the current user +type AffiliateTypeCurrentUser struct{ + meta +} + +func (entity *AffiliateTypeCurrentUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateTypeCurrentUser + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateTypeCurrentUser) GetClass() string { + return ClassAffiliateType +} + +func (*AffiliateTypeCurrentUser) GetType() string { + return TypeAffiliateTypeCurrentUser +} + +func (*AffiliateTypeCurrentUser) AffiliateTypeType() string { + return TypeAffiliateTypeCurrentUser +} + +// The affiliate is a bot owned by the current user +type AffiliateTypeBot struct { + meta + // User identifier of the bot + UserId int64 `json:"user_id"` +} + +func (entity *AffiliateTypeBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateTypeBot + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateTypeBot) GetClass() string { + return ClassAffiliateType +} + +func (*AffiliateTypeBot) GetType() string { + return TypeAffiliateTypeBot +} + +func (*AffiliateTypeBot) AffiliateTypeType() string { + return TypeAffiliateTypeBot +} + +// The affiliate is a channel chat where the current user has can_post_messages administrator right +type AffiliateTypeChannel struct { + meta + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` +} + +func (entity *AffiliateTypeChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateTypeChannel + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateTypeChannel) GetClass() string { + return ClassAffiliateType +} + +func (*AffiliateTypeChannel) GetType() string { + return TypeAffiliateTypeChannel +} + +func (*AffiliateTypeChannel) AffiliateTypeType() string { + return TypeAffiliateTypeChannel +} + // The affiliate programs must be sorted by the profitability type AffiliateProgramSortOrderProfitability struct{ meta @@ -7623,7 +7842,7 @@ type AffiliateProgramInfo struct { meta // Parameters of the affiliate program Parameters *AffiliateProgramParameters `json:"parameters"` - // Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. If positive, then the program can't be connected using connectChatAffiliateProgram, but active connections will work until the date + // Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. If positive, then the program can't be connected using connectAffiliateProgram, but active connections will work until the date EndDate int32 `json:"end_date"` // The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program DailyRevenuePerUserAmount *StarAmount `json:"daily_revenue_per_user_amount"` @@ -7678,7 +7897,7 @@ type FoundAffiliateProgram struct { // User identifier of the bot created the program BotUserId int64 `json:"bot_user_id"` // Information about the affiliate program - Parameters *AffiliateProgramInfo `json:"parameters"` + Info *AffiliateProgramInfo `json:"info"` } func (entity *FoundAffiliateProgram) MarshalJSON() ([]byte, error) { @@ -7724,8 +7943,8 @@ func (*FoundAffiliatePrograms) GetType() string { return TypeFoundAffiliatePrograms } -// Describes an affiliate program that was connected to a chat -type ChatAffiliateProgram struct { +// Describes an affiliate program that was connected to an affiliate +type ConnectedAffiliateProgram struct { meta // The link that can be used to refer users if the program is still active Url string `json:"url"` @@ -7743,47 +7962,47 @@ type ChatAffiliateProgram struct { RevenueStarCount JsonInt64 `json:"revenue_star_count"` } -func (entity *ChatAffiliateProgram) MarshalJSON() ([]byte, error) { +func (entity *ConnectedAffiliateProgram) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatAffiliateProgram + type stub ConnectedAffiliateProgram return json.Marshal((*stub)(entity)) } -func (*ChatAffiliateProgram) GetClass() string { - return ClassChatAffiliateProgram +func (*ConnectedAffiliateProgram) GetClass() string { + return ClassConnectedAffiliateProgram } -func (*ChatAffiliateProgram) GetType() string { - return TypeChatAffiliateProgram +func (*ConnectedAffiliateProgram) GetType() string { + return TypeConnectedAffiliateProgram } -// Represents a list of affiliate programs that were connected to a chat -type ChatAffiliatePrograms struct { +// Represents a list of affiliate programs that were connected to an affiliate +type ConnectedAffiliatePrograms struct { meta - // The total number of affiliate programs that were connected to the chat + // The total number of affiliate programs that were connected to the affiliate TotalCount int32 `json:"total_count"` // The list of connected affiliate programs - Programs []*ChatAffiliateProgram `json:"programs"` + Programs []*ConnectedAffiliateProgram `json:"programs"` // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } -func (entity *ChatAffiliatePrograms) MarshalJSON() ([]byte, error) { +func (entity *ConnectedAffiliatePrograms) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatAffiliatePrograms + type stub ConnectedAffiliatePrograms return json.Marshal((*stub)(entity)) } -func (*ChatAffiliatePrograms) GetClass() string { - return ClassChatAffiliatePrograms +func (*ConnectedAffiliatePrograms) GetClass() string { + return ClassConnectedAffiliatePrograms } -func (*ChatAffiliatePrograms) GetType() string { - return TypeChatAffiliatePrograms +func (*ConnectedAffiliatePrograms) GetType() string { + return TypeConnectedAffiliatePrograms } // Contains information about a product that can be paid with invoice @@ -8167,6 +8386,122 @@ func (*StarGiveawayPaymentOptions) GetType() string { return TypeStarGiveawayPaymentOptions } +// Describes a model of an upgraded gift +type UpgradedGiftModel struct { + meta + // Name of the model + Name string `json:"name"` + // The sticker representing the upgraded gift + Sticker *Sticker `json:"sticker"` + // The number of upgraded gift that receive this model for each 1000 gifts upgraded + RarityPerMille int32 `json:"rarity_per_mille"` +} + +func (entity *UpgradedGiftModel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftModel + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftModel) GetClass() string { + return ClassUpgradedGiftModel +} + +func (*UpgradedGiftModel) GetType() string { + return TypeUpgradedGiftModel +} + +// Describes a symbol shown on the pattern of an upgraded gift +type UpgradedGiftSymbol struct { + meta + // Name of the symbol + Name string `json:"name"` + // The sticker representing the upgraded gift + Sticker *Sticker `json:"sticker"` + // The number of upgraded gift that receive this symbol for each 1000 gifts upgraded + RarityPerMille int32 `json:"rarity_per_mille"` +} + +func (entity *UpgradedGiftSymbol) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftSymbol + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftSymbol) GetClass() string { + return ClassUpgradedGiftSymbol +} + +func (*UpgradedGiftSymbol) GetType() string { + return TypeUpgradedGiftSymbol +} + +// Describes a backdrop of an upgraded gift +type UpgradedGiftBackdrop struct { + meta + // Name of the backdrop + Name string `json:"name"` + // A color in the center of the backdrop in the RGB format + CenterColor int32 `json:"center_color"` + // A color on the edges of the backdrop in the RGB format + EdgeColor int32 `json:"edge_color"` + // A color to be applied for the symbol in the RGB format + SymbolColor int32 `json:"symbol_color"` + // A color for the text on the backdrop in the RGB format + TextColor int32 `json:"text_color"` + // The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded + RarityPerMille int32 `json:"rarity_per_mille"` +} + +func (entity *UpgradedGiftBackdrop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftBackdrop + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftBackdrop) GetClass() string { + return ClassUpgradedGiftBackdrop +} + +func (*UpgradedGiftBackdrop) GetType() string { + return TypeUpgradedGiftBackdrop +} + +// Describes the original details about the gift +type UpgradedGiftOriginalDetails struct { + meta + // Identifier of the user that sent the gift; 0 if the gift was private + SenderUserId int64 `json:"sender_user_id"` + // Identifier of the user that received the gift + ReceiverUserId int64 `json:"receiver_user_id"` + // Message added to the gift + Text *FormattedText `json:"text"` + // Point in time (Unix timestamp) when the gift was sent + Date int32 `json:"date"` +} + +func (entity *UpgradedGiftOriginalDetails) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginalDetails + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginalDetails) GetClass() string { + return ClassUpgradedGiftOriginalDetails +} + +func (*UpgradedGiftOriginalDetails) GetType() string { + return TypeUpgradedGiftOriginalDetails +} + // Describes a gift that can be sent to another user type Gift struct { meta @@ -8176,8 +8511,10 @@ type Gift struct { 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 + // Number of Telegram Stars that can be claimed by the receiver instead of the regular 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 Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible + UpgradeStarCount int64 `json:"upgrade_star_count"` // True, if the gift is a birthday gift IsForBirthday bool `json:"is_for_birthday"` // Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out @@ -8229,6 +8566,132 @@ func (*Gifts) GetType() string { return TypeGifts } +// Describes an upgraded gift that can be gifted to another user or transferred to TON blockchain as an NFT +type UpgradedGift struct { + meta + // Unique identifier of the gift + Id JsonInt64 `json:"id"` + // The title of the upgraded gift + Title string `json:"title"` + // Unique number of the upgraded gift among gifts upgraded from the same gift + Number int32 `json:"number"` + // Total number of gifts that were upgraded from the same gift + TotalUpgradedCount int32 `json:"total_upgraded_count"` + // The maximum number of gifts that can be upgraded from the same gift + MaxUpgradedCount int32 `json:"max_upgraded_count"` + // User identifier of the user that owns the upgraded gift; 0 if none + OwnerUserId int64 `json:"owner_user_id"` + // Model of the upgraded gift + Model *UpgradedGiftModel `json:"model"` + // Symbol of the upgraded gift + Symbol *UpgradedGiftSymbol `json:"symbol"` + // Backdrop of the upgraded gift + Backdrop *UpgradedGiftBackdrop `json:"backdrop"` + // Information about the originally sent gift; may be null if unknown + OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` +} + +func (entity *UpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGift) GetClass() string { + return ClassUpgradedGift +} + +func (*UpgradedGift) GetType() string { + return TypeUpgradedGift +} + +// Contains result of gift upgrading +type UpgradeGiftResult struct { + meta + // The upgraded gift + Gift *UpgradedGift `json:"gift"` + // True, if the gift is displayed on the user's profile page + IsSaved bool `json:"is_saved"` + // True, if the gift can be transferred to another user + CanBeTransferred bool `json:"can_be_transferred"` + // Number of Telegram Stars that must be paid to transfer the upgraded gift + TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT + ExportDate int32 `json:"export_date"` +} + +func (entity *UpgradeGiftResult) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradeGiftResult + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradeGiftResult) GetClass() string { + return ClassUpgradeGiftResult +} + +func (*UpgradeGiftResult) GetType() string { + return TypeUpgradeGiftResult +} + +// Regular gift +type SentGiftRegular struct { + meta + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *SentGiftRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SentGiftRegular + + return json.Marshal((*stub)(entity)) +} + +func (*SentGiftRegular) GetClass() string { + return ClassSentGift +} + +func (*SentGiftRegular) GetType() string { + return TypeSentGiftRegular +} + +func (*SentGiftRegular) SentGiftType() string { + return TypeSentGiftRegular +} + +// Upgraded gift +type SentGiftUpgraded struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *SentGiftUpgraded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SentGiftUpgraded + + return json.Marshal((*stub)(entity)) +} + +func (*SentGiftUpgraded) GetClass() string { + return ClassSentGift +} + +func (*SentGiftUpgraded) GetType() string { + return TypeSentGiftUpgraded +} + +func (*SentGiftUpgraded) SentGiftType() string { + return TypeSentGiftUpgraded +} + // Represents a gift received by a user type UserGift struct { meta @@ -8238,16 +8701,28 @@ type UserGift struct { 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 + // 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 is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift + CanBeUpgraded bool `json:"can_be_upgraded"` + // True, if the gift is an upgraded gift that can be transferred to another user; only for the receiver of the gift + CanBeTransferred bool `json:"can_be_transferred"` + // True, if the gift was refunded and isn't available anymore + WasRefunded bool `json:"was_refunded"` // 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 + Gift SentGift `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 receiver of the gift MessageId int64 `json:"message_id"` - // Number of Telegram Stars that can be claimed by the receiver instead of the gift; 0 if the gift can't be sold by the current user + // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user SellStarCount int64 `json:"sell_star_count"` + // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift + TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the upgraded gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + ExportDate int32 `json:"export_date"` } func (entity *UserGift) MarshalJSON() ([]byte, error) { @@ -8266,6 +8741,49 @@ func (*UserGift) GetType() string { return TypeUserGift } +func (userGift *UserGift) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderUserId int64 `json:"sender_user_id"` + Text *FormattedText `json:"text"` + IsPrivate bool `json:"is_private"` + IsSaved bool `json:"is_saved"` + CanBeUpgraded bool `json:"can_be_upgraded"` + CanBeTransferred bool `json:"can_be_transferred"` + WasRefunded bool `json:"was_refunded"` + Date int32 `json:"date"` + Gift json.RawMessage `json:"gift"` + MessageId int64 `json:"message_id"` + SellStarCount int64 `json:"sell_star_count"` + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + TransferStarCount int64 `json:"transfer_star_count"` + ExportDate int32 `json:"export_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + userGift.SenderUserId = tmp.SenderUserId + userGift.Text = tmp.Text + userGift.IsPrivate = tmp.IsPrivate + userGift.IsSaved = tmp.IsSaved + userGift.CanBeUpgraded = tmp.CanBeUpgraded + userGift.CanBeTransferred = tmp.CanBeTransferred + userGift.WasRefunded = tmp.WasRefunded + userGift.Date = tmp.Date + userGift.MessageId = tmp.MessageId + userGift.SellStarCount = tmp.SellStarCount + userGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + userGift.TransferStarCount = tmp.TransferStarCount + userGift.ExportDate = tmp.ExportDate + + fieldGift, _ := UnmarshalSentGift(tmp.Gift) + userGift.Gift = fieldGift + + return nil +} + // Represents a list of gifts received by a user type UserGifts struct { meta @@ -8293,6 +8811,33 @@ func (*UserGifts) GetType() string { return TypeUserGifts } +// Contains examples of possible upgraded gifts for the given regular gift +type GiftUpgradePreview struct { + meta + // Examples of possible models that can be chosen for the gift after upgrade + Models []*UpgradedGiftModel `json:"models"` + // Examples of possible symbols that can be chosen for the gift after upgrade + Symbols []*UpgradedGiftSymbol `json:"symbols"` + // Examples of possible backdrops that can be chosen for the gift after upgrade + Backdrops []*UpgradedGiftBackdrop `json:"backdrops"` +} + +func (entity *GiftUpgradePreview) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftUpgradePreview + + return json.Marshal((*stub)(entity)) +} + +func (*GiftUpgradePreview) GetClass() string { + return ClassGiftUpgradePreview +} + +func (*GiftUpgradePreview) GetType() string { + return TypeGiftUpgradePreview +} + // The transaction is incoming and increases the number of owned Telegram Stars type StarTransactionDirectionIncoming struct{ meta @@ -8990,7 +9535,7 @@ func (*StarTransactionTypeChannelSubscriptionSale) StarTransactionTypeType() str return TypeStarTransactionTypeChannelSubscriptionSale } -// The transaction is a purchase of a gift to another user; for regular users and bots only +// The transaction is a purchase of a regular gift to another user; for regular users and bots only type StarTransactionTypeGiftPurchase struct { meta // Identifier of the user that received the gift @@ -9019,6 +9564,35 @@ func (*StarTransactionTypeGiftPurchase) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftPurchase } +// The transaction is a transfer of an upgraded gift to another user; for regular users only +type StarTransactionTypeGiftTransfer struct { + meta + // Identifier of the user that received the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftTransfer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftTransfer + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftTransfer) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftTransfer) GetType() string { + return TypeStarTransactionTypeGiftTransfer +} + +func (*StarTransactionTypeGiftTransfer) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftTransfer +} + // The transaction is a sale of a gift received from another user or bot; for regular users only type StarTransactionTypeGiftSale struct { meta @@ -9048,6 +9622,33 @@ func (*StarTransactionTypeGiftSale) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftSale } +// The transaction is an upgrade of a gift; for regular users only +type StarTransactionTypeGiftUpgrade struct { + meta + // The upgraded gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftUpgrade) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftUpgrade) GetType() string { + return TypeStarTransactionTypeGiftUpgrade +} + +func (*StarTransactionTypeGiftUpgrade) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftUpgrade +} + // The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only type StarTransactionTypeChannelPaidReactionSend struct { meta @@ -9720,18 +10321,14 @@ type User struct { IsMutualContact bool `json:"is_mutual_contact"` // The user is a close friend of the current user; implies that the user is a contact IsCloseFriend bool `json:"is_close_friend"` - // True, if the user is verified - IsVerified bool `json:"is_verified"` + // Information about verification status of the user; may be null if none + VerificationStatus *VerificationStatus `json:"verification_status"` // True, if the user is a Telegram Premium user IsPremium bool `json:"is_premium"` // True, if the user is Telegram support account IsSupport bool `json:"is_support"` // If non-empty, it contains a human-readable description of the reason why access to this user must be restricted RestrictionReason string `json:"restriction_reason"` - // True, if many users reported this user as a scam - IsScam bool `json:"is_scam"` - // True, if many users reported this user as a fake account - IsFake bool `json:"is_fake"` // True, if the user has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` // True, if the user has unread non-expired stories available to the current user @@ -9782,12 +10379,10 @@ func (user *User) UnmarshalJSON(data []byte) error { IsContact bool `json:"is_contact"` IsMutualContact bool `json:"is_mutual_contact"` IsCloseFriend bool `json:"is_close_friend"` - IsVerified bool `json:"is_verified"` + VerificationStatus *VerificationStatus `json:"verification_status"` IsPremium bool `json:"is_premium"` IsSupport bool `json:"is_support"` RestrictionReason string `json:"restriction_reason"` - IsScam bool `json:"is_scam"` - IsFake bool `json:"is_fake"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` RestrictsNewChats bool `json:"restricts_new_chats"` @@ -9817,12 +10412,10 @@ func (user *User) UnmarshalJSON(data []byte) error { user.IsContact = tmp.IsContact user.IsMutualContact = tmp.IsMutualContact user.IsCloseFriend = tmp.IsCloseFriend - user.IsVerified = tmp.IsVerified + user.VerificationStatus = tmp.VerificationStatus user.IsPremium = tmp.IsPremium user.IsSupport = tmp.IsSupport user.RestrictionReason = tmp.RestrictionReason - user.IsScam = tmp.IsScam - user.IsFake = tmp.IsFake user.HasActiveStories = tmp.HasActiveStories user.HasUnreadActiveStories = tmp.HasUnreadActiveStories user.RestrictsNewChats = tmp.RestrictsNewChats @@ -9870,6 +10463,8 @@ type BotInfo struct { WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` // Default dark header color for bot Web Apps; -1 if not specified WebAppHeaderDarkColor int32 `json:"web_app_header_dark_color"` + // Parameters of the verification that can be provided by the bot; may be null if none or the current user isn't the owner of the bot + VerificationParameters *BotVerificationParameters `json:"verification_parameters"` // True, if the bot's revenue statistics are available to the current user CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` // True, if the bot can manage emoji status of the current user @@ -9918,6 +10513,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { WebAppBackgroundDarkColor int32 `json:"web_app_background_dark_color"` WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` WebAppHeaderDarkColor int32 `json:"web_app_header_dark_color"` + VerificationParameters *BotVerificationParameters `json:"verification_parameters"` CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` CanManageEmojiStatus bool `json:"can_manage_emoji_status"` HasMediaPreviews bool `json:"has_media_previews"` @@ -9946,6 +10542,7 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.WebAppBackgroundDarkColor = tmp.WebAppBackgroundDarkColor botInfo.WebAppHeaderLightColor = tmp.WebAppHeaderLightColor botInfo.WebAppHeaderDarkColor = tmp.WebAppHeaderDarkColor + botInfo.VerificationParameters = tmp.VerificationParameters botInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics botInfo.CanManageEmojiStatus = tmp.CanManageEmojiStatus botInfo.HasMediaPreviews = tmp.HasMediaPreviews @@ -10004,6 +10601,8 @@ type UserFullInfo struct { 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 verification status of the user provided by a bot; may be null if none or unknown + BotVerification *BotVerification `json:"bot_verification"` // Information about business settings for Telegram Business accounts; may be null if none BusinessInfo *BusinessInfo `json:"business_info"` // For bots, information about the bot; may be null if the user isn't a bot @@ -10046,6 +10645,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { PersonalChatId int64 `json:"personal_chat_id"` GiftCount int32 `json:"gift_count"` GroupInCommonCount int32 `json:"group_in_common_count"` + BotVerification *BotVerification `json:"bot_verification"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` } @@ -10072,6 +10672,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.PersonalChatId = tmp.PersonalChatId userFullInfo.GiftCount = tmp.GiftCount userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount + userFullInfo.BotVerification = tmp.BotVerification userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo @@ -11128,12 +11729,8 @@ type ChatInviteLinkInfo struct { CreatesJoinRequest bool `json:"creates_join_request"` // True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup IsPublic bool `json:"is_public"` - // True, if the chat is verified - IsVerified bool `json:"is_verified"` - // True, if many users reported this chat as a scam - IsScam bool `json:"is_scam"` - // True, if many users reported this chat as a fake account - IsFake bool `json:"is_fake"` + // Information about verification status of the chat; may be null if none + VerificationStatus *VerificationStatus `json:"verification_status"` } func (entity *ChatInviteLinkInfo) MarshalJSON() ([]byte, error) { @@ -11166,9 +11763,7 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { SubscriptionInfo *ChatInviteLinkSubscriptionInfo `json:"subscription_info"` CreatesJoinRequest bool `json:"creates_join_request"` IsPublic bool `json:"is_public"` - IsVerified bool `json:"is_verified"` - IsScam bool `json:"is_scam"` - IsFake bool `json:"is_fake"` + VerificationStatus *VerificationStatus `json:"verification_status"` } err := json.Unmarshal(data, &tmp) @@ -11187,9 +11782,7 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { chatInviteLinkInfo.SubscriptionInfo = tmp.SubscriptionInfo chatInviteLinkInfo.CreatesJoinRequest = tmp.CreatesJoinRequest chatInviteLinkInfo.IsPublic = tmp.IsPublic - chatInviteLinkInfo.IsVerified = tmp.IsVerified - chatInviteLinkInfo.IsScam = tmp.IsScam - chatInviteLinkInfo.IsFake = tmp.IsFake + chatInviteLinkInfo.VerificationStatus = tmp.VerificationStatus fieldType, _ := UnmarshalInviteLinkChatType(tmp.Type) chatInviteLinkInfo.Type = fieldType @@ -11279,8 +11872,6 @@ type BasicGroup struct { meta // Group identifier Id int64 `json:"id"` - // Group access hash - AccessHash JsonInt64 `json:"access_hash"` // Number of members in the group MemberCount int32 `json:"member_count"` // Status of the current user in the group @@ -11310,7 +11901,6 @@ func (*BasicGroup) GetType() string { func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { var tmp struct { Id int64 `json:"id"` - AccessHash JsonInt64 `json:"access_hash"` MemberCount int32 `json:"member_count"` Status json.RawMessage `json:"status"` IsActive bool `json:"is_active"` @@ -11323,7 +11913,6 @@ func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { } basicGroup.Id = tmp.Id - basicGroup.AccessHash = tmp.AccessHash basicGroup.MemberCount = tmp.MemberCount basicGroup.IsActive = tmp.IsActive basicGroup.UpgradedToSupergroupId = tmp.UpgradedToSupergroupId @@ -11408,16 +11997,12 @@ type Supergroup struct { IsBroadcastGroup bool `json:"is_broadcast_group"` // True, if the supergroup is a forum with topics IsForum bool `json:"is_forum"` - // True, if the supergroup or channel is verified - IsVerified bool `json:"is_verified"` + // Information about verification status of the supergroup or channel; may be null if none + VerificationStatus *VerificationStatus `json:"verification_status"` // True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler HasSensitiveContent bool `json:"has_sensitive_content"` // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted RestrictionReason string `json:"restriction_reason"` - // True, if many users reported this supergroup or channel as a scam - IsScam bool `json:"is_scam"` - // True, if many users reported this supergroup or channel as a fake account - IsFake bool `json:"is_fake"` // True, if the supergroup or channel has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` // True, if the supergroup or channel has unread non-expired stories available to the current user @@ -11459,11 +12044,9 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { IsChannel bool `json:"is_channel"` IsBroadcastGroup bool `json:"is_broadcast_group"` IsForum bool `json:"is_forum"` - IsVerified bool `json:"is_verified"` + VerificationStatus *VerificationStatus `json:"verification_status"` HasSensitiveContent bool `json:"has_sensitive_content"` RestrictionReason string `json:"restriction_reason"` - IsScam bool `json:"is_scam"` - IsFake bool `json:"is_fake"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` } @@ -11489,11 +12072,9 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.IsChannel = tmp.IsChannel supergroup.IsBroadcastGroup = tmp.IsBroadcastGroup supergroup.IsForum = tmp.IsForum - supergroup.IsVerified = tmp.IsVerified + supergroup.VerificationStatus = tmp.VerificationStatus supergroup.HasSensitiveContent = tmp.HasSensitiveContent supergroup.RestrictionReason = tmp.RestrictionReason - supergroup.IsScam = tmp.IsScam - supergroup.IsFake = tmp.IsFake supergroup.HasActiveStories = tmp.HasActiveStories supergroup.HasUnreadActiveStories = tmp.HasUnreadActiveStories @@ -11568,6 +12149,8 @@ type SupergroupFullInfo struct { InviteLink *ChatInviteLink `json:"invite_link"` // List of commands of bots in the group BotCommands []*BotCommands `json:"bot_commands"` + // Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown + BotVerification *BotVerification `json:"bot_verification"` // Identifier of the basic group from which supergroup was upgraded; 0 if none UpgradedFromBasicGroupId int64 `json:"upgraded_from_basic_group_id"` // Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none @@ -14635,11 +15218,36 @@ func (*ChatFolderIcon) GetType() string { return TypeChatFolderIcon } +// Describes name of a chat folder +type ChatFolderName struct { + meta + // The text of the chat folder name; 1-12 characters without line feeds. May contain only CustomEmoji entities + Text *FormattedText `json:"text"` + // True, if custom emoji in the name must be animated + AnimateCustomEmoji bool `json:"animate_custom_emoji"` +} + +func (entity *ChatFolderName) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatFolderName + + return json.Marshal((*stub)(entity)) +} + +func (*ChatFolderName) GetClass() string { + return ClassChatFolderName +} + +func (*ChatFolderName) GetType() string { + return TypeChatFolderName +} + // Represents a folder for user chats type ChatFolder struct { meta - // The title of the folder; 1-12 characters without line feeds - Title string `json:"title"` + // The name of the folder + Name *ChatFolderName `json:"name"` // The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder Icon *ChatFolderIcon `json:"icon"` // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription @@ -14691,8 +15299,8 @@ type ChatFolderInfo struct { meta // Unique chat folder identifier Id int32 `json:"id"` - // The title of the folder; 1-12 characters without line feeds - Title string `json:"title"` + // The name of the folder + Name *ChatFolderName `json:"name"` // The chosen or default icon for the chat folder Icon *ChatFolderIcon `json:"icon"` // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled @@ -26348,21 +26956,31 @@ func (*MessageGiveawayPrizeStars) MessageContentType() string { return TypeMessageGiveawayPrizeStars } -// A gift was received or sent by the current user +// A regular 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; 0 if the gift can't be sold by the receiver + // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver SellStarCount int64 `json:"sell_star_count"` + // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_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 can be upgraded to a unique gift; only for the receiver of the gift + CanBeUpgraded bool `json:"can_be_upgraded"` // True, if the gift was converted to Telegram Stars; only for the receiver of the gift WasConverted bool `json:"was_converted"` + // True, if the gift was upgraded to a unique gift + WasUpgraded bool `json:"was_upgraded"` + // True, if the gift was refunded and isn't available anymore + WasRefunded bool `json:"was_refunded"` + // Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift with upgraded version of the gift; can be 0 if none or an identifier of a deleted message. Use getUserGift to get information about the gift + UpgradeMessageId int64 `json:"upgrade_message_id"` } func (entity *MessageGift) MarshalJSON() ([]byte, error) { @@ -26385,6 +27003,74 @@ func (*MessageGift) MessageContentType() string { return TypeMessageGift } +// An upgraded gift was received or sent by the current user +type MessageUpgradedGift struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift + IsUpgrade bool `json:"is_upgrade"` + // 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 can be transferred to another user; only for the receiver of the gift + CanBeTransferred bool `json:"can_be_transferred"` + // True, if the gift was transferred to another user; only for the receiver of the gift + WasTransferred bool `json:"was_transferred"` + // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift + TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + ExportDate int32 `json:"export_date"` +} + +func (entity *MessageUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*MessageUpgradedGift) GetClass() string { + return ClassMessageContent +} + +func (*MessageUpgradedGift) GetType() string { + return TypeMessageUpgradedGift +} + +func (*MessageUpgradedGift) MessageContentType() string { + return TypeMessageUpgradedGift +} + +// A gift which purchase, upgrade or transfer were refunded +type MessageRefundedUpgradedGift struct { + meta + // The gift + Gift *Gift `json:"gift"` + // True, if the gift was obtained by upgrading of a previously received gift + IsUpgrade bool `json:"is_upgrade"` +} + +func (entity *MessageRefundedUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageRefundedUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*MessageRefundedUpgradedGift) GetClass() string { + return ClassMessageContent +} + +func (*MessageRefundedUpgradedGift) GetType() string { + return TypeMessageRefundedUpgradedGift +} + +func (*MessageRefundedUpgradedGift) MessageContentType() string { + return TypeMessageRefundedUpgradedGift +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -29108,6 +29794,81 @@ func (*SearchMessagesFilterPinned) SearchMessagesFilterType() string { return TypeSearchMessagesFilterPinned } +// Returns only messages in private chats +type SearchMessagesChatTypeFilterPrivate struct{ + meta +} + +func (entity *SearchMessagesChatTypeFilterPrivate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesChatTypeFilterPrivate + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesChatTypeFilterPrivate) GetClass() string { + return ClassSearchMessagesChatTypeFilter +} + +func (*SearchMessagesChatTypeFilterPrivate) GetType() string { + return TypeSearchMessagesChatTypeFilterPrivate +} + +func (*SearchMessagesChatTypeFilterPrivate) SearchMessagesChatTypeFilterType() string { + return TypeSearchMessagesChatTypeFilterPrivate +} + +// Returns only messages in basic group and supergroup chats +type SearchMessagesChatTypeFilterGroup struct{ + meta +} + +func (entity *SearchMessagesChatTypeFilterGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesChatTypeFilterGroup + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesChatTypeFilterGroup) GetClass() string { + return ClassSearchMessagesChatTypeFilter +} + +func (*SearchMessagesChatTypeFilterGroup) GetType() string { + return TypeSearchMessagesChatTypeFilterGroup +} + +func (*SearchMessagesChatTypeFilterGroup) SearchMessagesChatTypeFilterType() string { + return TypeSearchMessagesChatTypeFilterGroup +} + +// Returns only messages in channel chats +type SearchMessagesChatTypeFilterChannel struct{ + meta +} + +func (entity *SearchMessagesChatTypeFilterChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesChatTypeFilterChannel + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesChatTypeFilterChannel) GetClass() string { + return ClassSearchMessagesChatTypeFilter +} + +func (*SearchMessagesChatTypeFilterChannel) GetType() string { + return TypeSearchMessagesChatTypeFilterChannel +} + +func (*SearchMessagesChatTypeFilterChannel) SearchMessagesChatTypeFilterType() string { + return TypeSearchMessagesChatTypeFilterChannel +} + // The user is typing a message type ChatActionTyping struct{ meta @@ -32615,6 +33376,33 @@ func (*CallDiscardReasonHungUp) CallDiscardReasonType() string { return TypeCallDiscardReasonHungUp } +// The call was ended because it has been used successfully to transfer private encryption key for the associated group call +type CallDiscardReasonAllowGroupCall struct { + meta + // Encrypted using the call private key encryption key for the associated group call + EncryptedGroupCallKey []byte `json:"encrypted_group_call_key"` +} + +func (entity *CallDiscardReasonAllowGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallDiscardReasonAllowGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*CallDiscardReasonAllowGroupCall) GetClass() string { + return ClassCallDiscardReason +} + +func (*CallDiscardReasonAllowGroupCall) GetType() string { + return TypeCallDiscardReasonAllowGroupCall +} + +func (*CallDiscardReasonAllowGroupCall) CallDiscardReasonType() string { + return TypeCallDiscardReasonAllowGroupCall +} + // Specifies the supported call protocols type CallProtocol struct { meta @@ -33666,6 +34454,8 @@ type Call struct { IsVideo bool `json:"is_video"` // Call state State CallState `json:"state"` + // Identifier of the group call associated with the call; 0 if the group call isn't created yet. The group call can be received through the method getGroupCall + GroupCallId int32 `json:"group_call_id"` } func (entity *Call) MarshalJSON() ([]byte, error) { @@ -33691,6 +34481,7 @@ func (call *Call) UnmarshalJSON(data []byte) error { IsOutgoing bool `json:"is_outgoing"` IsVideo bool `json:"is_video"` State json.RawMessage `json:"state"` + GroupCallId int32 `json:"group_call_id"` } err := json.Unmarshal(data, &tmp) @@ -33702,6 +34493,7 @@ func (call *Call) UnmarshalJSON(data []byte) error { call.UserId = tmp.UserId call.IsOutgoing = tmp.IsOutgoing call.IsVideo = tmp.IsVideo + call.GroupCallId = tmp.GroupCallId fieldState, _ := UnmarshalCallState(tmp.State) call.State = fieldState @@ -34811,8 +35603,6 @@ type InputInlineQueryResultArticle struct { Id string `json:"id"` // URL of the result, if it exists Url string `json:"url"` - // True, if the URL must be not shown - HideUrl bool `json:"hide_url"` // Title of the result Title string `json:"title"` // A short description of the result @@ -34853,7 +35643,6 @@ func (inputInlineQueryResultArticle *InputInlineQueryResultArticle) UnmarshalJSO var tmp struct { Id string `json:"id"` Url string `json:"url"` - HideUrl bool `json:"hide_url"` Title string `json:"title"` Description string `json:"description"` ThumbnailUrl string `json:"thumbnail_url"` @@ -34870,7 +35659,6 @@ func (inputInlineQueryResultArticle *InputInlineQueryResultArticle) UnmarshalJSO inputInlineQueryResultArticle.Id = tmp.Id inputInlineQueryResultArticle.Url = tmp.Url - inputInlineQueryResultArticle.HideUrl = tmp.HideUrl inputInlineQueryResultArticle.Title = tmp.Title inputInlineQueryResultArticle.Description = tmp.Description inputInlineQueryResultArticle.ThumbnailUrl = tmp.ThumbnailUrl @@ -35615,8 +36403,6 @@ type InlineQueryResultArticle struct { Id string `json:"id"` // URL of the result, if it exists Url string `json:"url"` - // True, if the URL must be not shown - HideUrl bool `json:"hide_url"` // Title of the result Title string `json:"title"` // A short description of the result @@ -42661,6 +43447,33 @@ func (*PushMessageContentGift) PushMessageContentType() string { return TypePushMessageContentGift } +// A message with an upgraded gift +type PushMessageContentUpgradedGift struct { + meta + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift + IsUpgrade bool `json:"is_upgrade"` +} + +func (entity *PushMessageContentUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentUpgradedGift) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentUpgradedGift) GetType() string { + return TypePushMessageContentUpgradedGift +} + +func (*PushMessageContentUpgradedGift) PushMessageContentType() string { + return TypePushMessageContentUpgradedGift +} + // A screenshot of a message in the chat has been taken type PushMessageContentScreenshotTaken struct{ meta @@ -49580,6 +50393,31 @@ func (*SuggestedActionSetBirthdate) SuggestedActionType() string { return TypeSuggestedActionSetBirthdate } +// Suggests the user to set profile photo +type SuggestedActionSetProfilePhoto struct{ + meta +} + +func (entity *SuggestedActionSetProfilePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionSetProfilePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionSetProfilePhoto) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionSetProfilePhoto) GetType() string { + return TypeSuggestedActionSetProfilePhoto +} + +func (*SuggestedActionSetProfilePhoto) SuggestedActionType() string { + return TypeSuggestedActionSetProfilePhoto +} + // Suggests the user to extend their expiring Telegram Premium subscription type SuggestedActionExtendPremium struct { meta @@ -51187,7 +52025,7 @@ func (*VectorPathCommandLine) VectorPathCommandType() string { return TypeVectorPathCommandLine } -// A cubic Bézier curve to a given point +// A cubic Bézier curve to a given point type VectorPathCommandCubicBezierCurve struct { meta // The start control point of the curve diff --git a/client/unmarshaler.go b/client/unmarshaler.go index ec11136..4d60653 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -693,6 +693,43 @@ func UnmarshalListOfStarSubscriptionType(dataList []json.RawMessage) ([]StarSubs return list, nil } +func UnmarshalAffiliateType(data json.RawMessage) (AffiliateType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeAffiliateTypeCurrentUser: + return UnmarshalAffiliateTypeCurrentUser(data) + + case TypeAffiliateTypeBot: + return UnmarshalAffiliateTypeBot(data) + + case TypeAffiliateTypeChannel: + return UnmarshalAffiliateTypeChannel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfAffiliateType(dataList []json.RawMessage) ([]AffiliateType, error) { + list := []AffiliateType{} + + for _, data := range dataList { + entity, err := UnmarshalAffiliateType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalAffiliateProgramSortOrder(data json.RawMessage) (AffiliateProgramSortOrder, error) { var meta meta @@ -730,6 +767,40 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalSentGift(data json.RawMessage) (SentGift, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSentGiftRegular: + return UnmarshalSentGiftRegular(data) + + case TypeSentGiftUpgraded: + return UnmarshalSentGiftUpgraded(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSentGift(dataList []json.RawMessage) ([]SentGift, error) { + list := []SentGift{} + + for _, data := range dataList { + entity, err := UnmarshalSentGift(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { var meta meta @@ -833,9 +904,15 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeGiftPurchase: return UnmarshalStarTransactionTypeGiftPurchase(data) + case TypeStarTransactionTypeGiftTransfer: + return UnmarshalStarTransactionTypeGiftTransfer(data) + case TypeStarTransactionTypeGiftSale: return UnmarshalStarTransactionTypeGiftSale(data) + case TypeStarTransactionTypeGiftUpgrade: + return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeChannelPaidReactionSend: return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) @@ -3341,6 +3418,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageGift: return UnmarshalMessageGift(data) + case TypeMessageUpgradedGift: + return UnmarshalMessageUpgradedGift(data) + + case TypeMessageRefundedUpgradedGift: + return UnmarshalMessageRefundedUpgradedGift(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -3753,6 +3836,43 @@ func UnmarshalListOfSearchMessagesFilter(dataList []json.RawMessage) ([]SearchMe return list, nil } +func UnmarshalSearchMessagesChatTypeFilter(data json.RawMessage) (SearchMessagesChatTypeFilter, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSearchMessagesChatTypeFilterPrivate: + return UnmarshalSearchMessagesChatTypeFilterPrivate(data) + + case TypeSearchMessagesChatTypeFilterGroup: + return UnmarshalSearchMessagesChatTypeFilterGroup(data) + + case TypeSearchMessagesChatTypeFilterChannel: + return UnmarshalSearchMessagesChatTypeFilterChannel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSearchMessagesChatTypeFilter(dataList []json.RawMessage) ([]SearchMessagesChatTypeFilter, error) { + list := []SearchMessagesChatTypeFilter{} + + for _, data := range dataList { + entity, err := UnmarshalSearchMessagesChatTypeFilter(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatAction(data json.RawMessage) (ChatAction, error) { var meta meta @@ -4346,6 +4466,9 @@ func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) case TypeCallDiscardReasonHungUp: return UnmarshalCallDiscardReasonHungUp(data) + case TypeCallDiscardReasonAllowGroupCall: + return UnmarshalCallDiscardReasonAllowGroupCall(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6081,6 +6204,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentGift: return UnmarshalPushMessageContentGift(data) + case TypePushMessageContentUpgradedGift: + return UnmarshalPushMessageContentUpgradedGift(data) + case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -7333,6 +7459,9 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionSetBirthdate: return UnmarshalSuggestedActionSetBirthdate(data) + case TypeSuggestedActionSetProfilePhoto: + return UnmarshalSuggestedActionSetProfilePhoto(data) + case TypeSuggestedActionExtendPremium: return UnmarshalSuggestedActionExtendPremium(data) @@ -9078,6 +9207,30 @@ func UnmarshalBotMenuButton(data json.RawMessage) (*BotMenuButton, error) { return &resp, err } +func UnmarshalBotVerificationParameters(data json.RawMessage) (*BotVerificationParameters, error) { + var resp BotVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotVerification(data json.RawMessage) (*BotVerification, error) { + var resp BotVerification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVerificationStatus(data json.RawMessage) (*VerificationStatus, error) { + var resp VerificationStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatLocation(data json.RawMessage) (*ChatLocation, error) { var resp ChatLocation @@ -9382,6 +9535,30 @@ func UnmarshalStarSubscriptions(data json.RawMessage) (*StarSubscriptions, error return &resp, err } +func UnmarshalAffiliateTypeCurrentUser(data json.RawMessage) (*AffiliateTypeCurrentUser, error) { + var resp AffiliateTypeCurrentUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateTypeBot(data json.RawMessage) (*AffiliateTypeBot, error) { + var resp AffiliateTypeBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateTypeChannel(data json.RawMessage) (*AffiliateTypeChannel, error) { + var resp AffiliateTypeChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAffiliateProgramSortOrderProfitability(data json.RawMessage) (*AffiliateProgramSortOrderProfitability, error) { var resp AffiliateProgramSortOrderProfitability @@ -9446,16 +9623,16 @@ func UnmarshalFoundAffiliatePrograms(data json.RawMessage) (*FoundAffiliateProgr return &resp, err } -func UnmarshalChatAffiliateProgram(data json.RawMessage) (*ChatAffiliateProgram, error) { - var resp ChatAffiliateProgram +func UnmarshalConnectedAffiliateProgram(data json.RawMessage) (*ConnectedAffiliateProgram, error) { + var resp ConnectedAffiliateProgram err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatAffiliatePrograms(data json.RawMessage) (*ChatAffiliatePrograms, error) { - var resp ChatAffiliatePrograms +func UnmarshalConnectedAffiliatePrograms(data json.RawMessage) (*ConnectedAffiliatePrograms, error) { + var resp ConnectedAffiliatePrograms err := json.Unmarshal(data, &resp) @@ -9550,6 +9727,38 @@ func UnmarshalStarGiveawayPaymentOptions(data json.RawMessage) (*StarGiveawayPay return &resp, err } +func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { + var resp UpgradedGiftModel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftSymbol(data json.RawMessage) (*UpgradedGiftSymbol, error) { + var resp UpgradedGiftSymbol + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftBackdrop(data json.RawMessage) (*UpgradedGiftBackdrop, error) { + var resp UpgradedGiftBackdrop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginalDetails(data json.RawMessage) (*UpgradedGiftOriginalDetails, error) { + var resp UpgradedGiftOriginalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalGift(data json.RawMessage) (*Gift, error) { var resp Gift @@ -9566,6 +9775,38 @@ func UnmarshalGifts(data json.RawMessage) (*Gifts, error) { return &resp, err } +func UnmarshalUpgradedGift(data json.RawMessage) (*UpgradedGift, error) { + var resp UpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradeGiftResult(data json.RawMessage) (*UpgradeGiftResult, error) { + var resp UpgradeGiftResult + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSentGiftRegular(data json.RawMessage) (*SentGiftRegular, error) { + var resp SentGiftRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSentGiftUpgraded(data json.RawMessage) (*SentGiftUpgraded, error) { + var resp SentGiftUpgraded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserGift(data json.RawMessage) (*UserGift, error) { var resp UserGift @@ -9582,6 +9823,14 @@ func UnmarshalUserGifts(data json.RawMessage) (*UserGifts, error) { return &resp, err } +func UnmarshalGiftUpgradePreview(data json.RawMessage) (*GiftUpgradePreview, error) { + var resp GiftUpgradePreview + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionDirectionIncoming(data json.RawMessage) (*StarTransactionDirectionIncoming, error) { var resp StarTransactionDirectionIncoming @@ -9758,6 +10007,14 @@ func UnmarshalStarTransactionTypeGiftPurchase(data json.RawMessage) (*StarTransa return &resp, err } +func UnmarshalStarTransactionTypeGiftTransfer(data json.RawMessage) (*StarTransactionTypeGiftTransfer, error) { + var resp StarTransactionTypeGiftTransfer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeGiftSale(data json.RawMessage) (*StarTransactionTypeGiftSale, error) { var resp StarTransactionTypeGiftSale @@ -9766,6 +10023,14 @@ func UnmarshalStarTransactionTypeGiftSale(data json.RawMessage) (*StarTransactio return &resp, err } +func UnmarshalStarTransactionTypeGiftUpgrade(data json.RawMessage) (*StarTransactionTypeGiftUpgrade, error) { + var resp StarTransactionTypeGiftUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeChannelPaidReactionSend(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionSend, error) { var resp StarTransactionTypeChannelPaidReactionSend @@ -11054,6 +11319,14 @@ func UnmarshalChatFolderIcon(data json.RawMessage) (*ChatFolderIcon, error) { return &resp, err } +func UnmarshalChatFolderName(data json.RawMessage) (*ChatFolderName, error) { + var resp ChatFolderName + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatFolder(data json.RawMessage) (*ChatFolder, error) { var resp ChatFolder @@ -13838,6 +14111,22 @@ func UnmarshalMessageGift(data json.RawMessage) (*MessageGift, error) { return &resp, err } +func UnmarshalMessageUpgradedGift(data json.RawMessage) (*MessageUpgradedGift, error) { + var resp MessageUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageRefundedUpgradedGift(data json.RawMessage) (*MessageRefundedUpgradedGift, error) { + var resp MessageRefundedUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -14478,6 +14767,30 @@ func UnmarshalSearchMessagesFilterPinned(data json.RawMessage) (*SearchMessagesF return &resp, err } +func UnmarshalSearchMessagesChatTypeFilterPrivate(data json.RawMessage) (*SearchMessagesChatTypeFilterPrivate, error) { + var resp SearchMessagesChatTypeFilterPrivate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesChatTypeFilterGroup(data json.RawMessage) (*SearchMessagesChatTypeFilterGroup, error) { + var resp SearchMessagesChatTypeFilterGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesChatTypeFilterChannel(data json.RawMessage) (*SearchMessagesChatTypeFilterChannel, error) { + var resp SearchMessagesChatTypeFilterChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatActionTyping(data json.RawMessage) (*ChatActionTyping, error) { var resp ChatActionTyping @@ -15318,6 +15631,14 @@ func UnmarshalCallDiscardReasonHungUp(data json.RawMessage) (*CallDiscardReasonH return &resp, err } +func UnmarshalCallDiscardReasonAllowGroupCall(data json.RawMessage) (*CallDiscardReasonAllowGroupCall, error) { + var resp CallDiscardReasonAllowGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallProtocol(data json.RawMessage) (*CallProtocol, error) { var resp CallProtocol @@ -17838,6 +18159,14 @@ func UnmarshalPushMessageContentGift(data json.RawMessage) (*PushMessageContentG return &resp, err } +func UnmarshalPushMessageContentUpgradedGift(data json.RawMessage) (*PushMessageContentUpgradedGift, error) { + var resp PushMessageContentUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentScreenshotTaken(data json.RawMessage) (*PushMessageContentScreenshotTaken, error) { var resp PushMessageContentScreenshotTaken @@ -19814,6 +20143,14 @@ func UnmarshalSuggestedActionSetBirthdate(data json.RawMessage) (*SuggestedActio return &resp, err } +func UnmarshalSuggestedActionSetProfilePhoto(data json.RawMessage) (*SuggestedActionSetProfilePhoto, error) { + var resp SuggestedActionSetProfilePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSuggestedActionExtendPremium(data json.RawMessage) (*SuggestedActionExtendPremium, error) { var resp SuggestedActionExtendPremium @@ -21895,6 +22232,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBotMenuButton: return UnmarshalBotMenuButton(data) + case TypeBotVerificationParameters: + return UnmarshalBotVerificationParameters(data) + + case TypeBotVerification: + return UnmarshalBotVerification(data) + + case TypeVerificationStatus: + return UnmarshalVerificationStatus(data) + case TypeChatLocation: return UnmarshalChatLocation(data) @@ -22009,6 +22355,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarSubscriptions: return UnmarshalStarSubscriptions(data) + case TypeAffiliateTypeCurrentUser: + return UnmarshalAffiliateTypeCurrentUser(data) + + case TypeAffiliateTypeBot: + return UnmarshalAffiliateTypeBot(data) + + case TypeAffiliateTypeChannel: + return UnmarshalAffiliateTypeChannel(data) + case TypeAffiliateProgramSortOrderProfitability: return UnmarshalAffiliateProgramSortOrderProfitability(data) @@ -22033,11 +22388,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFoundAffiliatePrograms: return UnmarshalFoundAffiliatePrograms(data) - case TypeChatAffiliateProgram: - return UnmarshalChatAffiliateProgram(data) + case TypeConnectedAffiliateProgram: + return UnmarshalConnectedAffiliateProgram(data) - case TypeChatAffiliatePrograms: - return UnmarshalChatAffiliatePrograms(data) + case TypeConnectedAffiliatePrograms: + return UnmarshalConnectedAffiliatePrograms(data) case TypeProductInfo: return UnmarshalProductInfo(data) @@ -22072,18 +22427,45 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarGiveawayPaymentOptions: return UnmarshalStarGiveawayPaymentOptions(data) + case TypeUpgradedGiftModel: + return UnmarshalUpgradedGiftModel(data) + + case TypeUpgradedGiftSymbol: + return UnmarshalUpgradedGiftSymbol(data) + + case TypeUpgradedGiftBackdrop: + return UnmarshalUpgradedGiftBackdrop(data) + + case TypeUpgradedGiftOriginalDetails: + return UnmarshalUpgradedGiftOriginalDetails(data) + case TypeGift: return UnmarshalGift(data) case TypeGifts: return UnmarshalGifts(data) + case TypeUpgradedGift: + return UnmarshalUpgradedGift(data) + + case TypeUpgradeGiftResult: + return UnmarshalUpgradeGiftResult(data) + + case TypeSentGiftRegular: + return UnmarshalSentGiftRegular(data) + + case TypeSentGiftUpgraded: + return UnmarshalSentGiftUpgraded(data) + case TypeUserGift: return UnmarshalUserGift(data) case TypeUserGifts: return UnmarshalUserGifts(data) + case TypeGiftUpgradePreview: + return UnmarshalGiftUpgradePreview(data) + case TypeStarTransactionDirectionIncoming: return UnmarshalStarTransactionDirectionIncoming(data) @@ -22150,9 +22532,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeGiftPurchase: return UnmarshalStarTransactionTypeGiftPurchase(data) + case TypeStarTransactionTypeGiftTransfer: + return UnmarshalStarTransactionTypeGiftTransfer(data) + case TypeStarTransactionTypeGiftSale: return UnmarshalStarTransactionTypeGiftSale(data) + case TypeStarTransactionTypeGiftUpgrade: + return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeChannelPaidReactionSend: return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) @@ -22636,6 +23024,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatFolderIcon: return UnmarshalChatFolderIcon(data) + case TypeChatFolderName: + return UnmarshalChatFolderName(data) + case TypeChatFolder: return UnmarshalChatFolder(data) @@ -23680,6 +24071,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageGift: return UnmarshalMessageGift(data) + case TypeMessageUpgradedGift: + return UnmarshalMessageUpgradedGift(data) + + case TypeMessageRefundedUpgradedGift: + return UnmarshalMessageRefundedUpgradedGift(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -23920,6 +24317,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSearchMessagesFilterPinned: return UnmarshalSearchMessagesFilterPinned(data) + case TypeSearchMessagesChatTypeFilterPrivate: + return UnmarshalSearchMessagesChatTypeFilterPrivate(data) + + case TypeSearchMessagesChatTypeFilterGroup: + return UnmarshalSearchMessagesChatTypeFilterGroup(data) + + case TypeSearchMessagesChatTypeFilterChannel: + return UnmarshalSearchMessagesChatTypeFilterChannel(data) + case TypeChatActionTyping: return UnmarshalChatActionTyping(data) @@ -24235,6 +24641,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCallDiscardReasonHungUp: return UnmarshalCallDiscardReasonHungUp(data) + case TypeCallDiscardReasonAllowGroupCall: + return UnmarshalCallDiscardReasonAllowGroupCall(data) + case TypeCallProtocol: return UnmarshalCallProtocol(data) @@ -25180,6 +25589,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentGift: return UnmarshalPushMessageContentGift(data) + case TypePushMessageContentUpgradedGift: + return UnmarshalPushMessageContentUpgradedGift(data) + case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -25921,6 +26333,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionSetBirthdate: return UnmarshalSuggestedActionSetBirthdate(data) + case TypeSuggestedActionSetProfilePhoto: + return UnmarshalSuggestedActionSetProfilePhoto(data) + case TypeSuggestedActionExtendPremium: return UnmarshalSuggestedActionExtendPremium(data) diff --git a/data/td_api.tl b/data/td_api.tl index 1512e66..9a83811 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -608,6 +608,27 @@ botCommands bot_user_id:int53 commands:vector = BotCommands; botMenuButton text:string url:string = BotMenuButton; +//@description Describes parameters of verification that is provided by a bot +//@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign +//@organization_name Name of the organization that provides verification +//@default_custom_description Default custom description of verification reason to be used as placeholder in setMessageSenderBotVerification; may be null if none +//@can_set_custom_description True, if the bot is allowed to provide custom description for verified entities +botVerificationParameters icon_custom_emoji_id:int64 organization_name:string default_custom_description:formattedText can_set_custom_description:Bool = BotVerificationParameters; + +//@description Describes verification status provided by a bot +//@bot_user_id Identifier of the bot that provided the verification +//@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign +//@custom_description Custom description of verification reason set by the bot +botVerification bot_user_id:int53 icon_custom_emoji_id:int64 custom_description:formattedText = BotVerification; + +//@description Contains information about verification status of a chat or a user +//@is_verified True, if the chat or the user is verified by Telegram +//@is_scam True, if the chat or the user is marked as scam by Telegram +//@is_fake True, if the chat or the user is marked as fake by Telegram +//@bot_verification_icon_custom_emoji_id Identifier of the custom emoji to be shown as verification sign provided by a bot for the user; 0 if none +verificationStatus is_verified:Bool is_scam:Bool is_fake:Bool bot_verification_icon_custom_emoji_id:int64 = VerificationStatus; + + //@description Represents a location to which a chat is connected @location The location @address Location address; 1-64 characters, as defined by the chat owner chatLocation location:location address:string = ChatLocation; @@ -857,6 +878,18 @@ starSubscription id:string chat_id:int53 expiration_date:int32 is_canceled:Bool starSubscriptions star_amount:starAmount subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; +//@class AffiliateType @description Describes type of affiliate for an affiliate program + +//@description The affiliate is the current user +affiliateTypeCurrentUser = AffiliateType; + +//@description The affiliate is a bot owned by the current user @user_id User identifier of the bot +affiliateTypeBot user_id:int53 = AffiliateType; + +//@description The affiliate is a channel chat where the current user has can_post_messages administrator right @chat_id Identifier of the channel chat +affiliateTypeChannel chat_id:int53 = AffiliateType; + + //@class AffiliateProgramSortOrder @description Describes the order of the found affiliate programs //@description The affiliate programs must be sorted by the profitability @@ -878,7 +911,7 @@ affiliateProgramParameters commission_per_mille:int32 month_count:int32 = Affili //@description Contains information about an active affiliate program //@parameters Parameters of the affiliate program //@end_date Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. -//-If positive, then the program can't be connected using connectChatAffiliateProgram, but active connections will work until the date +//-If positive, then the program can't be connected using connectAffiliateProgram, but active connections will work until the date //@daily_revenue_per_user_amount The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program affiliateProgramInfo parameters:affiliateProgramParameters end_date:int32 daily_revenue_per_user_amount:starAmount = AffiliateProgramInfo; @@ -890,8 +923,8 @@ affiliateInfo commission_per_mille:int32 affiliate_chat_id:int53 star_amount:sta //@description Describes a found affiliate program //@bot_user_id User identifier of the bot created the program -//@parameters Information about the affiliate program -foundAffiliateProgram bot_user_id:int53 parameters:affiliateProgramInfo = FoundAffiliateProgram; +//@info Information about the affiliate program +foundAffiliateProgram bot_user_id:int53 info:affiliateProgramInfo = FoundAffiliateProgram; //@description Represents a list of found affiliate programs //@total_count The total number of found affiliate programs @@ -899,7 +932,7 @@ foundAffiliateProgram bot_user_id:int53 parameters:affiliateProgramInfo = FoundA //@next_offset The offset for the next request. If empty, then there are no more results foundAffiliatePrograms total_count:int32 programs:vector next_offset:string = FoundAffiliatePrograms; -//@description Describes an affiliate program that was connected to a chat +//@description Describes an affiliate program that was connected to an affiliate //@url The link that can be used to refer users if the program is still active //@bot_user_id User identifier of the bot created the program //@parameters The parameters of the affiliate program @@ -907,13 +940,13 @@ foundAffiliatePrograms total_count:int32 programs:vector //@is_disconnected True, if the program was canceled by the bot, or disconnected by the chat owner and isn't available anymore //@user_count The number of users that used the affiliate program //@revenue_star_count The number of Telegram Stars that were earned by the affiliate program -chatAffiliateProgram url:string bot_user_id:int53 parameters:affiliateProgramParameters connection_date:int32 is_disconnected:Bool user_count:int64 revenue_star_count:int64 = ChatAffiliateProgram; +connectedAffiliateProgram url:string bot_user_id:int53 parameters:affiliateProgramParameters connection_date:int32 is_disconnected:Bool user_count:int64 revenue_star_count:int64 = ConnectedAffiliateProgram; -//@description Represents a list of affiliate programs that were connected to a chat -//@total_count The total number of affiliate programs that were connected to the chat +//@description Represents a list of affiliate programs that were connected to an affiliate +//@total_count The total number of affiliate programs that were connected to the affiliate //@programs The list of connected affiliate programs //@next_offset The offset for the next request. If empty, then there are no more results -chatAffiliatePrograms total_count:int32 programs:vector next_offset:string = ChatAffiliatePrograms; +connectedAffiliatePrograms total_count:int32 programs:vector next_offset:string = ConnectedAffiliatePrograms; //@description Contains information about a product that can be paid with invoice @@ -994,31 +1027,98 @@ 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 model of an upgraded gift +//@name Name of the model +//@sticker The sticker representing the upgraded gift +//@rarity_per_mille The number of upgraded gift that receive this model for each 1000 gifts upgraded +upgradedGiftModel name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftModel; + +//@description Describes a symbol shown on the pattern of an upgraded gift +//@name Name of the symbol +//@sticker The sticker representing the upgraded gift +//@rarity_per_mille The number of upgraded gift that receive this symbol for each 1000 gifts upgraded +upgradedGiftSymbol name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftSymbol; + +//@description Describes a backdrop of an upgraded gift +//@name Name of the backdrop +//@center_color A color in the center of the backdrop in the RGB format +//@edge_color A color on the edges of the backdrop in the RGB format +//@symbol_color A color to be applied for the symbol in the RGB format +//@text_color A color for the text on the backdrop in the RGB format +//@rarity_per_mille The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded +upgradedGiftBackdrop name:string center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 rarity_per_mille:int32 = UpgradedGiftBackdrop; + +//@description Describes the original details about the gift +//@sender_user_id Identifier of the user that sent the gift; 0 if the gift was private +//@receiver_user_id Identifier of the user that received the gift +//@text Message added to the gift +//@date Point in time (Unix timestamp) when the gift was sent +upgradedGiftOriginalDetails sender_user_id:int53 receiver_user_id:int53 text:formattedText date:int32 = UpgradedGiftOriginalDetails; + //@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 +//@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed +//@upgrade_star_count Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible //@is_for_birthday True, if the gift is a birthday gift //@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out //@total_count Number of total times the gift can be purchased by all users; 0 if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date: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 Describes an upgraded gift that can be gifted to another user or transferred to TON blockchain as an NFT +//@id Unique identifier of the gift +//@title The title of the upgraded gift +//@number Unique number of the upgraded gift among gifts upgraded from the same gift +//@total_upgraded_count Total number of gifts that were upgraded from the same gift +//@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift +//@owner_user_id User identifier of the user that owns the upgraded gift; 0 if none +//@model Model of the upgraded gift +//@symbol Symbol of the upgraded gift +//@backdrop Backdrop of the upgraded gift +//@original_details Information about the originally sent gift; may be null if unknown +upgradedGift id:int64 title:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_user_id:int53 model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; + +//@description Contains result of gift upgrading +//@gift The upgraded gift +//@is_saved True, if the gift is displayed on the user's profile page +//@can_be_transferred True, if the gift can be transferred to another user +//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT +upgradeGiftResult gift:upgradedGift is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; + + +//@class SentGift @description Represents a gift received by a user + +//@description Regular gift @gift The gift +sentGiftRegular gift:gift = SentGift; + +//@description Upgraded gift @gift The gift +sentGiftUpgraded gift:upgradedGift = SentGift; + + //@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 +//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@can_be_upgraded True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift +//@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another user; only for the receiver of the gift +//@was_refunded True, if the gift was refunded and isn't available anymore //@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; 0 if the gift can't be sold by the current user -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; +//@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 receiver of the gift +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user +//@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift +//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +userGift sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift message_id:int53 sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = UserGift; //@description Represents a list of gifts received by a user //@total_count The total number of received gifts @@ -1026,6 +1126,12 @@ userGift sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool d //@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; +//@description Contains examples of possible upgraded gifts for the given regular gift +//@models Examples of possible models that can be chosen for the gift after upgrade +//@symbols Examples of possible symbols that can be chosen for the gift after upgrade +//@backdrops Examples of possible backdrops that can be chosen for the gift after upgrade +giftUpgradePreview models:vector symbols:vector backdrops:vector = GiftUpgradePreview; + //@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars @@ -1129,12 +1235,18 @@ starTransactionTypeChannelSubscriptionPurchase chat_id:int53 subscription_period //@subscription_period The number of seconds between consecutive Telegram Star debitings starTransactionTypeChannelSubscriptionSale user_id:int53 subscription_period:int32 = StarTransactionType; -//@description The transaction is a purchase of a gift to another user; for regular users and bots only @user_id Identifier of the user that received the gift @gift The gift +//@description The transaction is a purchase of a regular gift to another user; for regular users and bots only @user_id Identifier of the user that received the gift @gift The gift starTransactionTypeGiftPurchase user_id:int53 gift:gift = StarTransactionType; +//@description The transaction is a transfer of an upgraded gift to another user; for regular users only @user_id Identifier of the user that received the gift @gift The gift +starTransactionTypeGiftTransfer user_id:int53 gift:upgradedGift = StarTransactionType; + //@description The transaction is a sale of a gift received from another user or bot; for regular users only @user_id Identifier of the user that sent the gift @gift The gift starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; +//@description The transaction is an upgrade of a gift; for regular users only @gift The upgraded gift +starTransactionTypeGiftUpgrade gift:upgradedGift = StarTransactionType; + //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat //@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message @@ -1272,12 +1384,10 @@ usernames active_usernames:vector disabled_usernames:vector edit //@is_contact The user is a contact of the current user //@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user //@is_close_friend The user is a close friend of the current user; implies that the user is a contact -//@is_verified True, if the user is verified +//@verification_status Information about verification status of the user; may be null if none //@is_premium True, if the user is a Telegram Premium user //@is_support True, if the user is Telegram support account //@restriction_reason If non-empty, it contains a human-readable description of the reason why access to this user must be restricted -//@is_scam True, if many users reported this user as a scam -//@is_fake True, if many users reported this user as a fake account //@has_active_stories True, if the user has non-expired stories available to the current user //@has_unread_active_stories True, if the user has unread non-expired stories available to the current user //@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them @@ -1285,7 +1395,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -1303,6 +1413,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@web_app_background_dark_color Default dark background color for bot Web Apps; -1 if not specified //@web_app_header_light_color Default light header color for bot Web Apps; -1 if not specified //@web_app_header_dark_color Default dark header color for bot Web Apps; -1 if not specified +//@verification_parameters Parameters of the verification that can be provided by the bot; may be null if none or the current user isn't the owner of the bot //@can_get_revenue_statistics True, if the bot's revenue statistics are available to the current user //@can_manage_emoji_status True, if the bot can manage emoji status of the current user //@has_media_previews True, if the bot has media previews @@ -1310,7 +1421,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights affiliate_program:affiliateProgramInfo web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights affiliate_program:affiliateProgramInfo web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 verification_parameters:botVerificationParameters can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -1334,9 +1445,10 @@ botInfo short_description:string description:string photo:photo animation:animat //@personal_chat_id Identifier of the personal chat of the user; 0 if none //@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 +//@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown //@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 gift_count:int32 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 gift_count:int32 group_in_common_count:int32 bot_verification:botVerification 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; @@ -1518,10 +1630,8 @@ chatInviteLinkSubscriptionInfo pricing:starSubscriptionPricing can_reuse:Bool fo //@subscription_info Information about subscription plan that must be paid by the user to use the link; may be null if the link doesn't require subscription //@creates_join_request True, if the link only creates join request //@is_public True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup -//@is_verified True, if the chat is verified -//@is_scam True, if many users reported this chat as a scam -//@is_fake True, if many users reported this chat as a fake account -chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector subscription_info:chatInviteLinkSubscriptionInfo creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; +//@verification_status Information about verification status of the chat; may be null if none +chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector subscription_info:chatInviteLinkSubscriptionInfo creates_join_request:Bool is_public:Bool verification_status:verificationStatus = ChatInviteLinkInfo; //@description Describes a user that sent a join request and waits for administrator approval @user_id User identifier @date Point in time (Unix timestamp) when the user sent the join request @bio A short bio of the user @@ -1536,12 +1646,11 @@ chatJoinRequestsInfo total_count:int32 user_ids:vector = ChatJoinRequests //@description Represents a basic group of 0-200 users (must be upgraded to a supergroup to accommodate more than 200 users) //@id Group identifier -//@access_hash Group access hash //@member_count Number of members in the group //@status Status of the current user in the group //@is_active True, if the group is active //@upgraded_to_supergroup_id Identifier of the supergroup to which this group was upgraded; 0 if none -basicGroup id:int53 access_hash:int64 member_count:int32 status:ChatMemberStatus is_active:Bool upgraded_to_supergroup_id:int53 = BasicGroup; +basicGroup id:int53 member_count:int32 status:ChatMemberStatus is_active:Bool upgraded_to_supergroup_id:int53 = BasicGroup; //@description Contains full information about a basic group //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1578,14 +1687,12 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@is_channel True, if the supergroup is a channel //@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members //@is_forum True, if the supergroup is a forum with topics -//@is_verified True, if the supergroup or channel is verified +//@verification_status Information about verification status of the supergroup or channel; may be null if none //@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted -//@is_scam True, if many users reported this supergroup or channel as a scam -//@is_fake True, if many users reported this supergroup or channel as a fake account //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool has_sensitive_content:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1620,9 +1727,10 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@location Location to which the supergroup is connected; may be null if none //@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only //@bot_commands List of commands of bots in the group +//@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -2140,8 +2248,13 @@ chatTypeSecret secret_chat_id:int32 user_id:int53 = ChatType; //-"Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work", "Airplane", "Book", "Light", "Like", "Money", "Note", "Palette" chatFolderIcon name:string = ChatFolderIcon; +//@description Describes name of a chat folder +//@text The text of the chat folder name; 1-12 characters without line feeds. May contain only CustomEmoji entities +//@animate_custom_emoji True, if custom emoji in the name must be animated +chatFolderName text:formattedText animate_custom_emoji:Bool = ChatFolderName; + //@description Represents a folder for user chats -//@title The title of the folder; 1-12 characters without line feeds +//@name The name of the folder //@icon The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder //@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription //@is_shareable True, if at least one link has been created for the folder @@ -2156,16 +2269,16 @@ chatFolderIcon name:string = ChatFolderIcon; //@include_bots True, if bots need to be included //@include_groups True, if basic groups and supergroups need to be included //@include_channels True, if channels need to be included -chatFolder title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; +chatFolder name:chatFolderName icon:chatFolderIcon color_id:int32 is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; //@description Contains basic information about a chat folder //@id Unique chat folder identifier -//@title The title of the folder; 1-12 characters without line feeds +//@name The name of the folder //@icon The chosen or default icon for the chat folder //@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled //@is_shareable True, if at least one link has been created for the folder //@has_my_invite_links True, if the chat folder has invite links created by the current user -chatFolderInfo id:int32 title:string icon:chatFolderIcon color_id:int32 is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; +chatFolderInfo id:int32 name:chatFolderName icon:chatFolderIcon color_id:int32 is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; //@description Contains a chat folder invite link //@invite_link The chat folder invite link @@ -3890,14 +4003,33 @@ 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 +//@description A regular 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; 0 if the gift can't be sold by the receiver +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver +//@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade 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 +//@can_be_upgraded True, if the gift can be upgraded to a unique gift; 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; +//@was_upgraded True, if the gift was upgraded to a unique gift +//@was_refunded True, if the gift was refunded and isn't available anymore +//@upgrade_message_id Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift with upgraded version of the gift; can be 0 if none or an identifier of a deleted message. +//-Use getUserGift to get information about the gift +messageGift gift:gift text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgrade_message_id:int53 = MessageContent; + +//@description An upgraded gift was received or sent by the current user +//@gift The gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@can_be_transferred True, if the gift can be transferred to another user; only for the receiver of the gift +//@was_transferred True, if the gift was transferred to another user; only for the receiver of the gift +//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +messageUpgradedGift gift:upgradedGift is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; + +//@description A gift which purchase, upgrade or transfer were refunded @gift The gift @is_upgrade True, if the gift was obtained by upgrading of a previously received gift +messageRefundedUpgradedGift gift:gift is_upgrade:Bool = MessageContent; //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4308,6 +4440,18 @@ searchMessagesFilterFailedToSend = SearchMessagesFilter; searchMessagesFilterPinned = SearchMessagesFilter; +//@class SearchMessagesChatTypeFilter @description Represents a filter for type of the chats in which to search messages + +//@description Returns only messages in private chats +searchMessagesChatTypeFilterPrivate = SearchMessagesChatTypeFilter; + +//@description Returns only messages in basic group and supergroup chats +searchMessagesChatTypeFilterGroup = SearchMessagesChatTypeFilter; + +//@description Returns only messages in channel chats +searchMessagesChatTypeFilterChannel = SearchMessagesChatTypeFilter; + + //@class ChatAction @description Describes the different types of activity in a chat //@description The user is typing a message @@ -4898,6 +5042,10 @@ callDiscardReasonDisconnected = CallDiscardReason; //@description The call was ended because one of the parties hung up callDiscardReasonHungUp = CallDiscardReason; +//@description The call was ended because it has been used successfully to transfer private encryption key for the associated group call +//@encrypted_group_call_key Encrypted using the call private key encryption key for the associated group call +callDiscardReasonAllowGroupCall encrypted_group_call_key:bytes = CallDiscardReason; + //@description Specifies the supported call protocols //@udp_p2p True, if UDP peer-to-peer connections are supported @@ -5088,7 +5236,8 @@ callProblemPixelatedVideo = CallProblem; //@is_outgoing True, if the call is outgoing //@is_video True, if the call is a video call //@state Call state -call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState = Call; +//@group_call_id Identifier of the group call associated with the call; 0 if the group call isn't created yet. The group call can be received through the method getGroupCall +call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState group_call_id:int32 = Call; //@class FirebaseAuthenticationSettings @description Contains settings for Firebase Authentication in the official applications @@ -5297,7 +5446,6 @@ inputInlineQueryResultAnimation id:string title:string thumbnail_url:string thum //@description Represents a link to an article or web page //@id Unique identifier of the query result //@url URL of the result, if it exists -//@hide_url True, if the URL must be not shown //@title Title of the result //@param_description A short description of the result //@thumbnail_url URL of the result thumbnail, if it exists @@ -5305,7 +5453,7 @@ inputInlineQueryResultAnimation id:string title:string thumbnail_url:string thum //@thumbnail_height Thumbnail height, if known //@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null //@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultArticle id:string url:string hide_url:Bool title:string description:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; +inputInlineQueryResultArticle id:string url:string title:string description:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; //@description Represents a link to an MP3 audio file //@id Unique identifier of the query result @@ -5419,11 +5567,10 @@ inputInlineQueryResultVoiceNote id:string title:string voice_note_url:string voi //@description Represents a link to an article or web page //@id Unique identifier of the query result //@url URL of the result, if it exists -//@hide_url True, if the URL must be not shown //@title Title of the result //@param_description A short description of the result //@thumbnail Result thumbnail in JPEG format; may be null -inlineQueryResultArticle id:string url:string hide_url:Bool title:string description:string thumbnail:thumbnail = InlineQueryResult; +inlineQueryResultArticle id:string url:string title:string description:string thumbnail:thumbnail = InlineQueryResult; //@description Represents a user contact //@id Unique identifier of the query result @@ -6388,6 +6535,10 @@ pushMessageContentGiveaway winner_count:int32 prize:GiveawayPrize is_pinned:Bool //@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 message with an upgraded gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +pushMessageContentUpgradedGift is_upgrade:Bool = PushMessageContent; + //@description A screenshot of a message in the chat has been taken pushMessageContentScreenshotTaken = PushMessageContent; @@ -7434,6 +7585,9 @@ suggestedActionGiftPremiumForChristmas = SuggestedAction; //@description Suggests the user to set birthdate suggestedActionSetBirthdate = SuggestedAction; +//@description Suggests the user to set profile photo +suggestedActionSetProfilePhoto = SuggestedAction; + //@description Suggests the user to extend their expiring Telegram Premium subscription @manage_premium_subscription_url A URL for managing Telegram Premium subscription suggestedActionExtendPremium manage_premium_subscription_url:string = SuggestedAction; @@ -7698,7 +7852,7 @@ point x:double y:double = Point; //@description A straight line to a given point @end_point The end point of the straight line vectorPathCommandLine end_point:point = VectorPathCommand; -//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve +//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve vectorPathCommandCubicBezierCurve start_control_point:point end_control_point:point end_point:point = VectorPathCommand; @@ -8866,14 +9020,14 @@ searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_messa //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@chat_list Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported -//@only_in_channels Pass true to search only for messages in channels //@query Query to search for //@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 messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function +//@chat_type_filter Additional filter for type of the chat of the searched messages; pass null to search for messages in all chats //@min_date If not 0, the minimum date of the messages to return //@max_date If not 0, the maximum date of the messages to return -searchMessages chat_list:ChatList only_in_channels:Bool query:string offset:string limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = FoundMessages; +searchMessages chat_list:ChatList query:string offset:string limit:int32 filter:SearchMessagesFilter chat_type_filter:SearchMessagesChatTypeFilter min_date:int32 max_date:int32 = FoundMessages; //@description Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance, the number of returned messages is chosen by TDLib //@chat_id Identifier of the chat in which to search. Specify 0 to search in all secret chats @@ -10624,8 +10778,12 @@ processChatJoinRequest chat_id:int53 user_id:int53 approve:Bool = Ok; processChatJoinRequests chat_id:int53 invite_link:string approve:Bool = Ok; -//@description Creates a new call @user_id Identifier of the user to be called @protocol The call protocols supported by the application @is_video Pass true to create a video call -createCall user_id:int53 protocol:callProtocol is_video:Bool = CallId; +//@description Creates a new call +//@user_id Identifier of the user to be called +//@protocol The call protocols supported by the application +//@is_video Pass true to create a video call +//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored +createCall user_id:int53 protocol:callProtocol is_video:Bool group_call_id:int32 = CallId; //@description Accepts an incoming call @call_id Call identifier @protocol The call protocols supported by the application acceptCall call_id:int32 protocol:callProtocol = Ok; @@ -10668,6 +10826,9 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; +//@description Creates a group call from a one-to-one call @call_id Call identifier +createGroupCall call_id:int32 = Ok; + //@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right @chat_id Chat identifier getVideoChatRtmpUrl chat_id:int53 = RtmpUrl; @@ -11304,6 +11465,19 @@ setBotInfoShortDescription bot_user_id:int53 language_code:string short_descript getBotInfoShortDescription bot_user_id:int53 language_code:string = Text; +//@description Changes the verification status of a user or a chat by an owned bot +//@bot_user_id Identifier of the owned bot, which will verify the user or the chat +//@verified_id Identifier of the user or the supergroup or channel chat, which will be verified by the bot +//@custom_description Custom description of verification reason; 0-getOption("bot_verification_custom_description_length_max"). +//-If empty, then "was verified by organization "organization_name"" will be used as description. Can be specified only if the bot is allowed to provide custom description +setMessageSenderBotVerification bot_user_id:int53 verified_id:MessageSender custom_description:string = Ok; + +//@description Removes the verification status of a user or a chat by an owned bot +//@bot_user_id Identifier of the owned bot, which verified the user or the chat +//@verified_id Identifier of the user or the supergroup or channel chat, which verification is removed +removeMessageSenderBotVerification bot_user_id:int53 verified_id:MessageSender = Ok; + + //@description Returns all active sessions of the current user getActiveSessions = Sessions; @@ -11486,7 +11660,8 @@ getAvailableGifts = Gifts; //@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; +//@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free +sendGift gift_id:int64 user_id:int53 text:formattedText is_private:Bool pay_for_upgrade: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 @@ -11499,12 +11674,31 @@ sellGift sender_user_id:int53 message_id:int53 = Ok; //@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 examples of possible upgraded gifts for a regular gift @gift_id Identifier of the gift +getGiftUpgradePreview gift_id:int64 = GiftUpgradePreview; + +//@description Upgrades a gift received by the current user. Unless the gift has prepaid_upgrade_star_count > 0, the user must pay gift.upgrade_star_count Telegram Stars for the upgrade +//@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 +//@keep_original_details Pass true to keep the original gift text, sender and receiver in the upgraded gift +upgradeGift sender_user_id:int53 message_id:int53 keep_original_details:Bool = UpgradeGiftResult; + +//@description Sends a gift upgraded by the current user to another user +//@sender_user_id Identifier of the user that sent the gift +//@message_id Identifier of the message with the upgraded gift in the chat with the user +//@receiver_user_id Identifier of the user that will receive the gift +//@star_count The amount of Telegram Stars required for the transfer +transferGift sender_user_id:int53 message_id:int53 receiver_user_id:int53 star_count:int53 = 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 Returns information about a gift received or sent by the current user @message_id Identifier of the message with the gift +getUserGift message_id:int53 = UserGift; + //@description Creates a link for the given invoice; for bots only //@business_connection_id Unique identifier of business connection on behalf of which to send the request @@ -12042,33 +12236,33 @@ setChatAffiliateProgram chat_id:int53 parameters:affiliateProgramParameters = Ok //@referrer The referrer from an internalLinkTypeChatAffiliateProgram link searchChatAffiliateProgram username:string referrer:string = Chat; -//@description Searches affiliate programs that can be applied to the given chat -//@chat_id Identifier of the chat for which affiliate programs are searched for. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Searches affiliate programs that can be connected to the given affiliate +//@affiliate The affiliate for which affiliate programs are searched for //@sort_order Sort order for the results //@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of affiliate programs to return -searchAffiliatePrograms chat_id:int53 sort_order:AffiliateProgramSortOrder offset:string limit:int32 = FoundAffiliatePrograms; +searchAffiliatePrograms affiliate:AffiliateType sort_order:AffiliateProgramSortOrder offset:string limit:int32 = FoundAffiliatePrograms; -//@description Connects an affiliate program to the given chat. Returns information about the connected affiliate program -//@chat_id Identifier of the chat to which the affiliate program will be connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Connects an affiliate program to the given affiliate. Returns information about the connected affiliate program +//@affiliate The affiliate to which the affiliate program will be connected //@bot_user_id Identifier of the bot, which affiliate program is connected -connectChatAffiliateProgram chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; +connectAffiliateProgram affiliate:AffiliateType bot_user_id:int53 = ConnectedAffiliateProgram; -//@description Disconnects an affiliate program from the given chat and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program -//@chat_id Identifier of the chat for which the affiliate program is connected +//@description Disconnects an affiliate program from the given affiliate and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +//@affiliate The affiliate to which the affiliate program is connected //@url The referral link of the affiliate program -disconnectChatAffiliateProgram chat_id:int53 url:string = ChatAffiliateProgram; +disconnectAffiliateProgram affiliate:AffiliateType url:string = ConnectedAffiliateProgram; -//@description Returns an affiliate program that were connected to the given chat by identifier of the bot that created the program -//@chat_id Identifier of the chat for which the affiliate program was connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Returns an affiliate program that were connected to the given affiliate by identifier of the bot that created the program +//@affiliate The affiliate to which the affiliate program will be connected //@bot_user_id Identifier of the bot that created the program -getChatAffiliateProgram chat_id:int53 bot_user_id:int53 = ChatAffiliateProgram; +getConnectedAffiliateProgram affiliate:AffiliateType bot_user_id:int53 = ConnectedAffiliateProgram; -//@description Returns affiliate programs that were connected to the given chat -//@chat_id Identifier of the chat for which the affiliate programs were connected. Can be an identifier of the Saved Messages chat, of a chat with an owned bot, or of a channel chat with can_post_messages administrator right +//@description Returns affiliate programs that were connected to the given affiliate +//@affiliate The affiliate to which the affiliate program were connected //@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of affiliate programs to return -getChatAffiliatePrograms chat_id:int53 offset:string limit:int32 = ChatAffiliatePrograms; +getConnectedAffiliatePrograms affiliate:AffiliateType offset:string limit:int32 = ConnectedAffiliatePrograms; //@description Returns information about features, available to Business users @source Source of the request; pass null if the method is called from settings or some non-standard source From 2a5a6d2b765a271ee5e1ee310fc6eba80cd2a900 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 3 Jan 2025 06:16:40 +0800 Subject: [PATCH 08/29] Merge upstream fix --- client/client.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/client/client.go b/client/client.go index 89a7f39..ad67a7c 100644 --- a/client/client.go +++ b/client/client.go @@ -86,15 +86,15 @@ func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...O client.extraGenerator = UuidV4Generator() client.catchTimeout = 60 * time.Second - for _, option := range options { - option(client) - } - tdlibInstance.addClient(client) go client.processPendingResponse() go client.receiver() + for _, option := range options { + go option(client) + } + err := Authorize(client, authorizationStateHandler) if err != nil { return nil, err @@ -155,6 +155,10 @@ func (client *Client) processResponse(response *Response) { if needGc { client.listenerStore.gc() } + + if typ.GetType() == TypeUpdateAuthorizationState && typ.(*UpdateAuthorizationState).AuthorizationState.AuthorizationStateType() == TypeAuthorizationStateClosed { + close(client.responses) + } } func (client *Client) receiver() { @@ -257,7 +261,3 @@ func (client *Client) AddEventReceiver(msgType Type, channelCapacity int) *Liste return listener } - -func (client *Client) Stop() { - client.Destroy() -} From bda4018ed37f5fa80fb6b2188533d81d70327651 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sat, 25 Jan 2025 06:30:12 +0800 Subject: [PATCH 09/29] Update to TDLib 1.8.44 --- client/function.go | 331 ++++++++++++++++---- client/type.go | 705 ++++++++++++++++++++++++++++++++++++------ client/unmarshaler.go | 150 ++++++++- data/td_api.tl | 284 +++++++++++------ 4 files changed, 1211 insertions(+), 259 deletions(-) diff --git a/client/function.go b/client/function.go index c8ffa78..02621ab 100755 --- a/client/function.go +++ b/client/function.go @@ -1931,6 +1931,90 @@ func (client *Client) OpenChatSimilarChat(req *OpenChatSimilarChatRequest) (*Ok, return UnmarshalOk(result.Data) } +type GetBotSimilarBotsRequest struct { + // User identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Returns a list of bots similar to the given bot +func (client *Client) GetBotSimilarBots(req *GetBotSimilarBotsRequest) (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotSimilarBots", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + +type GetBotSimilarBotCountRequest struct { + // User identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // Pass true to get the number of bots without sending network requests, or -1 if the number of bots is unknown locally + ReturnLocal bool `json:"return_local"` +} + +// Returns approximate number of bots similar to the given bot +func (client *Client) GetBotSimilarBotCount(req *GetBotSimilarBotCountRequest) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotSimilarBotCount", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "return_local": req.ReturnLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + +type OpenBotSimilarBotRequest struct { + // Identifier of the original bot, which similar bots were requested + BotUserId int64 `json:"bot_user_id"` + // Identifier of the opened bot + OpenedBotUserId int64 `json:"opened_bot_user_id"` +} + +// Informs TDLib that a bot was opened from the list of similar bots +func (client *Client) OpenBotSimilarBot(req *OpenBotSimilarBotRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openBotSimilarBot", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "opened_bot_user_id": req.OpenedBotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetTopChatsRequest struct { // Category of chats to be returned Category TopChatCategory `json:"category"` @@ -4159,7 +4243,7 @@ type DeleteChatMessagesBySenderRequest struct { SenderId MessageSender `json:"sender_id"` } -// Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator privileges +// Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator right func (client *Client) DeleteChatMessagesBySender(req *DeleteChatMessagesBySenderRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8117,6 +8201,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeUnsupportedProxy: return UnmarshalInternalLinkTypeUnsupportedProxy(result.Data) + case TypeInternalLinkTypeUpgradedGift: + return UnmarshalInternalLinkTypeUpgradedGift(result.Data) + case TypeInternalLinkTypeUserPhoneNumber: return UnmarshalInternalLinkTypeUserPhoneNumber(result.Data) @@ -11789,7 +11876,7 @@ func (client *Client) ToggleBotIsAddedToAttachmentMenu(req *ToggleBotIsAddedToAt } // Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list for self status -func (client *Client) GetThemedEmojiStatuses() (*EmojiStatuses, error) { +func (client *Client) GetThemedEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getThemedEmojiStatuses", @@ -11804,7 +11891,7 @@ func (client *Client) GetThemedEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } // Returns recent emoji statuses for self status @@ -11826,8 +11913,27 @@ func (client *Client) GetRecentEmojiStatuses() (*EmojiStatuses, error) { return UnmarshalEmojiStatuses(result.Data) } +// Returns available upgraded gift emoji statuses for self status +func (client *Client) GetUpgradedGiftEmojiStatuses() (*EmojiStatuses, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftEmojiStatuses", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiStatuses(result.Data) +} + // Returns default emoji statuses for self status -func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatuses, error) { +func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getDefaultEmojiStatuses", @@ -11842,7 +11948,7 @@ func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } // Clears the list of recently used emoji statuses for self status @@ -11865,7 +11971,7 @@ func (client *Client) ClearRecentEmojiStatuses() (*Ok, error) { } // Returns up to 8 emoji statuses, which must be shown in the emoji status list for chats -func (client *Client) GetThemedChatEmojiStatuses() (*EmojiStatuses, error) { +func (client *Client) GetThemedChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getThemedChatEmojiStatuses", @@ -11880,11 +11986,11 @@ func (client *Client) GetThemedChatEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } // Returns default emoji statuses for chats -func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatuses, error) { +func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getDefaultChatEmojiStatuses", @@ -11899,11 +12005,11 @@ func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } // Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true -func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatuses, error) { +func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getDisallowedChatEmojiStatuses", @@ -11918,7 +12024,7 @@ func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } type DownloadFileRequest struct { @@ -18755,7 +18861,7 @@ func (client *Client) DeleteSavedCredentials() (*Ok, error) { return UnmarshalOk(result.Data) } -// Returns gifts that can be sent to other users +// Returns gifts that can be sent to other users and channel chats func (client *Client) GetAvailableGifts() (*Gifts, error) { result, err := client.Send(Request{ meta: meta{ @@ -18777,17 +18883,17 @@ func (client *Client) GetAvailableGifts() (*Gifts, error) { 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"` + // Identifier of the user or the channel chat that will receive the gift + OwnerId MessageSender `json:"owner_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 + // Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` // Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free PayForUpgrade bool `json:"pay_for_upgrade"` } -// Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out +// Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18795,7 +18901,7 @@ func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { }, Data: map[string]interface{}{ "gift_id": req.GiftId, - "user_id": req.UserId, + "owner_id": req.OwnerId, "text": req.Text, "is_private": req.IsPrivate, "pay_for_upgrade": req.PayForUpgrade, @@ -18813,21 +18919,18 @@ func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { } 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"` + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` } -// Sells a gift received by the current user for Telegram Stars +// Sells a gift 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, + "received_gift_id": req.ReceivedGiftId, }, }) if err != nil { @@ -18842,23 +18945,20 @@ func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { } 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 + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Pass true to display the gift on the user's or the channel'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 +// Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the chat 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, + "received_gift_id": req.ReceivedGiftId, "is_saved": req.IsSaved, }, }) @@ -18873,6 +18973,35 @@ func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, err return UnmarshalOk(result.Data) } +type ToggleChatGiftNotificationsRequest struct { + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Pass true to enable notifications about new gifts owned by the channel chat; pass false to disable the notifications + AreEnabled bool `json:"are_enabled"` +} + +// Toggles whether notifications for new gifts received by a channel chat are sent to the current user; requires can_post_messages administrator right in the chat +func (client *Client) ToggleChatGiftNotifications(req *ToggleChatGiftNotificationsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatGiftNotifications", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "are_enabled": req.AreEnabled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetGiftUpgradePreviewRequest struct { // Identifier of the gift GiftId JsonInt64 `json:"gift_id"` @@ -18900,24 +19029,24 @@ func (client *Client) GetGiftUpgradePreview(req *GetGiftUpgradePreviewRequest) ( } type UpgradeGiftRequest 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"` + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` // Pass true to keep the original gift text, sender and receiver in the upgraded gift KeepOriginalDetails bool `json:"keep_original_details"` + // The amount of Telegram Stars required to pay for the upgrade. It the gift has prepaid_upgrade_star_count > 0, then pass 0, otherwise, pass gift.upgrade_star_count + StarCount int64 `json:"star_count"` } -// Upgrades a gift received by the current user. Unless the gift has prepaid_upgrade_star_count > 0, the user must pay gift.upgrade_star_count Telegram Stars for the upgrade +// Upgrades a regular gift func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "upgradeGift", }, Data: map[string]interface{}{ - "sender_user_id": req.SenderUserId, - "message_id": req.MessageId, + "received_gift_id": req.ReceivedGiftId, "keep_original_details": req.KeepOriginalDetails, + "star_count": req.StarCount, }, }) if err != nil { @@ -18932,26 +19061,23 @@ func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, } type TransferGiftRequest struct { - // Identifier of the user that sent the gift - SenderUserId int64 `json:"sender_user_id"` - // Identifier of the message with the upgraded gift in the chat with the user - MessageId int64 `json:"message_id"` - // Identifier of the user that will receive the gift - ReceiverUserId int64 `json:"receiver_user_id"` - // The amount of Telegram Stars required for the transfer + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Identifier of the user or the channel chat that will receive the gift + NewOwnerId MessageSender `json:"new_owner_id"` + // The amount of Telegram Stars required to pay for the transfer StarCount int64 `json:"star_count"` } -// Sends a gift upgraded by the current user to another user +// Sends an upgraded gift to another user or a channel chat func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "transferGift", }, Data: map[string]interface{}{ - "sender_user_id": req.SenderUserId, - "message_id": req.MessageId, - "receiver_user_id": req.ReceiverUserId, + "received_gift_id": req.ReceivedGiftId, + "new_owner_id": req.NewOwnerId, "star_count": req.StarCount, }, }) @@ -18966,23 +19092,41 @@ func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -type GetUserGiftsRequest struct { - // Identifier of the user - UserId int64 `json:"user_id"` +type GetReceivedGiftsRequest struct { + // Identifier of the gift receiver + OwnerId MessageSender `json:"owner_id"` + // Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right + ExcludeUnsaved bool `json:"exclude_unsaved"` + // Pass true to exclude gifts that are saved to the chat's profile page; for channel chats with can_post_messages administrator right only + ExcludeSaved bool `json:"exclude_saved"` + // Pass true to exclude gifts that can be purchased unlimited number of times; for channel chats with can_post_messages administrator right only + ExcludeUnlimited bool `json:"exclude_unlimited"` + // Pass true to exclude gifts that can be purchased limited number of times; for channel chats with can_post_messages administrator right only + ExcludeLimited bool `json:"exclude_limited"` + // Pass true to exclude upgraded gifts; for channel chats with can_post_messages administrator right only + ExcludeUpgraded bool `json:"exclude_upgraded"` + // Pass true to sort results by gift price instead of send date; for channel chats with can_post_messages administrator right only + SortByPrice bool `json:"sort_by_price"` // 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) { +// Returns gifts received by the given user or chat +func (client *Client) GetReceivedGifts(req *GetReceivedGiftsRequest) (*ReceivedGifts, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getUserGifts", + Type: "getReceivedGifts", }, Data: map[string]interface{}{ - "user_id": req.UserId, + "owner_id": req.OwnerId, + "exclude_unsaved": req.ExcludeUnsaved, + "exclude_saved": req.ExcludeSaved, + "exclude_unlimited": req.ExcludeUnlimited, + "exclude_limited": req.ExcludeLimited, + "exclude_upgraded": req.ExcludeUpgraded, + "sort_by_price": req.SortByPrice, "offset": req.Offset, "limit": req.Limit, }, @@ -18995,22 +19139,22 @@ func (client *Client) GetUserGifts(req *GetUserGiftsRequest) (*UserGifts, error) return nil, buildResponseError(result.Data) } - return UnmarshalUserGifts(result.Data) + return UnmarshalReceivedGifts(result.Data) } -type GetUserGiftRequest struct { - // Identifier of the message with the gift - MessageId int64 `json:"message_id"` +type GetReceivedGiftRequest struct { + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` } -// Returns information about a gift received or sent by the current user -func (client *Client) GetUserGift(req *GetUserGiftRequest) (*UserGift, error) { +// Returns information about a received gift +func (client *Client) GetReceivedGift(req *GetReceivedGiftRequest) (*ReceivedGift, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getUserGift", + Type: "getReceivedGift", }, Data: map[string]interface{}{ - "message_id": req.MessageId, + "received_gift_id": req.ReceivedGiftId, }, }) if err != nil { @@ -19021,7 +19165,62 @@ func (client *Client) GetUserGift(req *GetUserGiftRequest) (*UserGift, error) { return nil, buildResponseError(result.Data) } - return UnmarshalUserGift(result.Data) + return UnmarshalReceivedGift(result.Data) +} + +type GetUpgradedGiftRequest struct { + // Unique name of the upgraded gift + Name string `json:"name"` +} + +// Returns information about an upgraded gift by its name +func (client *Client) GetUpgradedGift(req *GetUpgradedGiftRequest) (*UpgradedGift, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGift", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpgradedGift(result.Data) +} + +type GetUpgradedGiftWithdrawalUrlRequest struct { + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns a URL for upgraded gift withdrawal in the TON blockchain as an NFT; requires owner privileges for gifts owned by a chat +func (client *Client) GetUpgradedGiftWithdrawalUrl(req *GetUpgradedGiftWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftWithdrawalUrl", + }, + Data: map[string]interface{}{ + "received_gift_id": req.ReceivedGiftId, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) } type CreateInvoiceLinkRequest struct { diff --git a/client/type.go b/client/type.go index 0b77de8..1603b60 100755 --- a/client/type.go +++ b/client/type.go @@ -32,6 +32,7 @@ const ( ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" ClassGiveawayInfo = "GiveawayInfo" ClassGiveawayPrize = "GiveawayPrize" + ClassEmojiStatusType = "EmojiStatusType" ClassChatMemberStatus = "ChatMemberStatus" ClassChatMembersFilter = "ChatMembersFilter" ClassSupergroupMembersFilter = "SupergroupMembersFilter" @@ -265,14 +266,15 @@ const ( ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" ClassUpgradedGiftModel = "UpgradedGiftModel" ClassUpgradedGiftSymbol = "UpgradedGiftSymbol" + ClassUpgradedGiftBackdropColors = "UpgradedGiftBackdropColors" ClassUpgradedGiftBackdrop = "UpgradedGiftBackdrop" ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" ClassGift = "Gift" ClassGifts = "Gifts" ClassUpgradedGift = "UpgradedGift" ClassUpgradeGiftResult = "UpgradeGiftResult" - ClassUserGift = "UserGift" - ClassUserGifts = "UserGifts" + ClassReceivedGift = "ReceivedGift" + ClassReceivedGifts = "ReceivedGifts" ClassGiftUpgradePreview = "GiftUpgradePreview" ClassStarTransaction = "StarTransaction" ClassStarTransactions = "StarTransactions" @@ -281,6 +283,7 @@ const ( ClassProfileAccentColor = "ProfileAccentColor" ClassEmojiStatus = "EmojiStatus" ClassEmojiStatuses = "EmojiStatuses" + ClassEmojiStatusCustomEmojis = "EmojiStatusCustomEmojis" ClassUsernames = "Usernames" ClassUser = "User" ClassBotInfo = "BotInfo" @@ -768,6 +771,7 @@ const ( TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" TypeUpgradedGiftModel = "upgradedGiftModel" TypeUpgradedGiftSymbol = "upgradedGiftSymbol" + TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" TypeUpgradedGiftBackdrop = "upgradedGiftBackdrop" TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" TypeGift = "gift" @@ -776,8 +780,8 @@ const ( TypeUpgradeGiftResult = "upgradeGiftResult" TypeSentGiftRegular = "sentGiftRegular" TypeSentGiftUpgraded = "sentGiftUpgraded" - TypeUserGift = "userGift" - TypeUserGifts = "userGifts" + TypeReceivedGift = "receivedGift" + TypeReceivedGifts = "receivedGifts" TypeGiftUpgradePreview = "giftUpgradePreview" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" @@ -822,8 +826,11 @@ const ( TypeAccentColor = "accentColor" TypeProfileAccentColors = "profileAccentColors" TypeProfileAccentColor = "profileAccentColor" + TypeEmojiStatusTypeCustomEmoji = "emojiStatusTypeCustomEmoji" + TypeEmojiStatusTypeUpgradedGift = "emojiStatusTypeUpgradedGift" TypeEmojiStatus = "emojiStatus" TypeEmojiStatuses = "emojiStatuses" + TypeEmojiStatusCustomEmojis = "emojiStatusCustomEmojis" TypeUsernames = "usernames" TypeUser = "user" TypeBotInfo = "botInfo" @@ -1130,6 +1137,7 @@ const ( TypeLinkPreviewTypeSupergroupBoost = "linkPreviewTypeSupergroupBoost" TypeLinkPreviewTypeTheme = "linkPreviewTypeTheme" TypeLinkPreviewTypeUnsupported = "linkPreviewTypeUnsupported" + TypeLinkPreviewTypeUpgradedGift = "linkPreviewTypeUpgradedGift" TypeLinkPreviewTypeUser = "linkPreviewTypeUser" TypeLinkPreviewTypeVideo = "linkPreviewTypeVideo" TypeLinkPreviewTypeVideoChat = "linkPreviewTypeVideoChat" @@ -1444,6 +1452,7 @@ const ( TypeStoryAreaTypeMessage = "storyAreaTypeMessage" TypeStoryAreaTypeLink = "storyAreaTypeLink" TypeStoryAreaTypeWeather = "storyAreaTypeWeather" + TypeStoryAreaTypeUpgradedGift = "storyAreaTypeUpgradedGift" TypeStoryArea = "storyArea" TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" @@ -1452,6 +1461,7 @@ const ( TypeInputStoryAreaTypeMessage = "inputStoryAreaTypeMessage" TypeInputStoryAreaTypeLink = "inputStoryAreaTypeLink" TypeInputStoryAreaTypeWeather = "inputStoryAreaTypeWeather" + TypeInputStoryAreaTypeUpgradedGift = "inputStoryAreaTypeUpgradedGift" TypeInputStoryArea = "inputStoryArea" TypeInputStoryAreas = "inputStoryAreas" TypeStoryVideo = "storyVideo" @@ -1980,6 +1990,7 @@ const ( TypeInternalLinkTypeThemeSettings = "internalLinkTypeThemeSettings" TypeInternalLinkTypeUnknownDeepLink = "internalLinkTypeUnknownDeepLink" TypeInternalLinkTypeUnsupportedProxy = "internalLinkTypeUnsupportedProxy" + TypeInternalLinkTypeUpgradedGift = "internalLinkTypeUpgradedGift" TypeInternalLinkTypeUserPhoneNumber = "internalLinkTypeUserPhoneNumber" TypeInternalLinkTypeUserToken = "internalLinkTypeUserToken" TypeInternalLinkTypeVideoChat = "internalLinkTypeVideoChat" @@ -2386,7 +2397,7 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } -// Represents a gift received by a user +// Represents content of a gift received by a user or a channel chat type SentGift interface { SentGiftType() string } @@ -2416,6 +2427,11 @@ type GiveawayPrize interface { GiveawayPrizeType() string } +// Describes type of emoji status +type EmojiStatusType interface { + EmojiStatusTypeType() string +} + // Provides information about the status of a member in a chat type ChatMemberStatus interface { ChatMemberStatusType() string @@ -6379,7 +6395,7 @@ type BotVerification struct { BotUserId int64 `json:"bot_user_id"` // Identifier of the custom emoji that is used as the verification sign IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` - // Custom description of verification reason set by the bot + // Custom description of verification reason set by the bot. Can contain only Mention, Hashtag, Cashtag, PhoneNumber, BankCardNumber, Url, and EmailAddress entities CustomDescription *FormattedText `json:"custom_description"` } @@ -8440,11 +8456,9 @@ func (*UpgradedGiftSymbol) GetType() string { return TypeUpgradedGiftSymbol } -// Describes a backdrop of an upgraded gift -type UpgradedGiftBackdrop struct { +// Describes colors of a backdrop of an upgraded gift +type UpgradedGiftBackdropColors struct { meta - // Name of the backdrop - Name string `json:"name"` // A color in the center of the backdrop in the RGB format CenterColor int32 `json:"center_color"` // A color on the edges of the backdrop in the RGB format @@ -8453,6 +8467,31 @@ type UpgradedGiftBackdrop struct { SymbolColor int32 `json:"symbol_color"` // A color for the text on the backdrop in the RGB format TextColor int32 `json:"text_color"` +} + +func (entity *UpgradedGiftBackdropColors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftBackdropColors + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftBackdropColors) GetClass() string { + return ClassUpgradedGiftBackdropColors +} + +func (*UpgradedGiftBackdropColors) GetType() string { + return TypeUpgradedGiftBackdropColors +} + +// Describes a backdrop of an upgraded gift +type UpgradedGiftBackdrop struct { + meta + // Name of the backdrop + Name string `json:"name"` + // Colors of the backdrop + Colors *UpgradedGiftBackdropColors `json:"colors"` // The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded RarityPerMille int32 `json:"rarity_per_mille"` } @@ -8476,10 +8515,10 @@ func (*UpgradedGiftBackdrop) GetType() string { // Describes the original details about the gift type UpgradedGiftOriginalDetails struct { meta - // Identifier of the user that sent the gift; 0 if the gift was private - SenderUserId int64 `json:"sender_user_id"` - // Identifier of the user that received the gift - ReceiverUserId int64 `json:"receiver_user_id"` + // Identifier of the user or the chat that sent the gift; may be null if the gift was private + SenderId MessageSender `json:"sender_id"` + // Identifier of the user or the chat that received the gift + ReceiverId MessageSender `json:"receiver_id"` // Message added to the gift Text *FormattedText `json:"text"` // Point in time (Unix timestamp) when the gift was sent @@ -8502,7 +8541,32 @@ func (*UpgradedGiftOriginalDetails) GetType() string { return TypeUpgradedGiftOriginalDetails } -// Describes a gift that can be sent to another user +func (upgradedGiftOriginalDetails *UpgradedGiftOriginalDetails) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` + Text *FormattedText `json:"text"` + Date int32 `json:"date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + upgradedGiftOriginalDetails.Text = tmp.Text + upgradedGiftOriginalDetails.Date = tmp.Date + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + upgradedGiftOriginalDetails.SenderId = fieldSenderId + + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + upgradedGiftOriginalDetails.ReceiverId = fieldReceiverId + + return nil +} + +// Describes a gift that can be sent to another user or channel chat type Gift struct { meta // Unique identifier of the gift @@ -8517,9 +8581,9 @@ type Gift struct { UpgradeStarCount int64 `json:"upgrade_star_count"` // True, if the gift is a birthday gift IsForBirthday bool `json:"is_for_birthday"` - // Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out + // Number of remaining times the gift can be purchased; 0 if not limited or the gift was sold out RemainingCount int32 `json:"remaining_count"` - // Number of total times the gift can be purchased by all users; 0 if not limited + // Number of total times the gift can be purchased; 0 if not limited TotalCount int32 `json:"total_count"` // Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only FirstSendDate int32 `json:"first_send_date"` @@ -8543,7 +8607,7 @@ func (*Gift) GetType() string { return TypeGift } -// Contains a list of gifts that can be sent to another user +// Contains a list of gifts that can be sent to another user or channel chat type Gifts struct { meta // The list of gifts @@ -8566,21 +8630,27 @@ func (*Gifts) GetType() string { return TypeGifts } -// Describes an upgraded gift that can be gifted to another user or transferred to TON blockchain as an NFT +// Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT type UpgradedGift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` // The title of the upgraded gift Title string `json:"title"` + // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift + Name string `json:"name"` // Unique number of the upgraded gift among gifts upgraded from the same gift Number int32 `json:"number"` // Total number of gifts that were upgraded from the same gift TotalUpgradedCount int32 `json:"total_upgraded_count"` // The maximum number of gifts that can be upgraded from the same gift MaxUpgradedCount int32 `json:"max_upgraded_count"` - // User identifier of the user that owns the upgraded gift; 0 if none - OwnerUserId int64 `json:"owner_user_id"` + // Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown + OwnerId MessageSender `json:"owner_id"` + // Address of the gift NFT owner in TON blockchain; may be empty if none + OwnerAddress string `json:"owner_address"` + // Name of the owner for the case when owner identifier and address aren't known + OwnerName string `json:"owner_name"` // Model of the upgraded gift Model *UpgradedGiftModel `json:"model"` // Symbol of the upgraded gift @@ -8607,18 +8677,61 @@ func (*UpgradedGift) GetType() string { return TypeUpgradedGift } +func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + Title string `json:"title"` + Name string `json:"name"` + Number int32 `json:"number"` + TotalUpgradedCount int32 `json:"total_upgraded_count"` + MaxUpgradedCount int32 `json:"max_upgraded_count"` + OwnerId json.RawMessage `json:"owner_id"` + OwnerAddress string `json:"owner_address"` + OwnerName string `json:"owner_name"` + Model *UpgradedGiftModel `json:"model"` + Symbol *UpgradedGiftSymbol `json:"symbol"` + Backdrop *UpgradedGiftBackdrop `json:"backdrop"` + OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + upgradedGift.Id = tmp.Id + upgradedGift.Title = tmp.Title + upgradedGift.Name = tmp.Name + upgradedGift.Number = tmp.Number + upgradedGift.TotalUpgradedCount = tmp.TotalUpgradedCount + upgradedGift.MaxUpgradedCount = tmp.MaxUpgradedCount + upgradedGift.OwnerAddress = tmp.OwnerAddress + upgradedGift.OwnerName = tmp.OwnerName + upgradedGift.Model = tmp.Model + upgradedGift.Symbol = tmp.Symbol + upgradedGift.Backdrop = tmp.Backdrop + upgradedGift.OriginalDetails = tmp.OriginalDetails + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + upgradedGift.OwnerId = fieldOwnerId + + return nil +} + // Contains result of gift upgrading type UpgradeGiftResult struct { meta // The upgraded gift Gift *UpgradedGift `json:"gift"` - // True, if the gift is displayed on the user's profile page + // Unique identifier of the received gift for the current user + ReceivedGiftId string `json:"received_gift_id"` + // True, if the gift is displayed on the user's or the channel's profile page IsSaved bool `json:"is_saved"` - // True, if the gift can be transferred to another user + // True, if the gift can be transferred to another owner CanBeTransferred bool `json:"can_be_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT ExportDate int32 `json:"export_date"` } @@ -8692,20 +8805,22 @@ func (*SentGiftUpgraded) SentGiftType() string { return TypeSentGiftUpgraded } -// Represents a gift received by a user -type UserGift struct { +// Represents a gift received by a user or a chat +type ReceivedGift struct { meta - // Identifier of the user that sent the gift; 0 if unknown - SenderUserId int64 `json:"sender_user_id"` + // Unique identifier of the received gift for the current user; only for the receiver of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Identifier of a user or a chat that sent the gift; may be null if unknown + SenderId MessageSender `json:"sender_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; only for the receiver of the gift + // True, if the gift is displayed on the chat's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` // True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift CanBeUpgraded bool `json:"can_be_upgraded"` - // True, if the gift is an upgraded gift that can be transferred to another user; only for the receiver of the gift + // True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift CanBeTransferred bool `json:"can_be_transferred"` // True, if the gift was refunded and isn't available anymore WasRefunded bool `json:"was_refunded"` @@ -8713,37 +8828,36 @@ type UserGift struct { Date int32 `json:"date"` // The gift Gift SentGift `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 receiver of the gift - MessageId int64 `json:"message_id"` // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user SellStarCount int64 `json:"sell_star_count"` // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the upgraded gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } -func (entity *UserGift) MarshalJSON() ([]byte, error) { +func (entity *ReceivedGift) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UserGift + type stub ReceivedGift return json.Marshal((*stub)(entity)) } -func (*UserGift) GetClass() string { - return ClassUserGift +func (*ReceivedGift) GetClass() string { + return ClassReceivedGift } -func (*UserGift) GetType() string { - return TypeUserGift +func (*ReceivedGift) GetType() string { + return TypeReceivedGift } -func (userGift *UserGift) UnmarshalJSON(data []byte) error { +func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { var tmp struct { - SenderUserId int64 `json:"sender_user_id"` + ReceivedGiftId string `json:"received_gift_id"` + SenderId json.RawMessage `json:"sender_id"` Text *FormattedText `json:"text"` IsPrivate bool `json:"is_private"` IsSaved bool `json:"is_saved"` @@ -8752,7 +8866,6 @@ func (userGift *UserGift) UnmarshalJSON(data []byte) error { WasRefunded bool `json:"was_refunded"` Date int32 `json:"date"` Gift json.RawMessage `json:"gift"` - MessageId int64 `json:"message_id"` SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` TransferStarCount int64 `json:"transfer_star_count"` @@ -8764,51 +8877,55 @@ func (userGift *UserGift) UnmarshalJSON(data []byte) error { return err } - userGift.SenderUserId = tmp.SenderUserId - userGift.Text = tmp.Text - userGift.IsPrivate = tmp.IsPrivate - userGift.IsSaved = tmp.IsSaved - userGift.CanBeUpgraded = tmp.CanBeUpgraded - userGift.CanBeTransferred = tmp.CanBeTransferred - userGift.WasRefunded = tmp.WasRefunded - userGift.Date = tmp.Date - userGift.MessageId = tmp.MessageId - userGift.SellStarCount = tmp.SellStarCount - userGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount - userGift.TransferStarCount = tmp.TransferStarCount - userGift.ExportDate = tmp.ExportDate + receivedGift.ReceivedGiftId = tmp.ReceivedGiftId + receivedGift.Text = tmp.Text + receivedGift.IsPrivate = tmp.IsPrivate + receivedGift.IsSaved = tmp.IsSaved + receivedGift.CanBeUpgraded = tmp.CanBeUpgraded + receivedGift.CanBeTransferred = tmp.CanBeTransferred + receivedGift.WasRefunded = tmp.WasRefunded + receivedGift.Date = tmp.Date + receivedGift.SellStarCount = tmp.SellStarCount + receivedGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + receivedGift.TransferStarCount = tmp.TransferStarCount + receivedGift.ExportDate = tmp.ExportDate + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + receivedGift.SenderId = fieldSenderId fieldGift, _ := UnmarshalSentGift(tmp.Gift) - userGift.Gift = fieldGift + receivedGift.Gift = fieldGift return nil } -// Represents a list of gifts received by a user -type UserGifts struct { +// Represents a list of gifts received by a user or a chat +type ReceivedGifts struct { meta // The total number of received gifts TotalCount int32 `json:"total_count"` // The list of gifts - Gifts []*UserGift `json:"gifts"` + Gifts []*ReceivedGift `json:"gifts"` + // True, if notifications about new gifts of the owner are enabled + AreNotificationsEnabled bool `json:"are_notifications_enabled"` // 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) { +func (entity *ReceivedGifts) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UserGifts + type stub ReceivedGifts return json.Marshal((*stub)(entity)) } -func (*UserGifts) GetClass() string { - return ClassUserGifts +func (*ReceivedGifts) GetClass() string { + return ClassReceivedGifts } -func (*UserGifts) GetType() string { - return TypeUserGifts +func (*ReceivedGifts) GetType() string { + return TypeReceivedGifts } // Contains examples of possible upgraded gifts for the given regular gift @@ -9535,11 +9652,11 @@ func (*StarTransactionTypeChannelSubscriptionSale) StarTransactionTypeType() str return TypeStarTransactionTypeChannelSubscriptionSale } -// The transaction is a purchase of a regular gift to another user; for regular users and bots only +// The transaction is a purchase of a regular gift; for regular users and bots only type StarTransactionTypeGiftPurchase struct { meta - // Identifier of the user that received the gift - UserId int64 `json:"user_id"` + // Identifier of the user or the channel that received the gift + OwnerId MessageSender `json:"owner_id"` // The gift Gift *Gift `json:"gift"` } @@ -9564,11 +9681,30 @@ func (*StarTransactionTypeGiftPurchase) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftPurchase } -// The transaction is a transfer of an upgraded gift to another user; for regular users only +func (starTransactionTypeGiftPurchase *StarTransactionTypeGiftPurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *Gift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftPurchase.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftPurchase.OwnerId = fieldOwnerId + + return nil +} + +// The transaction is a transfer of an upgraded gift; for regular users only type StarTransactionTypeGiftTransfer struct { meta - // Identifier of the user that received the gift - UserId int64 `json:"user_id"` + // Identifier of the user or the channel that received the gift + OwnerId MessageSender `json:"owner_id"` // The gift Gift *UpgradedGift `json:"gift"` } @@ -9593,7 +9729,26 @@ func (*StarTransactionTypeGiftTransfer) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftTransfer } -// The transaction is a sale of a gift received from another user or bot; for regular users only +func (starTransactionTypeGiftTransfer *StarTransactionTypeGiftTransfer) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *UpgradedGift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftTransfer.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftTransfer.OwnerId = fieldOwnerId + + return nil +} + +// The transaction is a sale of a received gift; for regular users and channel chats only type StarTransactionTypeGiftSale struct { meta // Identifier of the user that sent the gift @@ -10211,11 +10366,75 @@ func (*ProfileAccentColor) GetType() string { return TypeProfileAccentColor } -// Describes a custom emoji to be shown instead of the Telegram Premium badge -type EmojiStatus struct { +// A custom emoji set as emoji status +type EmojiStatusTypeCustomEmoji struct { meta // Identifier of the custom emoji in stickerFormatTgs format CustomEmojiId JsonInt64 `json:"custom_emoji_id"` +} + +func (entity *EmojiStatusTypeCustomEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiStatusTypeCustomEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiStatusTypeCustomEmoji) GetClass() string { + return ClassEmojiStatusType +} + +func (*EmojiStatusTypeCustomEmoji) GetType() string { + return TypeEmojiStatusTypeCustomEmoji +} + +func (*EmojiStatusTypeCustomEmoji) EmojiStatusTypeType() string { + return TypeEmojiStatusTypeCustomEmoji +} + +// An upgraded gift set as emoji status +type EmojiStatusTypeUpgradedGift struct { + meta + // Identifier of the upgraded gift + UpgradedGiftId JsonInt64 `json:"upgraded_gift_id"` + // The title of the upgraded gift + GiftTitle string `json:"gift_title"` + // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift + GiftName string `json:"gift_name"` + // Custom emoji identifier of the model of the upgraded gift + ModelCustomEmojiId JsonInt64 `json:"model_custom_emoji_id"` + // Custom emoji identifier of the symbol of the upgraded gift + SymbolCustomEmojiId JsonInt64 `json:"symbol_custom_emoji_id"` + // Colors of the backdrop of the upgraded gift + BackdropColors *UpgradedGiftBackdropColors `json:"backdrop_colors"` +} + +func (entity *EmojiStatusTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiStatusTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiStatusTypeUpgradedGift) GetClass() string { + return ClassEmojiStatusType +} + +func (*EmojiStatusTypeUpgradedGift) GetType() string { + return TypeEmojiStatusTypeUpgradedGift +} + +func (*EmojiStatusTypeUpgradedGift) EmojiStatusTypeType() string { + return TypeEmojiStatusTypeUpgradedGift +} + +// Describes an emoji to be shown instead of the Telegram Premium badge +type EmojiStatus struct { + meta + // Type of the emoji status + Type EmojiStatusType `json:"type"` // Point in time (Unix timestamp) when the status will expire; 0 if never ExpirationDate int32 `json:"expiration_date"` } @@ -10236,11 +10455,30 @@ func (*EmojiStatus) GetType() string { return TypeEmojiStatus } -// Contains a list of custom emoji identifiers for emoji statuses +func (emojiStatus *EmojiStatus) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + ExpirationDate int32 `json:"expiration_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + emojiStatus.ExpirationDate = tmp.ExpirationDate + + fieldType, _ := UnmarshalEmojiStatusType(tmp.Type) + emojiStatus.Type = fieldType + + return nil +} + +// Contains a list of emoji statuses type EmojiStatuses struct { meta - // The list of custom emoji identifiers - CustomEmojiIds []JsonInt64 `json:"custom_emoji_ids"` + // The list of emoji statuses identifiers + EmojiStatuses []*EmojiStatus `json:"emoji_statuses"` } func (entity *EmojiStatuses) MarshalJSON() ([]byte, error) { @@ -10259,6 +10497,29 @@ func (*EmojiStatuses) GetType() string { return TypeEmojiStatuses } +// Contains a list of custom emoji identifiers for emoji statuses +type EmojiStatusCustomEmojis struct { + meta + // The list of custom emoji identifiers + CustomEmojiIds []JsonInt64 `json:"custom_emoji_ids"` +} + +func (entity *EmojiStatusCustomEmojis) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiStatusCustomEmojis + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiStatusCustomEmojis) GetClass() string { + return ClassEmojiStatusCustomEmojis +} + +func (*EmojiStatusCustomEmojis) GetType() string { + return TypeEmojiStatusCustomEmojis +} + // Describes usernames assigned to a user, a supergroup, or a channel type Usernames struct { meta @@ -10597,7 +10858,7 @@ type UserFullInfo struct { Birthdate *Birthdate `json:"birthdate"` // Identifier of the personal chat of the user; 0 if none PersonalChatId int64 `json:"personal_chat_id"` - // Number of gifts saved to profile by the user + // Number of saved to profile gifts for other users or the total number of received gifts for the current 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"` @@ -12123,6 +12384,8 @@ type SupergroupFullInfo struct { CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` // True, if the supergroup or channel Telegram Star revenue statistics are available CanGetStarRevenueStatistics bool `json:"can_get_star_revenue_statistics"` + // True, if the user can send a gift to the supergroup or channel using sendGift or transferGift + CanSendGift bool `json:"can_send_gift"` // True, if aggressive anti-spam checks can be enabled or disabled in the supergroup CanToggleAggressiveAntiSpam bool `json:"can_toggle_aggressive_anti_spam"` // True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available, so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators @@ -12135,6 +12398,8 @@ type SupergroupFullInfo struct { HasPaidMediaAllowed bool `json:"has_paid_media_allowed"` // True, if the supergroup or channel has pinned stories HasPinnedStories bool `json:"has_pinned_stories"` + // Number of saved to profile gifts for channels without can_post_messages administrator right, otherwise, the total number of received gifts + GiftCount int32 `json:"gift_count"` // Number of times the current user boosted the supergroup or channel MyBoostCount int32 `json:"my_boost_count"` // Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified @@ -21133,6 +21398,33 @@ func (*LinkPreviewTypeUnsupported) LinkPreviewTypeType() string { return TypeLinkPreviewTypeUnsupported } +// The link is a link to an upgraded gift +type LinkPreviewTypeUpgradedGift struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *LinkPreviewTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeUpgradedGift) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeUpgradedGift) GetType() string { + return TypeLinkPreviewTypeUpgradedGift +} + +func (*LinkPreviewTypeUpgradedGift) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeUpgradedGift +} + // The link is a link to a user type LinkPreviewTypeUser struct { meta @@ -22560,6 +22852,10 @@ type PaidMediaVideo struct { meta // The video Video *Video `json:"video"` + // Cover of the video; may be null if none + Cover *Photo `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` } func (entity *PaidMediaVideo) MarshalJSON() ([]byte, error) { @@ -25042,6 +25338,10 @@ type MessageVideo struct { Video *Video `json:"video"` // Alternative qualities of the video AlternativeVideos []*AlternativeVideo `json:"alternative_videos"` + // Cover of the video; may be null if none + Cover *Photo `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` // 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 @@ -26956,11 +27256,15 @@ func (*MessageGiveawayPrizeStars) MessageContentType() string { return TypeMessageGiveawayPrizeStars } -// A regular gift was received or sent by the current user +// A regular gift was received or sent by the current user, or the current user was notified about a channel gift type MessageGift struct { meta // The gift Gift *Gift `json:"gift"` + // Sender of the gift + SenderId MessageSender `json:"sender_id"` + // Unique identifier of the received gift for the current user; only for the receiver of the gift + ReceivedGiftId string `json:"received_gift_id"` // Message added to the gift Text *FormattedText `json:"text"` // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver @@ -26969,7 +27273,7 @@ type MessageGift struct { PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_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 + // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` // True, if the gift can be upgraded to a unique gift; only for the receiver of the gift CanBeUpgraded bool `json:"can_be_upgraded"` @@ -26979,8 +27283,8 @@ type MessageGift struct { WasUpgraded bool `json:"was_upgraded"` // True, if the gift was refunded and isn't available anymore WasRefunded bool `json:"was_refunded"` - // Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift with upgraded version of the gift; can be 0 if none or an identifier of a deleted message. Use getUserGift to get information about the gift - UpgradeMessageId int64 `json:"upgrade_message_id"` + // Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift + UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` } func (entity *MessageGift) MarshalJSON() ([]byte, error) { @@ -27003,22 +27307,67 @@ func (*MessageGift) MessageContentType() string { return TypeMessageGift } -// An upgraded gift was received or sent by the current user +func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *Gift `json:"gift"` + SenderId json.RawMessage `json:"sender_id"` + ReceivedGiftId string `json:"received_gift_id"` + Text *FormattedText `json:"text"` + SellStarCount int64 `json:"sell_star_count"` + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + IsPrivate bool `json:"is_private"` + IsSaved bool `json:"is_saved"` + CanBeUpgraded bool `json:"can_be_upgraded"` + WasConverted bool `json:"was_converted"` + WasUpgraded bool `json:"was_upgraded"` + WasRefunded bool `json:"was_refunded"` + UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageGift.Gift = tmp.Gift + messageGift.ReceivedGiftId = tmp.ReceivedGiftId + messageGift.Text = tmp.Text + messageGift.SellStarCount = tmp.SellStarCount + messageGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + messageGift.IsPrivate = tmp.IsPrivate + messageGift.IsSaved = tmp.IsSaved + messageGift.CanBeUpgraded = tmp.CanBeUpgraded + messageGift.WasConverted = tmp.WasConverted + messageGift.WasUpgraded = tmp.WasUpgraded + messageGift.WasRefunded = tmp.WasRefunded + messageGift.UpgradedReceivedGiftId = tmp.UpgradedReceivedGiftId + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + messageGift.SenderId = fieldSenderId + + return nil +} + +// An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift type MessageUpgradedGift struct { meta // The gift Gift *UpgradedGift `json:"gift"` + // Sender of the gift; may be null for anonymous gifts + SenderId MessageSender `json:"sender_id"` + // Unique identifier of the received gift for the current user; only for the receiver of the gift + ReceivedGiftId string `json:"received_gift_id"` // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift IsUpgrade bool `json:"is_upgrade"` - // True, if the gift is displayed on the user's profile page; only for the receiver of the gift + // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` - // True, if the gift can be transferred to another user; only for the receiver of the gift + // True, if the gift can be transferred to another owner; only for the receiver of the gift CanBeTransferred bool `json:"can_be_transferred"` - // True, if the gift was transferred to another user; only for the receiver of the gift + // True, if the gift was transferred to another owner; only for the receiver of the gift WasTransferred bool `json:"was_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -27042,11 +27391,46 @@ func (*MessageUpgradedGift) MessageContentType() string { return TypeMessageUpgradedGift } +func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *UpgradedGift `json:"gift"` + SenderId json.RawMessage `json:"sender_id"` + ReceivedGiftId string `json:"received_gift_id"` + IsUpgrade bool `json:"is_upgrade"` + IsSaved bool `json:"is_saved"` + CanBeTransferred bool `json:"can_be_transferred"` + WasTransferred bool `json:"was_transferred"` + TransferStarCount int64 `json:"transfer_star_count"` + ExportDate int32 `json:"export_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageUpgradedGift.Gift = tmp.Gift + messageUpgradedGift.ReceivedGiftId = tmp.ReceivedGiftId + messageUpgradedGift.IsUpgrade = tmp.IsUpgrade + messageUpgradedGift.IsSaved = tmp.IsSaved + messageUpgradedGift.CanBeTransferred = tmp.CanBeTransferred + messageUpgradedGift.WasTransferred = tmp.WasTransferred + messageUpgradedGift.TransferStarCount = tmp.TransferStarCount + messageUpgradedGift.ExportDate = tmp.ExportDate + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + messageUpgradedGift.SenderId = fieldSenderId + + return nil +} + // A gift which purchase, upgrade or transfer were refunded type MessageRefundedUpgradedGift struct { meta // The gift Gift *Gift `json:"gift"` + // Sender of the gift + SenderId MessageSender `json:"sender_id"` // True, if the gift was obtained by upgrading of a previously received gift IsUpgrade bool `json:"is_upgrade"` } @@ -27071,6 +27455,27 @@ func (*MessageRefundedUpgradedGift) MessageContentType() string { return TypeMessageRefundedUpgradedGift } +func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *Gift `json:"gift"` + SenderId json.RawMessage `json:"sender_id"` + IsUpgrade bool `json:"is_upgrade"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageRefundedUpgradedGift.Gift = tmp.Gift + messageRefundedUpgradedGift.IsUpgrade = tmp.IsUpgrade + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + messageRefundedUpgradedGift.SenderId = fieldSenderId + + return nil +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -28040,6 +28445,10 @@ func (*InputPaidMediaTypePhoto) InputPaidMediaTypeType() string { // The media is a video type InputPaidMediaTypeVideo struct { meta + // Cover of the video; pass null to skip cover uploading + Cover InputFile `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` // Duration of the video, in seconds Duration int32 `json:"duration"` // True, if the video is expected to be streamed @@ -28066,6 +28475,29 @@ func (*InputPaidMediaTypeVideo) InputPaidMediaTypeType() string { return TypeInputPaidMediaTypeVideo } +func (inputPaidMediaTypeVideo *InputPaidMediaTypeVideo) UnmarshalJSON(data []byte) error { + var tmp struct { + Cover json.RawMessage `json:"cover"` + StartTimestamp int32 `json:"start_timestamp"` + Duration int32 `json:"duration"` + SupportsStreaming bool `json:"supports_streaming"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputPaidMediaTypeVideo.StartTimestamp = tmp.StartTimestamp + inputPaidMediaTypeVideo.Duration = tmp.Duration + inputPaidMediaTypeVideo.SupportsStreaming = tmp.SupportsStreaming + + fieldCover, _ := UnmarshalInputFile(tmp.Cover) + inputPaidMediaTypeVideo.Cover = fieldCover + + return nil +} + // Describes a paid media to be sent type InputPaidMedia struct { meta @@ -28767,6 +29199,10 @@ type InputMessageVideo struct { Video InputFile `json:"video"` // Video thumbnail; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` + // Cover of the video; pass null to skip cover uploading; not supported in secret chats and for self-destructing messages + Cover InputFile `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` // File identifiers of the stickers added to the video, if applicable AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` // Duration of the video, in seconds @@ -28811,6 +29247,8 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { var tmp struct { Video json.RawMessage `json:"video"` Thumbnail *InputThumbnail `json:"thumbnail"` + Cover json.RawMessage `json:"cover"` + StartTimestamp int32 `json:"start_timestamp"` AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` Duration int32 `json:"duration"` Width int32 `json:"width"` @@ -28828,6 +29266,7 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { } inputMessageVideo.Thumbnail = tmp.Thumbnail + inputMessageVideo.StartTimestamp = tmp.StartTimestamp inputMessageVideo.AddedStickerFileIds = tmp.AddedStickerFileIds inputMessageVideo.Duration = tmp.Duration inputMessageVideo.Width = tmp.Width @@ -28840,6 +29279,9 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { fieldVideo, _ := UnmarshalInputFile(tmp.Video) inputMessageVideo.Video = fieldVideo + fieldCover, _ := UnmarshalInputFile(tmp.Cover) + inputMessageVideo.Cover = fieldCover + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) inputMessageVideo.SelfDestructType = fieldSelfDestructType @@ -29270,8 +29712,12 @@ type InputMessageForwarded struct { FromChatId int64 `json:"from_chat_id"` // Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded MessageId int64 `json:"message_id"` - // True, if a game message is being shared from a launched game; applies only to game messages + // Pass true if a game message is being shared from a launched game; applies only to game messages InGameShare bool `json:"in_game_share"` + // Pass true to replace video start timestamp in the forwarded message + ReplaceVideoStartTimestamp bool `json:"replace_video_start_timestamp"` + // The new video start timestamp; ignored if replace_video_start_timestamp == false + NewVideoStartTimestamp int32 `json:"new_video_start_timestamp"` // Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual CopyOptions *MessageCopyOptions `json:"copy_options"` } @@ -31238,6 +31684,33 @@ func (*StoryAreaTypeWeather) StoryAreaTypeType() string { return TypeStoryAreaTypeWeather } +// An area with an upgraded gift +type StoryAreaTypeUpgradedGift struct { + meta + // Unique name of the upgraded gift + GiftName string `json:"gift_name"` +} + +func (entity *StoryAreaTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeUpgradedGift) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeUpgradedGift) GetType() string { + return TypeStoryAreaTypeUpgradedGift +} + +func (*StoryAreaTypeUpgradedGift) StoryAreaTypeType() string { + return TypeStoryAreaTypeUpgradedGift +} + // Describes a clickable rectangle area on a story media type StoryArea struct { meta @@ -31508,6 +31981,33 @@ func (*InputStoryAreaTypeWeather) InputStoryAreaTypeType() string { return TypeInputStoryAreaTypeWeather } +// An area with an upgraded gift +type InputStoryAreaTypeUpgradedGift struct { + meta + // Unique name of the upgraded gift + GiftName string `json:"gift_name"` +} + +func (entity *InputStoryAreaTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeUpgradedGift) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeUpgradedGift) GetType() string { + return TypeInputStoryAreaTypeUpgradedGift +} + +func (*InputStoryAreaTypeUpgradedGift) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeUpgradedGift +} + // Describes a clickable rectangle area on a story media to be added type InputStoryArea struct { meta @@ -31555,7 +32055,7 @@ func (inputStoryArea *InputStoryArea) UnmarshalJSON(data []byte) error { // Contains a list of story areas to be added type InputStoryAreas struct { meta - // List of input story areas. Currently, a story can have up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, up to 1 inputStoryAreaTypeMessage area, up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, and up to 3 inputStoryAreaTypeWeather areas + // List of input story areas. Currently, a story can have up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, up to 1 inputStoryAreaTypeMessage area, up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, up to 3 inputStoryAreaTypeWeather areas, and up to 1 inputStoryAreaTypeUpgradedGift area Areas []*InputStoryArea `json:"areas"` } @@ -47975,6 +48475,33 @@ func (*InternalLinkTypeUnsupportedProxy) InternalLinkTypeType() string { return TypeInternalLinkTypeUnsupportedProxy } +// The link is a link to an upgraded gift. Call getUpgradedGift with the given name to process the link +type InternalLinkTypeUpgradedGift struct { + meta + // Name of the unique gift + Name string `json:"name"` +} + +func (entity *InternalLinkTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeUpgradedGift) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeUpgradedGift) GetType() string { + return TypeInternalLinkTypeUpgradedGift +} + +func (*InternalLinkTypeUpgradedGift) InternalLinkTypeType() string { + return TypeInternalLinkTypeUpgradedGift +} + // The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. If the user is found, then call createPrivateChat and open user's profile information screen or the chat itself. If draft text isn't empty, then put the draft text in the input field type InternalLinkTypeUserPhoneNumber struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 4d60653..64c650d 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1055,6 +1055,40 @@ func UnmarshalListOfGiveawayPrize(dataList []json.RawMessage) ([]GiveawayPrize, return list, nil } +func UnmarshalEmojiStatusType(data json.RawMessage) (EmojiStatusType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeEmojiStatusTypeCustomEmoji: + return UnmarshalEmojiStatusTypeCustomEmoji(data) + + case TypeEmojiStatusTypeUpgradedGift: + return UnmarshalEmojiStatusTypeUpgradedGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfEmojiStatusType(dataList []json.RawMessage) ([]EmojiStatusType, error) { + list := []EmojiStatusType{} + + for _, data := range dataList { + entity, err := UnmarshalEmojiStatusType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatMemberStatus(data json.RawMessage) (ChatMemberStatus, error) { var meta meta @@ -2610,6 +2644,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeUnsupported: return UnmarshalLinkPreviewTypeUnsupported(data) + case TypeLinkPreviewTypeUpgradedGift: + return UnmarshalLinkPreviewTypeUpgradedGift(data) + case TypeLinkPreviewTypeUser: return UnmarshalLinkPreviewTypeUser(data) @@ -4093,6 +4130,9 @@ func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { case TypeStoryAreaTypeWeather: return UnmarshalStoryAreaTypeWeather(data) + case TypeStoryAreaTypeUpgradedGift: + return UnmarshalStoryAreaTypeUpgradedGift(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4142,6 +4182,9 @@ func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, erro case TypeInputStoryAreaTypeWeather: return UnmarshalInputStoryAreaTypeWeather(data) + case TypeInputStoryAreaTypeUpgradedGift: + return UnmarshalInputStoryAreaTypeUpgradedGift(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -7003,6 +7046,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeUnsupportedProxy: return UnmarshalInternalLinkTypeUnsupportedProxy(data) + case TypeInternalLinkTypeUpgradedGift: + return UnmarshalInternalLinkTypeUpgradedGift(data) + case TypeInternalLinkTypeUserPhoneNumber: return UnmarshalInternalLinkTypeUserPhoneNumber(data) @@ -9743,6 +9789,14 @@ func UnmarshalUpgradedGiftSymbol(data json.RawMessage) (*UpgradedGiftSymbol, err return &resp, err } +func UnmarshalUpgradedGiftBackdropColors(data json.RawMessage) (*UpgradedGiftBackdropColors, error) { + var resp UpgradedGiftBackdropColors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftBackdrop(data json.RawMessage) (*UpgradedGiftBackdrop, error) { var resp UpgradedGiftBackdrop @@ -9807,16 +9861,16 @@ func UnmarshalSentGiftUpgraded(data json.RawMessage) (*SentGiftUpgraded, error) return &resp, err } -func UnmarshalUserGift(data json.RawMessage) (*UserGift, error) { - var resp UserGift +func UnmarshalReceivedGift(data json.RawMessage) (*ReceivedGift, error) { + var resp ReceivedGift err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUserGifts(data json.RawMessage) (*UserGifts, error) { - var resp UserGifts +func UnmarshalReceivedGifts(data json.RawMessage) (*ReceivedGifts, error) { + var resp ReceivedGifts err := json.Unmarshal(data, &resp) @@ -10175,6 +10229,22 @@ func UnmarshalProfileAccentColor(data json.RawMessage) (*ProfileAccentColor, err return &resp, err } +func UnmarshalEmojiStatusTypeCustomEmoji(data json.RawMessage) (*EmojiStatusTypeCustomEmoji, error) { + var resp EmojiStatusTypeCustomEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiStatusTypeUpgradedGift(data json.RawMessage) (*EmojiStatusTypeUpgradedGift, error) { + var resp EmojiStatusTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiStatus(data json.RawMessage) (*EmojiStatus, error) { var resp EmojiStatus @@ -10191,6 +10261,14 @@ func UnmarshalEmojiStatuses(data json.RawMessage) (*EmojiStatuses, error) { return &resp, err } +func UnmarshalEmojiStatusCustomEmojis(data json.RawMessage) (*EmojiStatusCustomEmojis, error) { + var resp EmojiStatusCustomEmojis + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUsernames(data json.RawMessage) (*Usernames, error) { var resp Usernames @@ -12639,6 +12717,14 @@ func UnmarshalLinkPreviewTypeUnsupported(data json.RawMessage) (*LinkPreviewType return &resp, err } +func UnmarshalLinkPreviewTypeUpgradedGift(data json.RawMessage) (*LinkPreviewTypeUpgradedGift, error) { + var resp LinkPreviewTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeUser(data json.RawMessage) (*LinkPreviewTypeUser, error) { var resp LinkPreviewTypeUser @@ -15151,6 +15237,14 @@ func UnmarshalStoryAreaTypeWeather(data json.RawMessage) (*StoryAreaTypeWeather, return &resp, err } +func UnmarshalStoryAreaTypeUpgradedGift(data json.RawMessage) (*StoryAreaTypeUpgradedGift, error) { + var resp StoryAreaTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { var resp StoryArea @@ -15215,6 +15309,14 @@ func UnmarshalInputStoryAreaTypeWeather(data json.RawMessage) (*InputStoryAreaTy return &resp, err } +func UnmarshalInputStoryAreaTypeUpgradedGift(data json.RawMessage) (*InputStoryAreaTypeUpgradedGift, error) { + var resp InputStoryAreaTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { var resp InputStoryArea @@ -19439,6 +19541,14 @@ func UnmarshalInternalLinkTypeUnsupportedProxy(data json.RawMessage) (*InternalL return &resp, err } +func UnmarshalInternalLinkTypeUpgradedGift(data json.RawMessage) (*InternalLinkTypeUpgradedGift, error) { + var resp InternalLinkTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeUserPhoneNumber(data json.RawMessage) (*InternalLinkTypeUserPhoneNumber, error) { var resp InternalLinkTypeUserPhoneNumber @@ -22433,6 +22543,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpgradedGiftSymbol: return UnmarshalUpgradedGiftSymbol(data) + case TypeUpgradedGiftBackdropColors: + return UnmarshalUpgradedGiftBackdropColors(data) + case TypeUpgradedGiftBackdrop: return UnmarshalUpgradedGiftBackdrop(data) @@ -22457,11 +22570,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSentGiftUpgraded: return UnmarshalSentGiftUpgraded(data) - case TypeUserGift: - return UnmarshalUserGift(data) + case TypeReceivedGift: + return UnmarshalReceivedGift(data) - case TypeUserGifts: - return UnmarshalUserGifts(data) + case TypeReceivedGifts: + return UnmarshalReceivedGifts(data) case TypeGiftUpgradePreview: return UnmarshalGiftUpgradePreview(data) @@ -22595,12 +22708,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeProfileAccentColor: return UnmarshalProfileAccentColor(data) + case TypeEmojiStatusTypeCustomEmoji: + return UnmarshalEmojiStatusTypeCustomEmoji(data) + + case TypeEmojiStatusTypeUpgradedGift: + return UnmarshalEmojiStatusTypeUpgradedGift(data) + case TypeEmojiStatus: return UnmarshalEmojiStatus(data) case TypeEmojiStatuses: return UnmarshalEmojiStatuses(data) + case TypeEmojiStatusCustomEmojis: + return UnmarshalEmojiStatusCustomEmojis(data) + case TypeUsernames: return UnmarshalUsernames(data) @@ -23519,6 +23641,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeUnsupported: return UnmarshalLinkPreviewTypeUnsupported(data) + case TypeLinkPreviewTypeUpgradedGift: + return UnmarshalLinkPreviewTypeUpgradedGift(data) + case TypeLinkPreviewTypeUser: return UnmarshalLinkPreviewTypeUser(data) @@ -24461,6 +24586,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryAreaTypeWeather: return UnmarshalStoryAreaTypeWeather(data) + case TypeStoryAreaTypeUpgradedGift: + return UnmarshalStoryAreaTypeUpgradedGift(data) + case TypeStoryArea: return UnmarshalStoryArea(data) @@ -24485,6 +24613,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputStoryAreaTypeWeather: return UnmarshalInputStoryAreaTypeWeather(data) + case TypeInputStoryAreaTypeUpgradedGift: + return UnmarshalInputStoryAreaTypeUpgradedGift(data) + case TypeInputStoryArea: return UnmarshalInputStoryArea(data) @@ -26069,6 +26200,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeUnsupportedProxy: return UnmarshalInternalLinkTypeUnsupportedProxy(data) + case TypeInternalLinkTypeUpgradedGift: + return UnmarshalInternalLinkTypeUpgradedGift(data) + case TypeInternalLinkTypeUserPhoneNumber: return UnmarshalInternalLinkTypeUserPhoneNumber(data) diff --git a/data/td_api.tl b/data/td_api.tl index 9a83811..f0ffcfb 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -618,7 +618,7 @@ botVerificationParameters icon_custom_emoji_id:int64 organization_name:string de //@description Describes verification status provided by a bot //@bot_user_id Identifier of the bot that provided the verification //@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign -//@custom_description Custom description of verification reason set by the bot +//@custom_description Custom description of verification reason set by the bot. Can contain only Mention, Hashtag, Cashtag, PhoneNumber, BankCardNumber, Url, and EmailAddress entities botVerification bot_user_id:int53 icon_custom_emoji_id:int64 custom_description:formattedText = BotVerification; //@description Contains information about verification status of a chat or a user @@ -1040,61 +1040,69 @@ upgradedGiftModel name:string sticker:sticker rarity_per_mille:int32 = UpgradedG //@rarity_per_mille The number of upgraded gift that receive this symbol for each 1000 gifts upgraded upgradedGiftSymbol name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftSymbol; -//@description Describes a backdrop of an upgraded gift -//@name Name of the backdrop +//@description Describes colors of a backdrop of an upgraded gift //@center_color A color in the center of the backdrop in the RGB format //@edge_color A color on the edges of the backdrop in the RGB format //@symbol_color A color to be applied for the symbol in the RGB format //@text_color A color for the text on the backdrop in the RGB format +upgradedGiftBackdropColors center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 = UpgradedGiftBackdropColors; + +//@description Describes a backdrop of an upgraded gift +//@name Name of the backdrop +//@colors Colors of the backdrop //@rarity_per_mille The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded -upgradedGiftBackdrop name:string center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 rarity_per_mille:int32 = UpgradedGiftBackdrop; +upgradedGiftBackdrop name:string colors:upgradedGiftBackdropColors rarity_per_mille:int32 = UpgradedGiftBackdrop; //@description Describes the original details about the gift -//@sender_user_id Identifier of the user that sent the gift; 0 if the gift was private -//@receiver_user_id Identifier of the user that received the gift +//@sender_id Identifier of the user or the chat that sent the gift; may be null if the gift was private +//@receiver_id Identifier of the user or the chat that received the gift //@text Message added to the gift //@date Point in time (Unix timestamp) when the gift was sent -upgradedGiftOriginalDetails sender_user_id:int53 receiver_user_id:int53 text:formattedText date:int32 = UpgradedGiftOriginalDetails; +upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender text:formattedText date:int32 = UpgradedGiftOriginalDetails; -//@description Describes a gift that can be sent to another user +//@description Describes a gift that can be sent to another user or channel chat //@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 regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed //@upgrade_star_count Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible //@is_for_birthday True, if the gift is a birthday gift -//@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out -//@total_count Number of total times the gift can be purchased by all users; 0 if not limited +//@remaining_count Number of remaining times the gift can be purchased; 0 if not limited or the gift was sold out +//@total_count Number of total times the gift can be purchased; 0 if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; -//@description Contains a list of gifts that can be sent to another user @gifts The list of gifts +//@description Contains a list of gifts that can be sent to another user or channel chat @gifts The list of gifts gifts gifts:vector = Gifts; -//@description Describes an upgraded gift that can be gifted to another user or transferred to TON blockchain as an NFT +//@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift //@title The title of the upgraded gift +//@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift //@total_upgraded_count Total number of gifts that were upgraded from the same gift //@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift -//@owner_user_id User identifier of the user that owns the upgraded gift; 0 if none +//@owner_id Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown +//@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none +//@owner_name Name of the owner for the case when owner identifier and address aren't known //@model Model of the upgraded gift //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown -upgradedGift id:int64 title:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_user_id:int53 model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; +upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; //@description Contains result of gift upgrading //@gift The upgraded gift -//@is_saved True, if the gift is displayed on the user's profile page -//@can_be_transferred True, if the gift can be transferred to another user +//@received_gift_id Unique identifier of the received gift for the current user +//@is_saved True, if the gift is displayed on the user's or the channel's profile page +//@can_be_transferred True, if the gift can be transferred to another owner //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT -upgradeGiftResult gift:upgradedGift is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; +//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT +upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; -//@class SentGift @description Represents a gift received by a user +//@class SentGift @description Represents content of a gift received by a user or a channel chat //@description Regular gift @gift The gift sentGiftRegular gift:gift = SentGift; @@ -1103,28 +1111,29 @@ sentGiftRegular gift:gift = SentGift; sentGiftUpgraded gift:upgradedGift = SentGift; -//@description Represents a gift received by a user -//@sender_user_id Identifier of the user that sent the gift; 0 if unknown +//@description Represents a gift received by a user or a chat +//@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift +//@sender_id Identifier of a user or a chat that sent the gift; may be null 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; only for the receiver of the gift +//@is_saved True, if the gift is displayed on the chat's profile page; only for the receiver of the gift //@can_be_upgraded True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift -//@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another user; only for the receiver of the gift +//@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift //@was_refunded True, if the gift was refunded and isn't available anymore //@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 receiver of the gift //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -userGift sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift message_id:int53 sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = UserGift; +//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; -//@description Represents a list of gifts received by a user +//@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts //@gifts The list of gifts +//@are_notifications_enabled True, if notifications about new gifts of the owner are enabled //@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; +receivedGifts total_count:int32 gifts:vector are_notifications_enabled:Bool next_offset:string = ReceivedGifts; //@description Contains examples of possible upgraded gifts for the given regular gift //@models Examples of possible models that can be chosen for the gift after upgrade @@ -1235,13 +1244,13 @@ starTransactionTypeChannelSubscriptionPurchase chat_id:int53 subscription_period //@subscription_period The number of seconds between consecutive Telegram Star debitings starTransactionTypeChannelSubscriptionSale user_id:int53 subscription_period:int32 = StarTransactionType; -//@description The transaction is a purchase of a regular gift to another user; for regular users and bots only @user_id Identifier of the user that received the gift @gift The gift -starTransactionTypeGiftPurchase user_id:int53 gift:gift = StarTransactionType; +//@description The transaction is a purchase of a regular gift; for regular users and bots only @owner_id Identifier of the user or the channel that received the gift @gift The gift +starTransactionTypeGiftPurchase owner_id:MessageSender gift:gift = StarTransactionType; -//@description The transaction is a transfer of an upgraded gift to another user; for regular users only @user_id Identifier of the user that received the gift @gift The gift -starTransactionTypeGiftTransfer user_id:int53 gift:upgradedGift = StarTransactionType; +//@description The transaction is a transfer of an upgraded gift; for regular users only @owner_id Identifier of the user or the channel that received the gift @gift The gift +starTransactionTypeGiftTransfer owner_id:MessageSender gift:upgradedGift = StarTransactionType; -//@description The transaction is a sale of a gift received from another user or bot; for regular users only @user_id Identifier of the user that sent the gift @gift The gift +//@description The transaction is a sale of a received gift; for regular users and channel chats only @user_id Identifier of the user that sent the gift @gift The gift starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; //@description The transaction is an upgrade of a gift; for regular users only @gift The upgraded gift @@ -1351,13 +1360,32 @@ profileAccentColors palette_colors:vector background_colors:vector //@min_channel_chat_boost_level The minimum chat boost level required to use the color in a channel chat profileAccentColor id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_supergroup_chat_boost_level:int32 min_channel_chat_boost_level:int32 = ProfileAccentColor; -//@description Describes a custom emoji to be shown instead of the Telegram Premium badge -//@custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format + +//@class EmojiStatusType @description Describes type of emoji status + +//@description A custom emoji set as emoji status @custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format +emojiStatusTypeCustomEmoji custom_emoji_id:int64 = EmojiStatusType; + +//@description An upgraded gift set as emoji status +//@upgraded_gift_id Identifier of the upgraded gift +//@gift_title The title of the upgraded gift +//@gift_name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift +//@model_custom_emoji_id Custom emoji identifier of the model of the upgraded gift +//@symbol_custom_emoji_id Custom emoji identifier of the symbol of the upgraded gift +//@backdrop_colors Colors of the backdrop of the upgraded gift +emojiStatusTypeUpgradedGift upgraded_gift_id:int64 gift_title:string gift_name:string model_custom_emoji_id:int64 symbol_custom_emoji_id:int64 backdrop_colors:upgradedGiftBackdropColors = EmojiStatusType; + + +//@description Describes an emoji to be shown instead of the Telegram Premium badge +//@type Type of the emoji status //@expiration_date Point in time (Unix timestamp) when the status will expire; 0 if never -emojiStatus custom_emoji_id:int64 expiration_date:int32 = EmojiStatus; +emojiStatus type:EmojiStatusType expiration_date:int32 = EmojiStatus; + +//@description Contains a list of emoji statuses @emoji_statuses The list of emoji statuses identifiers +emojiStatuses emoji_statuses:vector = EmojiStatuses; //@description Contains a list of custom emoji identifiers for emoji statuses @custom_emoji_ids The list of custom emoji identifiers -emojiStatuses custom_emoji_ids:vector = EmojiStatuses; +emojiStatusCustomEmojis custom_emoji_ids:vector = EmojiStatusCustomEmojis; //@description Describes usernames assigned to a user, a supergroup, or a channel @@ -1443,7 +1471,7 @@ botInfo short_description:string description:string photo:photo animation:animat //@bio A short user bio; may be null for bots //@birthdate Birthdate of the user; may be null if unknown //@personal_chat_id Identifier of the personal chat of the user; 0 if none -//@gift_count Number of gifts saved to profile by the user +//@gift_count Number of saved to profile gifts for other users or the total number of received gifts for the current 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 //@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown //@business_info Information about business settings for Telegram Business accounts; may be null if none @@ -1713,6 +1741,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@can_get_statistics True, if the supergroup or channel statistics are available //@can_get_revenue_statistics True, if the supergroup or channel revenue statistics are available //@can_get_star_revenue_statistics True, if the supergroup or channel Telegram Star revenue statistics are available +//@can_send_gift True, if the user can send a gift to the supergroup or channel using sendGift or transferGift //@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup //@is_all_history_available True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available, //-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators @@ -1720,6 +1749,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators //@has_paid_media_allowed True, if paid media can be sent and forwarded to the channel chat; for channels only //@has_pinned_stories True, if the supergroup or channel has pinned stories +//@gift_count Number of saved to profile gifts for channels without can_post_messages administrator right, otherwise, the total number of received gifts //@my_boost_count Number of times the current user boosted the supergroup or channel //@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified //@sticker_set_id Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none @@ -1730,7 +1760,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -3124,6 +3154,9 @@ linkPreviewTypeTheme documents:vector settings:themeSettings = LinkPre //@description The link preview type is unsupported yet linkPreviewTypeUnsupported = LinkPreviewType; +//@description The link is a link to an upgraded gift @gift The gift +linkPreviewTypeUpgradedGift gift:upgradedGift = LinkPreviewType; + //@description The link is a link to a user @photo Photo of the user; may be null if none @is_bot True, if the user is a bot linkPreviewTypeUser photo:chatPhoto is_bot:Bool = LinkPreviewType; @@ -3382,8 +3415,11 @@ paidMediaPreview width:int32 height:int32 duration:int32 minithumbnail:minithumb //@description The media is a photo @photo The photo paidMediaPhoto photo:photo = PaidMedia; -//@description The media is a video @video The video -paidMediaVideo video:video = PaidMedia; +//@description The media is a video +//@video The video +//@cover Cover of the video; may be null if none +//@start_timestamp Timestamp from which the video playing must start, in seconds +paidMediaVideo video:video cover:photo start_timestamp:int32 = PaidMedia; //@description The media is unsupported paidMediaUnsupported = PaidMedia; @@ -3725,11 +3761,13 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent; //@description A video message //@video The video description //@alternative_videos Alternative qualities of the video +//@cover Cover of the video; may be null if none +//@start_timestamp Timestamp from which the video playing must start, in seconds //@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 alternative_videos:vector caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; +messageVideo video:video alternative_videos:vector cover:photo start_timestamp:int32 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; @@ -4003,33 +4041,39 @@ 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 regular gift was received or sent by the current user +//@description A regular gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift +//@sender_id Sender of the gift +//@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of 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 regular gift; 0 if the gift can't be sold by the receiver //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade 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 +//@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift //@can_be_upgraded True, if the gift can be upgraded to a unique gift; 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 //@was_upgraded True, if the gift was upgraded to a unique gift //@was_refunded True, if the gift was refunded and isn't available anymore -//@upgrade_message_id Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift with upgraded version of the gift; can be 0 if none or an identifier of a deleted message. -//-Use getUserGift to get information about the gift -messageGift gift:gift text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgrade_message_id:int53 = MessageContent; +//@upgraded_received_gift_id Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift +messageGift gift:gift sender_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; -//@description An upgraded gift was received or sent by the current user +//@description An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift +//@sender_id Sender of the gift; may be null for anonymous gifts +//@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift -//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift -//@can_be_transferred True, if the gift can be transferred to another user; only for the receiver of the gift -//@was_transferred True, if the gift was transferred to another user; only for the receiver of the gift +//@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift +//@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift +//@was_transferred True, if the gift was transferred to another owner; only for the receiver of the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; +//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; -//@description A gift which purchase, upgrade or transfer were refunded @gift The gift @is_upgrade True, if the gift was obtained by upgrading of a previously received gift -messageRefundedUpgradedGift gift:gift is_upgrade:Bool = MessageContent; +//@description A gift which purchase, upgrade or transfer were refunded +//@gift The gift +//@sender_id Sender of the gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift +messageRefundedUpgradedGift gift:gift sender_id:MessageSender is_upgrade:Bool = MessageContent; //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4144,9 +4188,11 @@ inputThumbnail thumbnail:InputFile width:int32 height:int32 = InputThumbnail; inputPaidMediaTypePhoto = InputPaidMediaType; //@description The media is a video +//@cover Cover of the video; pass null to skip cover uploading +//@start_timestamp Timestamp from which the video playing must start, in seconds //@duration Duration of the video, in seconds //@supports_streaming True, if the video is expected to be streamed -inputPaidMediaTypeVideo duration:int32 supports_streaming:Bool = InputPaidMediaType; +inputPaidMediaTypeVideo cover:InputFile start_timestamp:int32 duration:int32 supports_streaming:Bool = InputPaidMediaType; //@description Describes a paid media to be sent @@ -4270,6 +4316,8 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh //@description A video message //@video Video to be sent. The video is expected to be re-encoded to MPEG4 format with H.264 codec by the sender //@thumbnail Video thumbnail; pass null to skip thumbnail uploading +//@cover Cover of the video; pass null to skip cover uploading; not supported in secret chats and for self-destructing messages +//@start_timestamp Timestamp from which the video playing must start, in seconds //@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 @@ -4279,7 +4327,7 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh //@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 //@has_spoiler True, if the video preview must be covered by a spoiler animation; not supported in secret chats -inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; +inputMessageVideo video:InputFile thumbnail:inputThumbnail cover:InputFile start_timestamp:int32 added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; //@description A video note message //@video_note Video note to be sent. The video is expected to be encoded to MPEG4 format with H.264 codec and have no data outside of the visible circle @@ -4350,9 +4398,11 @@ inputMessageStory story_sender_chat_id:int53 story_id:int32 = InputMessageConten //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from //@message_id Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded -//@in_game_share True, if a game message is being shared from a launched game; applies only to game messages +//@in_game_share Pass true if a game message is being shared from a launched game; applies only to game messages +//@replace_video_start_timestamp Pass true to replace video start timestamp in the forwarded message +//@new_video_start_timestamp The new video start timestamp; ignored if replace_video_start_timestamp == false //@copy_options Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual -inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool copy_options:messageCopyOptions = InputMessageContent; +inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool replace_video_start_timestamp:Bool new_video_start_timestamp:int32 copy_options:messageCopyOptions = InputMessageContent; //@description Contains properties of a message and describes actions that can be done with the message right now @@ -4656,6 +4706,10 @@ storyAreaTypeLink url:string = StoryAreaType; //@background_color A color of the area background in the ARGB format storyAreaTypeWeather temperature:double emoji:string background_color:int32 = StoryAreaType; +//@description An area with an upgraded gift +//@gift_name Unique name of the upgraded gift +storyAreaTypeUpgradedGift gift_name:string = StoryAreaType; + //@description Describes a clickable rectangle area on a story media @position Position of the area @type Type of the area storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; @@ -4697,6 +4751,9 @@ inputStoryAreaTypeLink url:string = InputStoryAreaType; //@background_color A color of the area background in the ARGB format inputStoryAreaTypeWeather temperature:double emoji:string background_color:int32 = InputStoryAreaType; +//@description An area with an upgraded gift @gift_name Unique name of the upgraded gift +inputStoryAreaTypeUpgradedGift gift_name:string = InputStoryAreaType; + //@description Describes a clickable rectangle area on a story media to be added @position Position of the area @type Type of the area inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryArea; @@ -4705,8 +4762,9 @@ inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryAr //-up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, //-up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, //-up to 1 inputStoryAreaTypeMessage area, -//-up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, and -//-up to 3 inputStoryAreaTypeWeather areas +//-up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, +//-up to 3 inputStoryAreaTypeWeather areas, and +//-up to 1 inputStoryAreaTypeUpgradedGift area inputStoryAreas areas:vector = InputStoryAreas; @@ -7217,6 +7275,9 @@ internalLinkTypeUnknownDeepLink link:string = InternalLinkType; //@description The link is a link to an unsupported proxy. An alert can be shown to the user internalLinkTypeUnsupportedProxy = InternalLinkType; +//@description The link is a link to an upgraded gift. Call getUpgradedGift with the given name to process the link @name Name of the unique gift +internalLinkTypeUpgradedGift name:string = InternalLinkType; + //@description The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. //-If the user is found, then call createPrivateChat and open user's profile information screen or the chat itself. If draft text isn't empty, then put the draft text in the input field //@phone_number Phone number of the user @@ -8886,6 +8947,19 @@ getChatSimilarChatCount chat_id:int53 return_local:Bool = Count; //@opened_chat_id Identifier of the opened chat openChatSimilarChat chat_id:int53 opened_chat_id:int53 = Ok; +//@description Returns a list of bots similar to the given bot @bot_user_id User identifier of the target bot +getBotSimilarBots bot_user_id:int53 = Users; + +//@description Returns approximate number of bots similar to the given bot +//@bot_user_id User identifier of the target bot +//@return_local Pass true to get the number of bots without sending network requests, or -1 if the number of bots is unknown locally +getBotSimilarBotCount bot_user_id:int53 return_local:Bool = Count; + +//@description Informs TDLib that a bot was opened from the list of similar bots +//@bot_user_id Identifier of the original bot, which similar bots were requested +//@opened_bot_user_id Identifier of the opened bot +openBotSimilarBot bot_user_id:int53 opened_bot_user_id:int53 = Ok; + //@description Returns a list of frequently used chats @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30 getTopChats category:TopChatCategory limit:int32 = Chats; @@ -9292,7 +9366,7 @@ addLocalMessage chat_id:int53 sender_id:MessageSender reply_to:InputMessageReply //@revoke Pass true to delete messages for all chat members. Always true for supergroups, channels and secret chats deleteMessages chat_id:int53 message_ids:vector revoke:Bool = Ok; -//@description Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator privileges @chat_id Chat identifier @sender_id Identifier of the sender of messages to delete +//@description Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator right @chat_id Chat identifier @sender_id Identifier of the sender of messages to delete deleteChatMessagesBySender chat_id:int53 sender_id:MessageSender = Ok; //@description Deletes all messages between the specified dates in a chat. Supported only for private chats and basic groups. Messages sent in the last 30 seconds will not be deleted @@ -10549,26 +10623,29 @@ toggleBotIsAddedToAttachmentMenu bot_user_id:int53 is_added:Bool allow_write_acc //@description Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list for self status -getThemedEmojiStatuses = EmojiStatuses; +getThemedEmojiStatuses = EmojiStatusCustomEmojis; //@description Returns recent emoji statuses for self status getRecentEmojiStatuses = EmojiStatuses; +//@description Returns available upgraded gift emoji statuses for self status +getUpgradedGiftEmojiStatuses = EmojiStatuses; + //@description Returns default emoji statuses for self status -getDefaultEmojiStatuses = EmojiStatuses; +getDefaultEmojiStatuses = EmojiStatusCustomEmojis; //@description Clears the list of recently used emoji statuses for self status clearRecentEmojiStatuses = Ok; //@description Returns up to 8 emoji statuses, which must be shown in the emoji status list for chats -getThemedChatEmojiStatuses = EmojiStatuses; +getThemedChatEmojiStatuses = EmojiStatusCustomEmojis; //@description Returns default emoji statuses for chats -getDefaultChatEmojiStatuses = EmojiStatuses; +getDefaultChatEmojiStatuses = EmojiStatusCustomEmojis; //@description Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true -getDisallowedChatEmojiStatuses = EmojiStatuses; +getDisallowedChatEmojiStatuses = EmojiStatusCustomEmojis; //@description Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates @@ -11652,52 +11729,67 @@ deleteSavedOrderInfo = Ok; deleteSavedCredentials = Ok; -//@description Returns gifts that can be sent to other users +//@description Returns gifts that can be sent to other users and channel chats getAvailableGifts = Gifts; -//@description Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out +//@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send -//@user_id Identifier of the user that will receive the gift +//@owner_id Identifier of the user or the channel chat 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 +//@is_private Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them //@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free -sendGift gift_id:int64 user_id:int53 text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; +sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool pay_for_upgrade: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 Sells a gift for Telegram Stars @received_gift_id Identifier of the gift +sellGift received_gift_id:string = 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 Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the chat +//@received_gift_id Identifier of the gift +//@is_saved Pass true to display the gift on the user's or the channel's profile page; pass false to remove it from the profile page +toggleGiftIsSaved received_gift_id:string is_saved:Bool = Ok; + +//@description Toggles whether notifications for new gifts received by a channel chat are sent to the current user; requires can_post_messages administrator right in the chat +//@chat_id Identifier of the channel chat +//@are_enabled Pass true to enable notifications about new gifts owned by the channel chat; pass false to disable the notifications +toggleChatGiftNotifications chat_id:int53 are_enabled:Bool = Ok; //@description Returns examples of possible upgraded gifts for a regular gift @gift_id Identifier of the gift getGiftUpgradePreview gift_id:int64 = GiftUpgradePreview; -//@description Upgrades a gift received by the current user. Unless the gift has prepaid_upgrade_star_count > 0, the user must pay gift.upgrade_star_count Telegram Stars for the upgrade -//@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 +//@description Upgrades a regular gift +//@received_gift_id Identifier of the gift //@keep_original_details Pass true to keep the original gift text, sender and receiver in the upgraded gift -upgradeGift sender_user_id:int53 message_id:int53 keep_original_details:Bool = UpgradeGiftResult; +//@star_count The amount of Telegram Stars required to pay for the upgrade. It the gift has prepaid_upgrade_star_count > 0, then pass 0, otherwise, pass gift.upgrade_star_count +upgradeGift received_gift_id:string keep_original_details:Bool star_count:int53 = UpgradeGiftResult; -//@description Sends a gift upgraded by the current user to another user -//@sender_user_id Identifier of the user that sent the gift -//@message_id Identifier of the message with the upgraded gift in the chat with the user -//@receiver_user_id Identifier of the user that will receive the gift -//@star_count The amount of Telegram Stars required for the transfer -transferGift sender_user_id:int53 message_id:int53 receiver_user_id:int53 star_count:int53 = Ok; +//@description Sends an upgraded gift to another user or a channel chat +//@received_gift_id Identifier of the gift +//@new_owner_id Identifier of the user or the channel chat that will receive the gift +//@star_count The amount of Telegram Stars required to pay for the transfer +transferGift received_gift_id:string new_owner_id:MessageSender star_count:int53 = Ok; -//@description Returns gifts saved to profile by the given user -//@user_id Identifier of the user +//@description Returns gifts received by the given user or chat +//@owner_id Identifier of the gift receiver +//@exclude_unsaved Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right +//@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page; for channel chats with can_post_messages administrator right only +//@exclude_unlimited Pass true to exclude gifts that can be purchased unlimited number of times; for channel chats with can_post_messages administrator right only +//@exclude_limited Pass true to exclude gifts that can be purchased limited number of times; for channel chats with can_post_messages administrator right only +//@exclude_upgraded Pass true to exclude upgraded gifts; for channel chats with can_post_messages administrator right only +//@sort_by_price Pass true to sort results by gift price instead of send date; for channel chats with can_post_messages administrator right only //@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; +getReceivedGifts owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; -//@description Returns information about a gift received or sent by the current user @message_id Identifier of the message with the gift -getUserGift message_id:int53 = UserGift; +//@description Returns information about a received gift @received_gift_id Identifier of the gift +getReceivedGift received_gift_id:string = ReceivedGift; + +//@description Returns information about an upgraded gift by its name @name Unique name of the upgraded gift +getUpgradedGift name:string = UpgradedGift; + +//@description Returns a URL for upgraded gift withdrawal in the TON blockchain as an NFT; requires owner privileges for gifts owned by a chat +//@received_gift_id Identifier of the gift +//@password The 2-step verification password of the current user +getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; //@description Creates a link for the given invoice; for bots only From baee9b059de55dff8e759bc22a6abf275ac2933e Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 14 Feb 2025 02:21:05 +0800 Subject: [PATCH 10/29] Update to TDLib 1.8.45 --- client/function.go | 77 +++++++++++++------ client/type.go | 172 +++++++++++++++++++++++++++++++++++++++++- client/unmarshaler.go | 98 ++++++++++++++++++++++++ data/td_api.tl | 75 ++++++++++++------ 4 files changed, 374 insertions(+), 48 deletions(-) diff --git a/client/function.go b/client/function.go index 02621ab..46a1a11 100755 --- a/client/function.go +++ b/client/function.go @@ -5963,6 +5963,32 @@ func (client *Client) RemoveMessageReaction(req *RemoveMessageReactionRequest) ( return UnmarshalOk(result.Data) } +type GetChatAvailablePaidMessageReactionSendersRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns the list of message sender identifiers, which can be used to send a paid reaction in a chat +func (client *Client) GetChatAvailablePaidMessageReactionSenders(req *GetChatAvailablePaidMessageReactionSendersRequest) (*MessageSenders, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatAvailablePaidMessageReactionSenders", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageSenders(result.Data) +} + type AddPendingPaidMessageReactionRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` @@ -5970,10 +5996,8 @@ type AddPendingPaidMessageReactionRequest struct { MessageId int64 `json:"message_id"` // Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_reaction_star_count_max") StarCount int64 `json:"star_count"` - // Pass true if the user didn't choose anonymity explicitly, for example, the reaction is set from the message bubble - UseDefaultIsAnonymous bool `json:"use_default_is_anonymous"` - // Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors. Ignored if use_default_is_anonymous == true - IsAnonymous bool `json:"is_anonymous"` + // Type of the paid reaction; pass null if the user didn't choose reaction type explicitly, for example, the reaction is set from the message bubble + Type PaidReactionType `json:"type"` } // Adds the paid message reaction to a message. Use getMessageAvailableReactions to check whether the reaction is available for the message @@ -5986,8 +6010,7 @@ func (client *Client) AddPendingPaidMessageReaction(req *AddPendingPaidMessageRe "chat_id": req.ChatId, "message_id": req.MessageId, "star_count": req.StarCount, - "use_default_is_anonymous": req.UseDefaultIsAnonymous, - "is_anonymous": req.IsAnonymous, + "type": req.Type, }, }) if err != nil { @@ -6059,25 +6082,25 @@ func (client *Client) RemovePendingPaidMessageReactions(req *RemovePendingPaidMe return UnmarshalOk(result.Data) } -type TogglePaidMessageReactionIsAnonymousRequest struct { +type SetPaidMessageReactionTypeRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors - IsAnonymous bool `json:"is_anonymous"` + // New type of the paid reaction + Type PaidReactionType `json:"type"` } -// Changes whether the paid message reaction of the user to a message is anonymous. The message must have paid reaction added by the user -func (client *Client) TogglePaidMessageReactionIsAnonymous(req *TogglePaidMessageReactionIsAnonymousRequest) (*Ok, error) { +// Changes type of paid message reaction of the current user on a message. The message must have paid reaction added by the current user +func (client *Client) SetPaidMessageReactionType(req *SetPaidMessageReactionTypeRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "togglePaidMessageReactionIsAnonymous", + Type: "setPaidMessageReactionType", }, Data: map[string]interface{}{ "chat_id": req.ChatId, "message_id": req.MessageId, - "is_anonymous": req.IsAnonymous, + "type": req.Type, }, }) if err != nil { @@ -7318,7 +7341,7 @@ func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, type GetMainWebAppRequest struct { // Identifier of the chat in which the Web App is opened; pass 0 if none ChatId int64 `json:"chat_id"` - // Identifier of the target bot + // Identifier of the target bot. If the bot is restricted for the current user, then show an error instead of calling the method BotUserId int64 `json:"bot_user_id"` // Start parameter from internalLinkTypeMainWebApp StartParameter string `json:"start_parameter"` @@ -7351,7 +7374,7 @@ func (client *Client) GetMainWebApp(req *GetMainWebAppRequest) (*MainWebApp, err } type GetWebAppUrlRequest struct { - // Identifier of the target bot + // Identifier of the target bot. If the bot is restricted for the current user, then show an error instead of calling the method BotUserId int64 `json:"bot_user_id"` // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu Url string `json:"url"` @@ -7417,7 +7440,7 @@ func (client *Client) SendWebAppData(req *SendWebAppDataRequest) (*Ok, error) { type OpenWebAppRequest struct { // Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats ChatId int64 `json:"chat_id"` - // Identifier of the bot, providing the Web App + // Identifier of the bot, providing the Web App. If the bot is restricted for the current user, then show an error instead of calling the method BotUserId int64 `json:"bot_user_id"` // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise Url string `json:"url"` @@ -12551,13 +12574,13 @@ func (client *Client) SearchFileDownloads(req *SearchFileDownloadsRequest) (*Fou } type SetApplicationVerificationTokenRequest struct { - // Unique identifier for the verification process as received from updateApplicationVerificationRequired + // Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired VerificationId int64 `json:"verification_id"` - // Play Integrity API token for the Android application, or secret from push notification for the iOS application; pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request + // Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request Token string `json:"token"` } -// Application verification has been completed. Can be called before authorization +// Application or reCAPTCHA verification has been completed. Can be called before authorization func (client *Client) SetApplicationVerificationToken(req *SetApplicationVerificationTokenRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19097,15 +19120,15 @@ type GetReceivedGiftsRequest struct { OwnerId MessageSender `json:"owner_id"` // Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right ExcludeUnsaved bool `json:"exclude_unsaved"` - // Pass true to exclude gifts that are saved to the chat's profile page; for channel chats with can_post_messages administrator right only + // Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right ExcludeSaved bool `json:"exclude_saved"` - // Pass true to exclude gifts that can be purchased unlimited number of times; for channel chats with can_post_messages administrator right only + // Pass true to exclude gifts that can be purchased unlimited number of times ExcludeUnlimited bool `json:"exclude_unlimited"` - // Pass true to exclude gifts that can be purchased limited number of times; for channel chats with can_post_messages administrator right only + // Pass true to exclude gifts that can be purchased limited number of times ExcludeLimited bool `json:"exclude_limited"` - // Pass true to exclude upgraded gifts; for channel chats with can_post_messages administrator right only + // Pass true to exclude upgraded gifts ExcludeUpgraded bool `json:"exclude_upgraded"` - // Pass true to sort results by gift price instead of send date; for channel chats with can_post_messages administrator right only + // Pass true to sort results by gift price instead of send date SortByPrice bool `json:"sort_by_price"` // 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"` @@ -24375,6 +24398,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateApplicationVerificationRequired: return UnmarshalUpdateApplicationVerificationRequired(result.Data) + case TypeUpdateApplicationRecaptchaVerificationRequired: + return UnmarshalUpdateApplicationRecaptchaVerificationRequired(result.Data) + case TypeUpdateCall: return UnmarshalUpdateCall(result.Data) @@ -24480,6 +24506,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(result.Data) + case TypeUpdateDefaultPaidReactionType: + return UnmarshalUpdateDefaultPaidReactionType(result.Data) + case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(result.Data) diff --git a/client/type.go b/client/type.go index 1603b60..8743a91 100755 --- a/client/type.go +++ b/client/type.go @@ -42,6 +42,7 @@ const ( ClassMessageReadDate = "MessageReadDate" ClassMessageOrigin = "MessageOrigin" ClassReactionType = "ReactionType" + ClassPaidReactionType = "PaidReactionType" ClassMessageEffectType = "MessageEffectType" ClassMessageSendingState = "MessageSendingState" ClassMessageReplyTo = "MessageReplyTo" @@ -904,6 +905,9 @@ const ( TypeReactionTypeEmoji = "reactionTypeEmoji" TypeReactionTypeCustomEmoji = "reactionTypeCustomEmoji" TypeReactionTypePaid = "reactionTypePaid" + TypePaidReactionTypeRegular = "paidReactionTypeRegular" + TypePaidReactionTypeAnonymous = "paidReactionTypeAnonymous" + TypePaidReactionTypeChat = "paidReactionTypeChat" TypePaidReactor = "paidReactor" TypeMessageForwardInfo = "messageForwardInfo" TypeMessageImportInfo = "messageImportInfo" @@ -2217,6 +2221,7 @@ const ( TypeUpdateFileDownload = "updateFileDownload" TypeUpdateFileRemovedFromDownloads = "updateFileRemovedFromDownloads" TypeUpdateApplicationVerificationRequired = "updateApplicationVerificationRequired" + TypeUpdateApplicationRecaptchaVerificationRequired = "updateApplicationRecaptchaVerificationRequired" TypeUpdateCall = "updateCall" TypeUpdateGroupCall = "updateGroupCall" TypeUpdateGroupCallParticipant = "updateGroupCallParticipant" @@ -2252,6 +2257,7 @@ const ( TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" TypeUpdateAvailableMessageEffects = "updateAvailableMessageEffects" TypeUpdateDefaultReactionType = "updateDefaultReactionType" + TypeUpdateDefaultPaidReactionType = "updateDefaultPaidReactionType" TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" TypeUpdateActiveLiveLocationMessages = "updateActiveLiveLocationMessages" TypeUpdateOwnedStarCount = "updateOwnedStarCount" @@ -2477,6 +2483,11 @@ type ReactionType interface { ReactionTypeType() string } +// Describes type of paid message reaction +type PaidReactionType interface { + PaidReactionTypeType() string +} + // Describes type of emoji effect type MessageEffectType interface { MessageEffectTypeType() string @@ -8651,6 +8662,8 @@ type UpgradedGift struct { OwnerAddress string `json:"owner_address"` // Name of the owner for the case when owner identifier and address aren't known OwnerName string `json:"owner_name"` + // Address of the gift NFT in TON blockchain; may be empty if none + GiftAddress string `json:"gift_address"` // Model of the upgraded gift Model *UpgradedGiftModel `json:"model"` // Symbol of the upgraded gift @@ -8688,6 +8701,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { OwnerId json.RawMessage `json:"owner_id"` OwnerAddress string `json:"owner_address"` OwnerName string `json:"owner_name"` + GiftAddress string `json:"gift_address"` Model *UpgradedGiftModel `json:"model"` Symbol *UpgradedGiftSymbol `json:"symbol"` Backdrop *UpgradedGiftBackdrop `json:"backdrop"` @@ -8707,6 +8721,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { upgradedGift.MaxUpgradedCount = tmp.MaxUpgradedCount upgradedGift.OwnerAddress = tmp.OwnerAddress upgradedGift.OwnerName = tmp.OwnerName + upgradedGift.GiftAddress = tmp.GiftAddress upgradedGift.Model = tmp.Model upgradedGift.Symbol = tmp.Symbol upgradedGift.Backdrop = tmp.Backdrop @@ -13166,6 +13181,83 @@ func (*ReactionTypePaid) ReactionTypeType() string { return TypeReactionTypePaid } +// A paid reaction on behalf of the current user +type PaidReactionTypeRegular struct{ + meta +} + +func (entity *PaidReactionTypeRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactionTypeRegular + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactionTypeRegular) GetClass() string { + return ClassPaidReactionType +} + +func (*PaidReactionTypeRegular) GetType() string { + return TypePaidReactionTypeRegular +} + +func (*PaidReactionTypeRegular) PaidReactionTypeType() string { + return TypePaidReactionTypeRegular +} + +// An anonymous paid reaction +type PaidReactionTypeAnonymous struct{ + meta +} + +func (entity *PaidReactionTypeAnonymous) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactionTypeAnonymous + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactionTypeAnonymous) GetClass() string { + return ClassPaidReactionType +} + +func (*PaidReactionTypeAnonymous) GetType() string { + return TypePaidReactionTypeAnonymous +} + +func (*PaidReactionTypeAnonymous) PaidReactionTypeType() string { + return TypePaidReactionTypeAnonymous +} + +// A paid reaction on behalf of an owned chat +type PaidReactionTypeChat struct { + meta + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +func (entity *PaidReactionTypeChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactionTypeChat + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactionTypeChat) GetClass() string { + return ClassPaidReactionType +} + +func (*PaidReactionTypeChat) GetType() string { + return TypePaidReactionTypeChat +} + +func (*PaidReactionTypeChat) PaidReactionTypeType() string { + return TypePaidReactionTypeChat +} + // Contains information about a user that added paid reactions type PaidReactor struct { meta @@ -21459,6 +21551,10 @@ type LinkPreviewTypeVideo struct { meta // The video description Video *Video `json:"video"` + // Cover of the video; may be null if none + Cover *Photo `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` } func (entity *LinkPreviewTypeVideo) MarshalJSON() ([]byte, error) { @@ -48591,7 +48687,7 @@ func (*InternalLinkTypeVideoChat) InternalLinkTypeType() string { return TypeInternalLinkTypeVideoChat } -// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App +// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot. If the bot is restricted for the current user, then show an error message. Otherwise, call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App type InternalLinkTypeWebApp struct { meta // Username of the bot that owns the Web App @@ -55542,6 +55638,37 @@ func (*UpdateApplicationVerificationRequired) UpdateType() string { return TypeUpdateApplicationVerificationRequired } +// A request can't be completed unless reCAPTCHA verification is performed; for official mobile applications only. The method setApplicationVerificationToken must be called once the verification is completed or failed +type UpdateApplicationRecaptchaVerificationRequired struct { + meta + // Unique identifier for the verification process + VerificationId int64 `json:"verification_id"` + // The action for the check + Action string `json:"action"` + // Identifier of the reCAPTCHA key + RecaptchaKeyId string `json:"recaptcha_key_id"` +} + +func (entity *UpdateApplicationRecaptchaVerificationRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateApplicationRecaptchaVerificationRequired + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateApplicationRecaptchaVerificationRequired) GetClass() string { + return ClassUpdate +} + +func (*UpdateApplicationRecaptchaVerificationRequired) GetType() string { + return TypeUpdateApplicationRecaptchaVerificationRequired +} + +func (*UpdateApplicationRecaptchaVerificationRequired) UpdateType() string { + return TypeUpdateApplicationRecaptchaVerificationRequired +} + // New call was created or information about a call was updated type UpdateCall struct { meta @@ -56737,6 +56864,49 @@ func (updateDefaultReactionType *UpdateDefaultReactionType) UnmarshalJSON(data [ return nil } +// The type of default paid reaction has changed +type UpdateDefaultPaidReactionType struct { + meta + // The new type of the default paid reaction + Type PaidReactionType `json:"type"` +} + +func (entity *UpdateDefaultPaidReactionType) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateDefaultPaidReactionType + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateDefaultPaidReactionType) GetClass() string { + return ClassUpdate +} + +func (*UpdateDefaultPaidReactionType) GetType() string { + return TypeUpdateDefaultPaidReactionType +} + +func (*UpdateDefaultPaidReactionType) UpdateType() string { + return TypeUpdateDefaultPaidReactionType +} + +func (updateDefaultPaidReactionType *UpdateDefaultPaidReactionType) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldType, _ := UnmarshalPaidReactionType(tmp.Type) + updateDefaultPaidReactionType.Type = fieldType + + return nil +} + // Tags used in Saved Messages or a Saved Messages topic have changed type UpdateSavedMessagesTags struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 64c650d..313cb84 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1464,6 +1464,43 @@ func UnmarshalListOfReactionType(dataList []json.RawMessage) ([]ReactionType, er return list, nil } +func UnmarshalPaidReactionType(data json.RawMessage) (PaidReactionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePaidReactionTypeRegular: + return UnmarshalPaidReactionTypeRegular(data) + + case TypePaidReactionTypeAnonymous: + return UnmarshalPaidReactionTypeAnonymous(data) + + case TypePaidReactionTypeChat: + return UnmarshalPaidReactionTypeChat(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPaidReactionType(dataList []json.RawMessage) ([]PaidReactionType, error) { + list := []PaidReactionType{} + + for _, data := range dataList { + entity, err := UnmarshalPaidReactionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageEffectType(data json.RawMessage) (MessageEffectType, error) { var meta meta @@ -8158,6 +8195,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateApplicationVerificationRequired: return UnmarshalUpdateApplicationVerificationRequired(data) + case TypeUpdateApplicationRecaptchaVerificationRequired: + return UnmarshalUpdateApplicationRecaptchaVerificationRequired(data) + case TypeUpdateCall: return UnmarshalUpdateCall(data) @@ -8263,6 +8303,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) + case TypeUpdateDefaultPaidReactionType: + return UnmarshalUpdateDefaultPaidReactionType(data) + case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(data) @@ -10853,6 +10896,30 @@ func UnmarshalReactionTypePaid(data json.RawMessage) (*ReactionTypePaid, error) return &resp, err } +func UnmarshalPaidReactionTypeRegular(data json.RawMessage) (*PaidReactionTypeRegular, error) { + var resp PaidReactionTypeRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaidReactionTypeAnonymous(data json.RawMessage) (*PaidReactionTypeAnonymous, error) { + var resp PaidReactionTypeAnonymous + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaidReactionTypeChat(data json.RawMessage) (*PaidReactionTypeChat, error) { + var resp PaidReactionTypeChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPaidReactor(data json.RawMessage) (*PaidReactor, error) { var resp PaidReactor @@ -21357,6 +21424,14 @@ func UnmarshalUpdateApplicationVerificationRequired(data json.RawMessage) (*Upda return &resp, err } +func UnmarshalUpdateApplicationRecaptchaVerificationRequired(data json.RawMessage) (*UpdateApplicationRecaptchaVerificationRequired, error) { + var resp UpdateApplicationRecaptchaVerificationRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateCall(data json.RawMessage) (*UpdateCall, error) { var resp UpdateCall @@ -21637,6 +21712,14 @@ func UnmarshalUpdateDefaultReactionType(data json.RawMessage) (*UpdateDefaultRea return &resp, err } +func UnmarshalUpdateDefaultPaidReactionType(data json.RawMessage) (*UpdateDefaultPaidReactionType, error) { + var resp UpdateDefaultPaidReactionType + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateSavedMessagesTags(data json.RawMessage) (*UpdateSavedMessagesTags, error) { var resp UpdateSavedMessagesTags @@ -22942,6 +23025,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeReactionTypePaid: return UnmarshalReactionTypePaid(data) + case TypePaidReactionTypeRegular: + return UnmarshalPaidReactionTypeRegular(data) + + case TypePaidReactionTypeAnonymous: + return UnmarshalPaidReactionTypeAnonymous(data) + + case TypePaidReactionTypeChat: + return UnmarshalPaidReactionTypeChat(data) + case TypePaidReactor: return UnmarshalPaidReactor(data) @@ -26881,6 +26973,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateApplicationVerificationRequired: return UnmarshalUpdateApplicationVerificationRequired(data) + case TypeUpdateApplicationRecaptchaVerificationRequired: + return UnmarshalUpdateApplicationRecaptchaVerificationRequired(data) + case TypeUpdateCall: return UnmarshalUpdateCall(data) @@ -26986,6 +27081,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) + case TypeUpdateDefaultPaidReactionType: + return UnmarshalUpdateDefaultPaidReactionType(data) + case TypeUpdateSavedMessagesTags: return UnmarshalUpdateSavedMessagesTags(data) diff --git a/data/td_api.tl b/data/td_api.tl index f0ffcfb..28709bd 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -1086,11 +1086,12 @@ gifts gifts:vector = Gifts; //@owner_id Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown //@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none //@owner_name Name of the owner for the case when owner identifier and address aren't known +//@gift_address Address of the gift NFT in TON blockchain; may be empty if none //@model Model of the upgraded gift //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown -upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; +upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1874,6 +1875,18 @@ reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType; reactionTypePaid = ReactionType; +//@class PaidReactionType @description Describes type of paid message reaction + +//@description A paid reaction on behalf of the current user +paidReactionTypeRegular = PaidReactionType; + +//@description An anonymous paid reaction +paidReactionTypeAnonymous = PaidReactionType; + +//@description A paid reaction on behalf of an owned chat @chat_id Identifier of the chat +paidReactionTypeChat chat_id:int53 = PaidReactionType; + + //@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 @@ -3160,8 +3173,11 @@ linkPreviewTypeUpgradedGift gift:upgradedGift = LinkPreviewType; //@description The link is a link to a user @photo Photo of the user; may be null if none @is_bot True, if the user is a bot linkPreviewTypeUser photo:chatPhoto is_bot:Bool = LinkPreviewType; -//@description The link is a link to a video @video The video description -linkPreviewTypeVideo video:video = LinkPreviewType; +//@description The link is a link to a video +//@video The video description +//@cover Cover of the video; may be null if none +//@start_timestamp Timestamp from which the video playing must start, in seconds +linkPreviewTypeVideo video:video cover:photo start_timestamp:int32 = LinkPreviewType; //@description The link is a link to a video chat //@photo Photo of the chat with the video chat; may be null if none @@ -7296,9 +7312,10 @@ internalLinkTypeUserToken token:string = InternalLinkType; //@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group internalLinkTypeVideoChat chat_username:string invite_hash:string is_live_stream:Bool = InternalLinkType; -//@description The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. -//-Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications -//-instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. +//@description The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot. If the bot is restricted for the current user, then show an error message. +//-Otherwise, call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. +//-If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications instead of the dialog +//-and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. //-Then, call getWebAppLinkUrl and open the returned URL as a Web App //@bot_username Username of the bot that owns the Web App //@web_app_short_name Short name of the Web App @@ -8291,6 +8308,13 @@ updateFileRemovedFromDownloads file_id:int32 counts:downloadedFileCounts = Updat //@cloud_project_number Cloud project number to pass to the Play Integrity API on Android updateApplicationVerificationRequired verification_id:int53 nonce:string cloud_project_number:int64 = Update; +//@description A request can't be completed unless reCAPTCHA verification is performed; for official mobile applications only. +//-The method setApplicationVerificationToken must be called once the verification is completed or failed +//@verification_id Unique identifier for the verification process +//@action The action for the check +//@recaptcha_key_id Identifier of the reCAPTCHA key +updateApplicationRecaptchaVerificationRequired verification_id:int53 action:string recaptcha_key_id:string = Update; + //@description New call was created or information about a call was updated @call New data about a call updateCall call:call = Update; @@ -8420,6 +8444,9 @@ updateAvailableMessageEffects reaction_effect_ids:vector sticker_effect_i //@description The type of default reaction has changed @reaction_type The new type of the default reaction updateDefaultReactionType reaction_type:ReactionType = Update; +//@description The type of default paid reaction has changed @type The new type of the default paid reaction +updateDefaultPaidReactionType type:PaidReactionType = Update; + //@description Tags used in Saved Messages or a Saved Messages topic have changed //@saved_messages_topic_id Identifier of Saved Messages topic which tags were changed; 0 if tags for the whole chat has changed //@tags The new tags @@ -9701,13 +9728,15 @@ addMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_ //@reaction_type Type of the reaction to remove. The paid reaction can't be removed removeMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType = Ok; +//@description Returns the list of message sender identifiers, which can be used to send a paid reaction in a chat @chat_id Chat identifier +getChatAvailablePaidMessageReactionSenders chat_id:int53 = MessageSenders; + //@description Adds the paid message reaction to a message. Use getMessageAvailableReactions to check whether the reaction is available for the message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message //@star_count Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_reaction_star_count_max") -//@use_default_is_anonymous Pass true if the user didn't choose anonymity explicitly, for example, the reaction is set from the message bubble -//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors. Ignored if use_default_is_anonymous == true -addPendingPaidMessageReaction chat_id:int53 message_id:int53 star_count:int53 use_default_is_anonymous:Bool is_anonymous:Bool = Ok; +//@type Type of the paid reaction; pass null if the user didn't choose reaction type explicitly, for example, the reaction is set from the message bubble +addPendingPaidMessageReaction chat_id:int53 message_id:int53 star_count:int53 type:PaidReactionType = Ok; //@description Applies all pending paid reactions on a message @chat_id Identifier of the chat to which the message belongs @message_id Identifier of the message commitPendingPaidMessageReactions chat_id:int53 message_id:int53 = Ok; @@ -9715,11 +9744,11 @@ commitPendingPaidMessageReactions chat_id:int53 message_id:int53 = Ok; //@description Removes all pending paid reactions on a message @chat_id Identifier of the chat to which the message belongs @message_id Identifier of the message removePendingPaidMessageReactions chat_id:int53 message_id:int53 = Ok; -//@description Changes whether the paid message reaction of the user to a message is anonymous. The message must have paid reaction added by the user +//@description Changes type of paid message reaction of the current user on a message. The message must have paid reaction added by the current user //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors -togglePaidMessageReactionIsAnonymous chat_id:int53 message_id:int53 is_anonymous:Bool = Ok; +//@type New type of the paid reaction +setPaidMessageReactionType chat_id:int53 message_id:int53 type:PaidReactionType = Ok; //@description Sets reactions on a message; for bots only //@chat_id Identifier of the chat to which the message belongs @@ -9920,13 +9949,13 @@ getWebAppLinkUrl chat_id:int53 bot_user_id:int53 web_app_short_name:string start //@description Returns information needed to open the main Web App of a bot //@chat_id Identifier of the chat in which the Web App is opened; pass 0 if none -//@bot_user_id Identifier of the target bot +//@bot_user_id Identifier of the target bot. If the bot is restricted for the current user, then show an error instead of calling the method //@start_parameter Start parameter from internalLinkTypeMainWebApp //@parameters Parameters to use to open the Web App getMainWebApp chat_id:int53 bot_user_id:int53 start_parameter:string parameters:webAppOpenParameters = MainWebApp; //@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button -//@bot_user_id Identifier of the target bot +//@bot_user_id Identifier of the target bot. If the bot is restricted for the current user, then show an error instead of calling the method //@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu //@parameters Parameters to use to open the Web App getWebAppUrl bot_user_id:int53 url:string parameters:webAppOpenParameters = HttpUrl; @@ -9940,7 +9969,7 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@description Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. //-For each bot, a confirmation alert about data sent to the bot must be shown once //@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats -//@bot_user_id Identifier of the bot, providing the Web App +//@bot_user_id Identifier of the bot, providing the Web App. If the bot is restricted for the current user, then show an error instead of calling the method //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise //@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none @@ -10736,9 +10765,9 @@ removeAllFilesFromDownloads only_active:Bool only_completed:Bool delete_from_cac searchFileDownloads query:string only_active:Bool only_completed:Bool offset:string limit:int32 = FoundFileDownloads; -//@description Application verification has been completed. Can be called before authorization -//@verification_id Unique identifier for the verification process as received from updateApplicationVerificationRequired -//@token Play Integrity API token for the Android application, or secret from push notification for the iOS application; +//@description Application or reCAPTCHA verification has been completed. Can be called before authorization +//@verification_id Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired +//@token Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; //-pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request setApplicationVerificationToken verification_id:int53 token:string = Ok; @@ -11771,11 +11800,11 @@ transferGift received_gift_id:string new_owner_id:MessageSender star_count:int53 //@description Returns gifts received by the given user or chat //@owner_id Identifier of the gift receiver //@exclude_unsaved Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right -//@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page; for channel chats with can_post_messages administrator right only -//@exclude_unlimited Pass true to exclude gifts that can be purchased unlimited number of times; for channel chats with can_post_messages administrator right only -//@exclude_limited Pass true to exclude gifts that can be purchased limited number of times; for channel chats with can_post_messages administrator right only -//@exclude_upgraded Pass true to exclude upgraded gifts; for channel chats with can_post_messages administrator right only -//@sort_by_price Pass true to sort results by gift price instead of send date; for channel chats with can_post_messages administrator right only +//@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right +//@exclude_unlimited Pass true to exclude gifts that can be purchased unlimited number of times +//@exclude_limited Pass true to exclude gifts that can be purchased limited number of times +//@exclude_upgraded Pass true to exclude upgraded gifts +//@sort_by_price Pass true to sort results by gift price instead of send date //@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 getReceivedGifts owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; From 8de0893227be3fe8ea3d3582e1e5cc9fe34954bf Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 7 Mar 2025 22:22:55 +0800 Subject: [PATCH 11/29] Update to TDLib 1.8.46 --- client/function.go | 177 +++++++++++-- client/type.go | 581 +++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 214 +++++++++++++++- data/td_api.tl | 212 +++++++++++---- 4 files changed, 1076 insertions(+), 108 deletions(-) diff --git a/client/function.go b/client/function.go index 46a1a11..51e31dc 100755 --- a/client/function.go +++ b/client/function.go @@ -4085,7 +4085,7 @@ type SendQuickReplyShortcutMessagesRequest struct { SendingId int32 `json:"sending_id"` } -// Sends messages from a quick reply shortcut. Requires Telegram Business subscription +// Sends messages from a quick reply shortcut. Requires Telegram Business subscription. Can't be used to send paid messages func (client *Client) SendQuickReplyShortcutMessages(req *SendQuickReplyShortcutMessagesRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -4115,6 +4115,8 @@ type ResendMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false Quote *InputTextQuote `json:"quote"` + // The number of Telegram Stars the user agreed to pay to send the messages. Ignored if messageSendingStateFailed.required_paid_message_star_count == 0 + PaidMessageStarCount int64 `json:"paid_message_star_count"` } // Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message @@ -4127,6 +4129,7 @@ func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, err "chat_id": req.ChatId, "message_ids": req.MessageIds, "quote": req.Quote, + "paid_message_star_count": req.PaidMessageStarCount, }, }) if err != nil { @@ -13249,7 +13252,7 @@ type CreateCallRequest struct { Protocol *CallProtocol `json:"protocol"` // Pass true to create a video call IsVideo bool `json:"is_video"` - // Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored + // Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none GroupCallId int32 `json:"group_call_id"` } @@ -13730,6 +13733,8 @@ type JoinGroupCallRequest struct { IsMyVideoEnabled bool `json:"is_my_video_enabled"` // If non-empty, invite hash to be used to join the group call without being muted by administrators InviteHash string `json:"invite_hash"` + // Fingerprint of the encryption key for E2E group calls not bound to a chat; pass 0 for voice chats + KeyFingerprint JsonInt64 `json:"key_fingerprint"` } // Joins an active group call. Returns join response payload for tgcalls @@ -13746,6 +13751,7 @@ func (client *Client) JoinGroupCall(req *JoinGroupCallRequest) (*Text, error) { "is_muted": req.IsMuted, "is_my_video_enabled": req.IsMyVideoEnabled, "invite_hash": req.InviteHash, + "key_fingerprint": req.KeyFingerprint, }, }) if err != nil { @@ -14750,7 +14756,7 @@ type SuggestUserProfilePhotoRequest struct { Photo InputChatPhoto `json:"photo"` } -// Suggests a profile photo to another regular user with common messages +// Suggests a profile photo to another regular user with common messages and allowing non-paid messages func (client *Client) SuggestUserProfilePhoto(req *SuggestUserProfilePhotoRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -16072,11 +16078,11 @@ func (client *Client) GetLinkPreview(req *GetLinkPreviewRequest) (*LinkPreview, type GetWebPageInstantViewRequest struct { // The web page URL Url string `json:"url"` - // Pass true to get full instant view for the web page - ForceFull bool `json:"force_full"` + // Pass true to get only locally available information without sending network requests + OnlyLocal bool `json:"only_local"` } -// Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page +// Returns an instant view version of a web page if available. This is an offline request if only_local is true. Returns a 404 error if the web page has no instant view page func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) (*WebPageInstantView, error) { result, err := client.Send(Request{ meta: meta{ @@ -16084,7 +16090,7 @@ func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) ( }, Data: map[string]interface{}{ "url": req.Url, - "force_full": req.ForceFull, + "only_local": req.OnlyLocal, }, }) if err != nil { @@ -18908,7 +18914,7 @@ type SendGiftRequest struct { GiftId JsonInt64 `json:"gift_id"` // Identifier of the user or the channel chat that will receive the gift OwnerId MessageSender `json:"owner_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 to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. Must be empty if the receiver enabled paid messages Text *FormattedText `json:"text"` // Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` @@ -18974,7 +18980,7 @@ type ToggleGiftIsSavedRequest struct { IsSaved bool `json:"is_saved"` } -// Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the chat +// Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18996,6 +19002,35 @@ func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, err return UnmarshalOk(result.Data) } +type SetPinnedGiftsRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` + // New list of pinned gifts. All gifts must be upgraded and saved on the profile page first. There can be up to getOption("pinned_gift_count_max") pinned gifts + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Changes the list of pinned gifts on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat +func (client *Client) SetPinnedGifts(req *SetPinnedGiftsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPinnedGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleChatGiftNotificationsRequest struct { // Identifier of the channel chat ChatId int64 `json:"chat_id"` @@ -20007,6 +20042,90 @@ func (client *Client) GetNewChatPrivacySettings() (*NewChatPrivacySettings, erro return UnmarshalNewChatPrivacySettings(result.Data) } +type GetPaidMessageRevenueRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` +} + +// Returns the total number of Telegram Stars received by the current user for paid messages from the given user +func (client *Client) GetPaidMessageRevenue(req *GetPaidMessageRevenueRequest) (*StarCount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPaidMessageRevenue", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarCount(result.Data) +} + +type AllowUnpaidMessagesFromUserRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // Pass true to refund the user previously paid messages + RefundPayments bool `json:"refund_payments"` +} + +// Allows the specified user to send unpaid private messages to the current user by adding a rule to userPrivacySettingAllowUnpaidMessages +func (client *Client) AllowUnpaidMessagesFromUser(req *AllowUnpaidMessagesFromUserRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "allowUnpaidMessagesFromUser", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "refund_payments": req.RefundPayments, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatPaidMessageStarCountRequest struct { + // Identifier of the supergroup chat + ChatId int64 `json:"chat_id"` + // The new number of Telegram Stars that must be paid for each message that is sent to the supergroup chat unless the sender is an administrator of the chat; 0-getOption("paid_message_star_count_max"). The supergroup will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Changes the amount of Telegram Stars that must be paid to send a message to a supergroup chat; requires can_restrict_members administrator right and supergroupFullInfo.can_enable_paid_messages +func (client *Client) SetChatPaidMessageStarCount(req *SetChatPaidMessageStarCountRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatPaidMessageStarCount", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CanSendMessageToUserRequest struct { // Identifier of the other user UserId int64 `json:"user_id"` @@ -20037,6 +20156,9 @@ func (client *Client) CanSendMessageToUser(req *CanSendMessageToUserRequest) (Ca case TypeCanSendMessageToUserResultOk: return UnmarshalCanSendMessageToUserResultOk(result.Data) + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(result.Data) + case TypeCanSendMessageToUserResultUserIsDeleted: return UnmarshalCanSendMessageToUserResultUserIsDeleted(result.Data) @@ -20476,7 +20598,7 @@ func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactions } type GetStarRevenueStatisticsRequest struct { - // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true + // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` // Pass true if a dark theme is used by the application IsDark bool `json:"is_dark"` @@ -20505,7 +20627,7 @@ func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequ } type GetStarWithdrawalUrlRequest struct { - // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat + // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat OwnerId MessageSender `json:"owner_id"` // The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") StarCount int64 `json:"star_count"` @@ -22236,16 +22358,35 @@ func (client *Client) GetPremiumState() (*PremiumState, error) { return UnmarshalPremiumState(result.Data) } -type GetPremiumGiftCodePaymentOptionsRequest struct { - // Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none +// Returns available options for gifting Telegram Premium to a user +func (client *Client) GetPremiumGiftPaymentOptions() (*PremiumGiftPaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumGiftPaymentOptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPremiumGiftPaymentOptions(result.Data) +} + +type GetPremiumGiveawayPaymentOptionsRequest struct { + // Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` } -// Returns available options for Telegram Premium gift code or Telegram Premium giveaway creation -func (client *Client) GetPremiumGiftCodePaymentOptions(req *GetPremiumGiftCodePaymentOptionsRequest) (*PremiumGiftCodePaymentOptions, error) { +// Returns available options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +func (client *Client) GetPremiumGiveawayPaymentOptions(req *GetPremiumGiveawayPaymentOptionsRequest) (*PremiumGiveawayPaymentOptions, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getPremiumGiftCodePaymentOptions", + Type: "getPremiumGiveawayPaymentOptions", }, Data: map[string]interface{}{ "boosted_chat_id": req.BoostedChatId, @@ -22259,7 +22400,7 @@ func (client *Client) GetPremiumGiftCodePaymentOptions(req *GetPremiumGiftCodePa return nil, buildResponseError(result.Data) } - return UnmarshalPremiumGiftCodePaymentOptions(result.Data) + return UnmarshalPremiumGiveawayPaymentOptions(result.Data) } type CheckPremiumGiftCodeRequest struct { @@ -22452,7 +22593,7 @@ func (client *Client) GetStarGiveawayPaymentOptions() (*StarGiveawayPaymentOptio } type GetStarTransactionsRequest struct { - // Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true + // Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` // If non-empty, only transactions related to the Star Subscription will be returned SubscriptionId string `json:"subscription_id"` diff --git a/client/type.go b/client/type.go index 8743a91..c4f4597 100755 --- a/client/type.go +++ b/client/type.go @@ -257,8 +257,10 @@ const ( ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" - ClassPremiumGiftCodePaymentOption = "PremiumGiftCodePaymentOption" - ClassPremiumGiftCodePaymentOptions = "PremiumGiftCodePaymentOptions" + ClassPremiumGiftPaymentOption = "PremiumGiftPaymentOption" + ClassPremiumGiftPaymentOptions = "PremiumGiftPaymentOptions" + ClassPremiumGiveawayPaymentOption = "PremiumGiveawayPaymentOption" + ClassPremiumGiveawayPaymentOptions = "PremiumGiveawayPaymentOptions" ClassPremiumGiftCodeInfo = "PremiumGiftCodeInfo" ClassStarPaymentOption = "StarPaymentOption" ClassStarPaymentOptions = "StarPaymentOptions" @@ -371,6 +373,7 @@ const ( ClassFailedToAddMember = "FailedToAddMember" ClassFailedToAddMembers = "FailedToAddMembers" ClassCreatedBasicGroupChat = "CreatedBasicGroupChat" + ClassAccountInfo = "AccountInfo" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" ClassThemeParameters = "ThemeParameters" @@ -568,6 +571,7 @@ const ( ClassText = "Text" ClassSeconds = "Seconds" ClassFileDownloadedPrefixSize = "FileDownloadedPrefixSize" + ClassStarCount = "StarCount" ClassDeepLinkInfo = "DeepLinkInfo" ClassProxy = "Proxy" ClassProxies = "Proxies" @@ -762,8 +766,10 @@ const ( TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" - TypePremiumGiftCodePaymentOption = "premiumGiftCodePaymentOption" - TypePremiumGiftCodePaymentOptions = "premiumGiftCodePaymentOptions" + TypePremiumGiftPaymentOption = "premiumGiftPaymentOption" + TypePremiumGiftPaymentOptions = "premiumGiftPaymentOptions" + TypePremiumGiveawayPaymentOption = "premiumGiveawayPaymentOption" + TypePremiumGiveawayPaymentOptions = "premiumGiveawayPaymentOptions" TypePremiumGiftCodeInfo = "premiumGiftCodeInfo" TypeStarPaymentOption = "starPaymentOption" TypeStarPaymentOptions = "starPaymentOptions" @@ -812,6 +818,9 @@ const ( TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" + TypeStarTransactionTypePaidMessageSend = "starTransactionTypePaidMessageSend" + TypeStarTransactionTypePaidMessageReceive = "starTransactionTypePaidMessageReceive" + TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" @@ -1005,6 +1014,7 @@ const ( TypeCreatedBasicGroupChat = "createdBasicGroupChat" TypePublicChatTypeHasUsername = "publicChatTypeHasUsername" TypePublicChatTypeIsLocationBased = "publicChatTypeIsLocationBased" + TypeAccountInfo = "accountInfo" TypeChatActionBarReportSpam = "chatActionBarReportSpam" TypeChatActionBarInviteMembers = "chatActionBarInviteMembers" TypeChatActionBarReportAddBlock = "chatActionBarReportAddBlock" @@ -1755,11 +1765,13 @@ const ( TypeBusinessFeaturePromotionAnimation = "businessFeaturePromotionAnimation" TypePremiumState = "premiumState" TypeStorePaymentPurposePremiumSubscription = "storePaymentPurposePremiumSubscription" + TypeStorePaymentPurposePremiumGift = "storePaymentPurposePremiumGift" TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" TypeStorePaymentPurposeStarGiveaway = "storePaymentPurposeStarGiveaway" TypeStorePaymentPurposeStars = "storePaymentPurposeStars" TypeStorePaymentPurposeGiftedStars = "storePaymentPurposeGiftedStars" + TypeTelegramPaymentPurposePremiumGift = "telegramPaymentPurposePremiumGift" TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" TypeTelegramPaymentPurposeStars = "telegramPaymentPurposeStars" @@ -1843,6 +1855,9 @@ const ( TypePushMessageContentVideoNote = "pushMessageContentVideoNote" TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote" TypePushMessageContentBasicGroupChatCreate = "pushMessageContentBasicGroupChatCreate" + TypePushMessageContentVideoChatStarted = "pushMessageContentVideoChatStarted" + TypePushMessageContentVideoChatEnded = "pushMessageContentVideoChatEnded" + TypePushMessageContentInviteVideoChatParticipants = "pushMessageContentInviteVideoChatParticipants" TypePushMessageContentChatAddMembers = "pushMessageContentChatAddMembers" TypePushMessageContentChatChangePhoto = "pushMessageContentChatChangePhoto" TypePushMessageContentChatChangeTitle = "pushMessageContentChatChangeTitle" @@ -1853,6 +1868,7 @@ const ( TypePushMessageContentChatJoinByRequest = "pushMessageContentChatJoinByRequest" TypePushMessageContentRecurringPayment = "pushMessageContentRecurringPayment" TypePushMessageContentSuggestProfilePhoto = "pushMessageContentSuggestProfilePhoto" + TypePushMessageContentProximityAlertTriggered = "pushMessageContentProximityAlertTriggered" TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards" TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum" TypeNotificationTypeNewMessage = "notificationTypeNewMessage" @@ -1906,9 +1922,11 @@ const ( TypeUserPrivacySettingAllowFindingByPhoneNumber = "userPrivacySettingAllowFindingByPhoneNumber" TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" TypeUserPrivacySettingAutosaveGifts = "userPrivacySettingAutosaveGifts" + TypeUserPrivacySettingAllowUnpaidMessages = "userPrivacySettingAllowUnpaidMessages" TypeReadDatePrivacySettings = "readDatePrivacySettings" TypeNewChatPrivacySettings = "newChatPrivacySettings" TypeCanSendMessageToUserResultOk = "canSendMessageToUserResultOk" + TypeCanSendMessageToUserResultUserHasPaidMessages = "canSendMessageToUserResultUserHasPaidMessages" TypeCanSendMessageToUserResultUserIsDeleted = "canSendMessageToUserResultUserIsDeleted" TypeCanSendMessageToUserResultUserRestrictsNewChats = "canSendMessageToUserResultUserRestrictsNewChats" TypeAccountTtl = "accountTtl" @@ -2090,6 +2108,7 @@ const ( TypeText = "text" TypeSeconds = "seconds" TypeFileDownloadedPrefixSize = "fileDownloadedPrefixSize" + TypeStarCount = "starCount" TypeDeepLinkInfo = "deepLinkInfo" TypeTextParseModeMarkdown = "textParseModeMarkdown" TypeTextParseModeHTML = "textParseModeHTML" @@ -5975,6 +5994,8 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { // Describes an alternative re-encoded quality of a video file type AlternativeVideo struct { meta + // Unique identifier of the alternative video, which is used in the HLS file + Id JsonInt64 `json:"id"` // Video width Width int32 `json:"width"` // Video height @@ -8148,15 +8169,71 @@ func (*PremiumStatePaymentOption) GetType() string { return TypePremiumStatePaymentOption } -// Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments -type PremiumGiftCodePaymentOption struct { +// Describes an option for gifting Telegram Premium to a user. Use telegramPaymentPurposePremiumGift for out-of-store payments or payments in Telegram Stars +type PremiumGiftPaymentOption struct { + meta + // ISO 4217 currency code for the payment + Currency string `json:"currency"` + // The amount to pay, in the smallest units of the currency + Amount int64 `json:"amount"` + // The alternative amount of Telegram Stars to pay; 0 if payment in Telegram Stars is not possible + StarCount int64 `json:"star_count"` + // The discount associated with this option, as a percentage + DiscountPercentage int32 `json:"discount_percentage"` + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` + // Identifier of the store product associated with the option + StoreProductId string `json:"store_product_id"` + // A sticker to be shown along with the option; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *PremiumGiftPaymentOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftPaymentOption + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftPaymentOption) GetClass() string { + return ClassPremiumGiftPaymentOption +} + +func (*PremiumGiftPaymentOption) GetType() string { + return TypePremiumGiftPaymentOption +} + +// Contains a list of options for gifting Telegram Premium to a user +type PremiumGiftPaymentOptions struct { + meta + // The list of options sorted by Telegram Premium subscription duration + Options []*PremiumGiftPaymentOption `json:"options"` +} + +func (entity *PremiumGiftPaymentOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftPaymentOptions + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftPaymentOptions) GetClass() string { + return ClassPremiumGiftPaymentOptions +} + +func (*PremiumGiftPaymentOptions) GetType() string { + return TypePremiumGiftPaymentOptions +} + +// Describes an option for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments +type PremiumGiveawayPaymentOption struct { meta // ISO 4217 currency code for Telegram Premium gift code payment Currency string `json:"currency"` // The amount to pay, in the smallest units of the currency Amount int64 `json:"amount"` - // The discount associated with this option, as a percentage - DiscountPercentage int32 `json:"discount_percentage"` // Number of users which will be able to activate the gift codes WinnerCount int32 `json:"winner_count"` // Number of months the Telegram Premium subscription will be active @@ -8165,47 +8242,45 @@ type PremiumGiftCodePaymentOption struct { StoreProductId string `json:"store_product_id"` // Number of times the store product must be paid StoreProductQuantity int32 `json:"store_product_quantity"` - // A sticker to be shown along with the gift code; may be null if unknown - Sticker *Sticker `json:"sticker"` } -func (entity *PremiumGiftCodePaymentOption) MarshalJSON() ([]byte, error) { +func (entity *PremiumGiveawayPaymentOption) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiftCodePaymentOption + type stub PremiumGiveawayPaymentOption return json.Marshal((*stub)(entity)) } -func (*PremiumGiftCodePaymentOption) GetClass() string { - return ClassPremiumGiftCodePaymentOption +func (*PremiumGiveawayPaymentOption) GetClass() string { + return ClassPremiumGiveawayPaymentOption } -func (*PremiumGiftCodePaymentOption) GetType() string { - return TypePremiumGiftCodePaymentOption +func (*PremiumGiveawayPaymentOption) GetType() string { + return TypePremiumGiveawayPaymentOption } -// Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway -type PremiumGiftCodePaymentOptions struct { +// Contains a list of options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +type PremiumGiveawayPaymentOptions struct { meta // The list of options - Options []*PremiumGiftCodePaymentOption `json:"options"` + Options []*PremiumGiveawayPaymentOption `json:"options"` } -func (entity *PremiumGiftCodePaymentOptions) MarshalJSON() ([]byte, error) { +func (entity *PremiumGiveawayPaymentOptions) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiftCodePaymentOptions + type stub PremiumGiveawayPaymentOptions return json.Marshal((*stub)(entity)) } -func (*PremiumGiftCodePaymentOptions) GetClass() string { - return ClassPremiumGiftCodePaymentOptions +func (*PremiumGiveawayPaymentOptions) GetClass() string { + return ClassPremiumGiveawayPaymentOptions } -func (*PremiumGiftCodePaymentOptions) GetType() string { - return TypePremiumGiftCodePaymentOptions +func (*PremiumGiveawayPaymentOptions) GetType() string { + return TypePremiumGiveawayPaymentOptions } // Contains information about a Telegram Premium gift code @@ -8353,7 +8428,7 @@ func (*StarGiveawayWinnerOption) GetType() string { return TypeStarGiveawayWinnerOption } -// Describes an option for creating Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments +// Describes an option for creating of Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments type StarGiveawayPaymentOption struct { meta // ISO 4217 currency code for the payment @@ -8390,7 +8465,7 @@ func (*StarGiveawayPaymentOption) GetType() string { return TypeStarGiveawayPaymentOption } -// Contains a list of options for creating Telegram Star giveaway +// Contains a list of options for creating of Telegram Star giveaway type StarGiveawayPaymentOptions struct { meta // The list of options @@ -8833,6 +8908,8 @@ type ReceivedGift struct { IsPrivate bool `json:"is_private"` // True, if the gift is displayed on the chat's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` + // True, if the gift is pinned to the top of the chat's profile page + IsPinned bool `json:"is_pinned"` // True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift CanBeUpgraded bool `json:"can_be_upgraded"` // True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift @@ -8876,6 +8953,7 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { Text *FormattedText `json:"text"` IsPrivate bool `json:"is_private"` IsSaved bool `json:"is_saved"` + IsPinned bool `json:"is_pinned"` CanBeUpgraded bool `json:"can_be_upgraded"` CanBeTransferred bool `json:"can_be_transferred"` WasRefunded bool `json:"was_refunded"` @@ -8896,6 +8974,7 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { receivedGift.Text = tmp.Text receivedGift.IsPrivate = tmp.IsPrivate receivedGift.IsSaved = tmp.IsSaved + receivedGift.IsPinned = tmp.IsPinned receivedGift.CanBeUpgraded = tmp.CanBeUpgraded receivedGift.CanBeTransferred = tmp.CanBeTransferred receivedGift.WasRefunded = tmp.WasRefunded @@ -9178,7 +9257,7 @@ func (*StarTransactionTypeGiveawayDeposit) StarTransactionTypeType() string { return TypeStarTransactionTypeGiveawayDeposit } -// The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only +// The transaction is a withdrawal of earned Telegram Stars to Fragment; for regular users, bots, supergroup and channel chats only type StarTransactionTypeFragmentWithdrawal struct { meta // State of the withdrawal; may be null for refunds from Fragment @@ -9795,6 +9874,8 @@ func (*StarTransactionTypeGiftSale) StarTransactionTypeType() string { // The transaction is an upgrade of a gift; for regular users only type StarTransactionTypeGiftUpgrade struct { meta + // Identifier of the user that initially sent the gift + UserId int64 `json:"user_id"` // The upgraded gift Gift *UpgradedGift `json:"gift"` } @@ -9906,6 +9987,122 @@ func (*StarTransactionTypeAffiliateProgramCommission) StarTransactionTypeType() return TypeStarTransactionTypeAffiliateProgramCommission } +// The transaction is a sending of a paid message; for regular users only +type StarTransactionTypePaidMessageSend struct { + meta + // Identifier of the chat that received the payment + ChatId int64 `json:"chat_id"` + // Number of sent paid messages + MessageCount int32 `json:"message_count"` +} + +func (entity *StarTransactionTypePaidMessageSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidMessageSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidMessageSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidMessageSend) GetType() string { + return TypeStarTransactionTypePaidMessageSend +} + +func (*StarTransactionTypePaidMessageSend) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidMessageSend +} + +// The transaction is a receiving of a paid message; for regular users and supergroup chats only +type StarTransactionTypePaidMessageReceive struct { + meta + // Identifier of the sender of the message + SenderId MessageSender `json:"sender_id"` + // Number of received paid messages + MessageCount int32 `json:"message_count"` + // The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending + CommissionPerMille int32 `json:"commission_per_mille"` + // The amount of Telegram Stars that were received by Telegram; can be negative for refunds + CommissionStarAmount *StarAmount `json:"commission_star_amount"` +} + +func (entity *StarTransactionTypePaidMessageReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidMessageReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidMessageReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidMessageReceive) GetType() string { + return TypeStarTransactionTypePaidMessageReceive +} + +func (*StarTransactionTypePaidMessageReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidMessageReceive +} + +func (starTransactionTypePaidMessageReceive *StarTransactionTypePaidMessageReceive) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + MessageCount int32 `json:"message_count"` + CommissionPerMille int32 `json:"commission_per_mille"` + CommissionStarAmount *StarAmount `json:"commission_star_amount"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypePaidMessageReceive.MessageCount = tmp.MessageCount + starTransactionTypePaidMessageReceive.CommissionPerMille = tmp.CommissionPerMille + starTransactionTypePaidMessageReceive.CommissionStarAmount = tmp.CommissionStarAmount + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + starTransactionTypePaidMessageReceive.SenderId = fieldSenderId + + return nil +} + +// The transaction is a purchase of Telegram Premium subscription; for regular users only +type StarTransactionTypePremiumPurchase struct { + meta + // Identifier of the user that received the Telegram Premium subscription + UserId int64 `json:"user_id"` + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` + // A sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *StarTransactionTypePremiumPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePremiumPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePremiumPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePremiumPurchase) GetType() string { + return TypeStarTransactionTypePremiumPurchase +} + +func (*StarTransactionTypePremiumPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypePremiumPurchase +} + // The transaction is a transaction of an unsupported type type StarTransactionTypeUnsupported struct{ meta @@ -10611,6 +10808,8 @@ type User struct { HasUnreadActiveStories bool `json:"has_unread_active_stories"` // True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them RestrictsNewChats bool `json:"restricts_new_chats"` + // Number of Telegram Stars that must be paid by general user for each sent message to the user. If positive and userFullInfo is unknown, use canSendMessageToUser to check whether the current user must pay + PaidMessageStarCount int64 `json:"paid_message_star_count"` // If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method HaveAccess bool `json:"have_access"` // Type of the user @@ -10662,6 +10861,7 @@ func (user *User) UnmarshalJSON(data []byte) error { HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` RestrictsNewChats bool `json:"restricts_new_chats"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` HaveAccess bool `json:"have_access"` Type json.RawMessage `json:"type"` LanguageCode string `json:"language_code"` @@ -10695,6 +10895,7 @@ func (user *User) UnmarshalJSON(data []byte) error { user.HasActiveStories = tmp.HasActiveStories user.HasUnreadActiveStories = tmp.HasUnreadActiveStories user.RestrictsNewChats = tmp.RestrictsNewChats + user.PaidMessageStarCount = tmp.PaidMessageStarCount user.HaveAccess = tmp.HaveAccess user.LanguageCode = tmp.LanguageCode user.AddedToAttachmentMenu = tmp.AddedToAttachmentMenu @@ -10877,6 +11078,10 @@ type UserFullInfo struct { 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"` + // Number of Telegram Stars that must be paid by the user for each sent message to the current user + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` + // Number of Telegram Stars that must be paid by the current user for each sent message to the user + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` // Information about verification status of the user provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` // Information about business settings for Telegram Business accounts; may be null if none @@ -10921,6 +11126,8 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { PersonalChatId int64 `json:"personal_chat_id"` GiftCount int32 `json:"gift_count"` GroupInCommonCount int32 `json:"group_in_common_count"` + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` BotVerification *BotVerification `json:"bot_verification"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` @@ -10948,6 +11155,8 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.PersonalChatId = tmp.PersonalChatId userFullInfo.GiftCount = tmp.GiftCount userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount + userFullInfo.IncomingPaidMessageStarCount = tmp.IncomingPaidMessageStarCount + userFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount userFullInfo.BotVerification = tmp.BotVerification userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo @@ -12279,6 +12488,8 @@ type Supergroup struct { HasSensitiveContent bool `json:"has_sensitive_content"` // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted RestrictionReason string `json:"restriction_reason"` + // Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message + PaidMessageStarCount int64 `json:"paid_message_star_count"` // True, if the supergroup or channel has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` // True, if the supergroup or channel has unread non-expired stories available to the current user @@ -12323,6 +12534,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { VerificationStatus *VerificationStatus `json:"verification_status"` HasSensitiveContent bool `json:"has_sensitive_content"` RestrictionReason string `json:"restriction_reason"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` } @@ -12351,6 +12563,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.VerificationStatus = tmp.VerificationStatus supergroup.HasSensitiveContent = tmp.HasSensitiveContent supergroup.RestrictionReason = tmp.RestrictionReason + supergroup.PaidMessageStarCount = tmp.PaidMessageStarCount supergroup.HasActiveStories = tmp.HasActiveStories supergroup.HasUnreadActiveStories = tmp.HasUnreadActiveStories @@ -12381,6 +12594,8 @@ type SupergroupFullInfo struct { SlowModeDelay int32 `json:"slow_mode_delay"` // Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero SlowModeDelayExpiresIn float64 `json:"slow_mode_delay_expires_in"` + // True, if paid messages can be enabled in the supergroup chat; for supergroup only + CanEnablePaidMessages bool `json:"can_enable_paid_messages"` // True, if paid reaction can be enabled in the channel chat; for channels only CanEnablePaidReaction bool `json:"can_enable_paid_reaction"` // True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers @@ -13767,6 +13982,8 @@ type MessageSendingStateFailed struct { NeedAnotherReplyQuote bool `json:"need_another_reply_quote"` // True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages NeedDropReply bool `json:"need_drop_reply"` + // The number of Telegram Stars that must be paid to send the message; 0 if the current amount is correct + RequiredPaidMessageStarCount int64 `json:"required_paid_message_star_count"` // Time left before the message can be re-sent, in seconds. No update is sent when this field changes RetryAfter float64 `json:"retry_after"` } @@ -14113,6 +14330,8 @@ type Message struct { SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` // Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead SenderBoostCount int32 `json:"sender_boost_count"` + // The number of Telegram Stars the sender paid to send the message + PaidMessageStarCount int64 `json:"paid_message_star_count"` // For channel posts and anonymous group messages, optional author signature AuthorSignature string `json:"author_signature"` // Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums @@ -14176,6 +14395,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { ViaBotUserId int64 `json:"via_bot_user_id"` SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` SenderBoostCount int32 `json:"sender_boost_count"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` EffectId JsonInt64 `json:"effect_id"` @@ -14214,6 +14434,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.ViaBotUserId = tmp.ViaBotUserId message.SenderBusinessBotUserId = tmp.SenderBusinessBotUserId message.SenderBoostCount = tmp.SenderBoostCount + message.PaidMessageStarCount = tmp.PaidMessageStarCount message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId message.EffectId = tmp.EffectId @@ -16643,6 +16864,37 @@ func (*PublicChatTypeIsLocationBased) PublicChatTypeType() string { return TypePublicChatTypeIsLocationBased } +// Contains basic information about another user that started a chat with the current user +type AccountInfo struct { + meta + // Month when the user was registered in Telegram; 0-12; may be 0 if unknown + RegistrationMonth int32 `json:"registration_month"` + // Year when the user was registered in Telegram; 0-9999; may be 0 if unknown + RegistrationYear int32 `json:"registration_year"` + // A two-letter ISO 3166-1 alpha-2 country code based on the phone number of the user; may be empty if unknown + PhoneNumberCountryCode string `json:"phone_number_country_code"` + // Point in time (Unix timestamp) when the user changed name last time; 0 if unknown + LastNameChangeDate int32 `json:"last_name_change_date"` + // Point in time (Unix timestamp) when the user changed photo last time; 0 if unknown + LastPhotoChangeDate int32 `json:"last_photo_change_date"` +} + +func (entity *AccountInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AccountInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AccountInfo) GetClass() string { + return ClassAccountInfo +} + +func (*AccountInfo) GetType() string { + return TypeAccountInfo +} + // The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown type ChatActionBarReportSpam struct { meta @@ -16700,6 +16952,8 @@ type ChatActionBarReportAddBlock struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings CanUnarchive bool `json:"can_unarchive"` + // Basic information about the other user in the chat; may be null if unknown + AccountInfo *AccountInfo `json:"account_info"` } func (entity *ChatActionBarReportAddBlock) MarshalJSON() ([]byte, error) { @@ -28798,9 +29052,11 @@ type MessageSendOptions struct { ProtectContent bool `json:"protect_content"` // Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only AllowPaidBroadcast bool `json:"allow_paid_broadcast"` + // The number of Telegram Stars the user agreed to pay to send the messages + PaidMessageStarCount int64 `json:"paid_message_star_count"` // Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` - // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled + // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled SchedulingState MessageSchedulingState `json:"scheduling_state"` // Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats EffectId JsonInt64 `json:"effect_id"` @@ -28832,6 +29088,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` AllowPaidBroadcast bool `json:"allow_paid_broadcast"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` SchedulingState json.RawMessage `json:"scheduling_state"` EffectId JsonInt64 `json:"effect_id"` @@ -28848,6 +29105,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent messageSendOptions.AllowPaidBroadcast = tmp.AllowPaidBroadcast + messageSendOptions.PaidMessageStarCount = tmp.PaidMessageStarCount messageSendOptions.UpdateOrderOfInstalledStickerSets = tmp.UpdateOrderOfInstalledStickerSets messageSendOptions.EffectId = tmp.EffectId messageSendOptions.SendingId = tmp.SendingId @@ -34594,6 +34852,8 @@ type GroupCall struct { meta // Group call identifier Id int32 `json:"id"` + // Identifier of one-to-one call from which the group call was created; 0 if unknown + FromCallId int32 `json:"from_call_id"` // Group call title Title string `json:"title"` // 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 @@ -41754,10 +42014,43 @@ func (*StorePaymentPurposePremiumSubscription) StorePaymentPurposeType() string return TypeStorePaymentPurposePremiumSubscription } -// The user creating Telegram Premium gift codes for other users +// The user gifting Telegram Premium to another user +type StorePaymentPurposePremiumGift struct { + meta + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Identifiers of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` +} + +func (entity *StorePaymentPurposePremiumGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposePremiumGift + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposePremiumGift) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposePremiumGift) GetType() string { + return TypeStorePaymentPurposePremiumGift +} + +func (*StorePaymentPurposePremiumGift) StorePaymentPurposeType() string { + return TypeStorePaymentPurposePremiumGift +} + +// The user boosting a chat by creating Telegram Premium gift codes for other users type StorePaymentPurposePremiumGiftCodes struct { meta - // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -41919,10 +42212,45 @@ func (*StorePaymentPurposeGiftedStars) StorePaymentPurposeType() string { return TypeStorePaymentPurposeGiftedStars } -// The user creating Telegram Premium gift codes for other users +// The user gifting Telegram Premium to another user +type TelegramPaymentPurposePremiumGift struct { + meta + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Identifier of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // Number of months the Telegram Premium subscription will be active for the user + MonthCount int32 `json:"month_count"` + // Text to show to the user receiving Telegram Premium; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` +} + +func (entity *TelegramPaymentPurposePremiumGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposePremiumGift + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposePremiumGift) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposePremiumGift) GetType() string { + return TypeTelegramPaymentPurposePremiumGift +} + +func (*TelegramPaymentPurposePremiumGift) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposePremiumGift +} + +// The user boosting a chat by creating Telegram Premium gift codes for other users type TelegramPaymentPurposePremiumGiftCodes struct { meta - // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -44129,6 +44457,8 @@ func (*PushMessageContentSticker) PushMessageContentType() string { // A message with a story type PushMessageContentStory struct { meta + // True, if the user was mentioned in the story + IsMention bool `json:"is_mention"` // True, if the message is a pinned message with the specified content IsPinned bool `json:"is_pinned"` } @@ -44298,6 +44628,83 @@ func (*PushMessageContentBasicGroupChatCreate) PushMessageContentType() string { return TypePushMessageContentBasicGroupChatCreate } +// A video chat or live stream was started +type PushMessageContentVideoChatStarted struct{ + meta +} + +func (entity *PushMessageContentVideoChatStarted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideoChatStarted + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideoChatStarted) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideoChatStarted) GetType() string { + return TypePushMessageContentVideoChatStarted +} + +func (*PushMessageContentVideoChatStarted) PushMessageContentType() string { + return TypePushMessageContentVideoChatStarted +} + +// A video chat or live stream has ended +type PushMessageContentVideoChatEnded struct{ + meta +} + +func (entity *PushMessageContentVideoChatEnded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideoChatEnded + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideoChatEnded) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideoChatEnded) GetType() string { + return TypePushMessageContentVideoChatEnded +} + +func (*PushMessageContentVideoChatEnded) PushMessageContentType() string { + return TypePushMessageContentVideoChatEnded +} + +// An invitation of participants to a video chat or live stream +type PushMessageContentInviteVideoChatParticipants struct { + meta + // True, if the current user was invited to the video chat or the live stream + IsCurrentUser bool `json:"is_current_user"` +} + +func (entity *PushMessageContentInviteVideoChatParticipants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentInviteVideoChatParticipants + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentInviteVideoChatParticipants) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentInviteVideoChatParticipants) GetType() string { + return TypePushMessageContentInviteVideoChatParticipants +} + +func (*PushMessageContentInviteVideoChatParticipants) PushMessageContentType() string { + return TypePushMessageContentInviteVideoChatParticipants +} + // New chat members were invited to a group type PushMessageContentChatAddMembers struct { meta @@ -44568,6 +44975,33 @@ func (*PushMessageContentSuggestProfilePhoto) PushMessageContentType() string { return TypePushMessageContentSuggestProfilePhoto } +// A user in the chat came within proximity alert range from the current user +type PushMessageContentProximityAlertTriggered struct { + meta + // The distance to the user + Distance int32 `json:"distance"` +} + +func (entity *PushMessageContentProximityAlertTriggered) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentProximityAlertTriggered + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentProximityAlertTriggered) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentProximityAlertTriggered) GetType() string { + return TypePushMessageContentProximityAlertTriggered +} + +func (*PushMessageContentProximityAlertTriggered) PushMessageContentType() string { + return TypePushMessageContentProximityAlertTriggered +} + // A forwarded messages type PushMessageContentMessageForwards struct { meta @@ -46091,6 +46525,31 @@ func (*UserPrivacySettingAutosaveGifts) UserPrivacySettingType() string { return TypeUserPrivacySettingAutosaveGifts } +// A privacy setting for managing whether the user can receive messages without additional payment +type UserPrivacySettingAllowUnpaidMessages struct{ + meta +} + +func (entity *UserPrivacySettingAllowUnpaidMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAllowUnpaidMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAllowUnpaidMessages) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAllowUnpaidMessages) GetType() string { + return TypeUserPrivacySettingAllowUnpaidMessages +} + +func (*UserPrivacySettingAllowUnpaidMessages) UserPrivacySettingType() string { + return TypeUserPrivacySettingAllowUnpaidMessages +} + // Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting type ReadDatePrivacySettings struct { meta @@ -46114,11 +46573,13 @@ func (*ReadDatePrivacySettings) GetType() string { return TypeReadDatePrivacySettings } -// Contains privacy settings for new chats with non-contacts +// Contains privacy settings for chats with non-contacts type NewChatPrivacySettings struct { meta // True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting AllowNewChatsFromUnknownUsers bool `json:"allow_new_chats_from_unknown_users"` + // Number of Telegram Stars that must be paid for every incoming private message by non-contacts; 0-getOption("paid_message_star_count_max"). If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` } func (entity *NewChatPrivacySettings) MarshalJSON() ([]byte, error) { @@ -46162,6 +46623,33 @@ func (*CanSendMessageToUserResultOk) CanSendMessageToUserResultType() string { return TypeCanSendMessageToUserResultOk } +// The user can be messaged, but the messages are paid +type CanSendMessageToUserResultUserHasPaidMessages struct { + meta + // Number of Telegram Stars that must be paid by the current user for each sent message to the user + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` +} + +func (entity *CanSendMessageToUserResultUserHasPaidMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendMessageToUserResultUserHasPaidMessages + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) GetClass() string { + return ClassCanSendMessageToUserResult +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) GetType() string { + return TypeCanSendMessageToUserResultUserHasPaidMessages +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) CanSendMessageToUserResultType() string { + return TypeCanSendMessageToUserResultUserHasPaidMessages +} + // The user can't be messaged, because they are deleted or unknown type CanSendMessageToUserResultUserIsDeleted struct{ meta @@ -48172,7 +48660,7 @@ func (*InternalLinkTypePremiumFeatures) InternalLinkTypeType() string { return TypeInternalLinkTypePremiumFeatures } -// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGiftCodes payments or in-store purchases +// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGift payments or in-store purchases type InternalLinkTypePremiumGift struct { meta // Referrer specified in the link @@ -51185,6 +51673,29 @@ func (*FileDownloadedPrefixSize) GetType() string { return TypeFileDownloadedPrefixSize } +// Contains a number of Telegram Stars +type StarCount struct { + meta + // Number of Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *StarCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarCount + + return json.Marshal((*stub)(entity)) +} + +func (*StarCount) GetClass() string { + return ClassStarCount +} + +func (*StarCount) GetType() string { + return TypeStarCount +} + // Contains information about a tg: deep link type DeepLinkInfo struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 313cb84..62cd54e 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -922,6 +922,15 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeAffiliateProgramCommission: return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + case TypeStarTransactionTypePaidMessageSend: + return UnmarshalStarTransactionTypePaidMessageSend(data) + + case TypeStarTransactionTypePaidMessageReceive: + return UnmarshalStarTransactionTypePaidMessageReceive(data) + + case TypeStarTransactionTypePremiumPurchase: + return UnmarshalStarTransactionTypePremiumPurchase(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -5726,6 +5735,9 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) + case TypeStorePaymentPurposePremiumGift: + return UnmarshalStorePaymentPurposePremiumGift(data) + case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -5769,6 +5781,9 @@ func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpo } switch meta.Type { + case TypeTelegramPaymentPurposePremiumGift: + return UnmarshalTelegramPaymentPurposePremiumGift(data) + case TypeTelegramPaymentPurposePremiumGiftCodes: return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) @@ -6311,6 +6326,15 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentBasicGroupChatCreate: return UnmarshalPushMessageContentBasicGroupChatCreate(data) + case TypePushMessageContentVideoChatStarted: + return UnmarshalPushMessageContentVideoChatStarted(data) + + case TypePushMessageContentVideoChatEnded: + return UnmarshalPushMessageContentVideoChatEnded(data) + + case TypePushMessageContentInviteVideoChatParticipants: + return UnmarshalPushMessageContentInviteVideoChatParticipants(data) + case TypePushMessageContentChatAddMembers: return UnmarshalPushMessageContentChatAddMembers(data) @@ -6341,6 +6365,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentSuggestProfilePhoto: return UnmarshalPushMessageContentSuggestProfilePhoto(data) + case TypePushMessageContentProximityAlertTriggered: + return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -6678,6 +6705,9 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro case TypeUserPrivacySettingAutosaveGifts: return UnmarshalUserPrivacySettingAutosaveGifts(data) + case TypeUserPrivacySettingAllowUnpaidMessages: + return UnmarshalUserPrivacySettingAllowUnpaidMessages(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6709,6 +6739,9 @@ func UnmarshalCanSendMessageToUserResult(data json.RawMessage) (CanSendMessageTo case TypeCanSendMessageToUserResultOk: return UnmarshalCanSendMessageToUserResultOk(data) + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data) + case TypeCanSendMessageToUserResultUserIsDeleted: return UnmarshalCanSendMessageToUserResultUserIsDeleted(data) @@ -9752,16 +9785,32 @@ func UnmarshalPremiumStatePaymentOption(data json.RawMessage) (*PremiumStatePaym return &resp, err } -func UnmarshalPremiumGiftCodePaymentOption(data json.RawMessage) (*PremiumGiftCodePaymentOption, error) { - var resp PremiumGiftCodePaymentOption +func UnmarshalPremiumGiftPaymentOption(data json.RawMessage) (*PremiumGiftPaymentOption, error) { + var resp PremiumGiftPaymentOption err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiftCodePaymentOptions(data json.RawMessage) (*PremiumGiftCodePaymentOptions, error) { - var resp PremiumGiftCodePaymentOptions +func UnmarshalPremiumGiftPaymentOptions(data json.RawMessage) (*PremiumGiftPaymentOptions, error) { + var resp PremiumGiftPaymentOptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayPaymentOption(data json.RawMessage) (*PremiumGiveawayPaymentOption, error) { + var resp PremiumGiveawayPaymentOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayPaymentOptions(data json.RawMessage) (*PremiumGiveawayPaymentOptions, error) { + var resp PremiumGiveawayPaymentOptions err := json.Unmarshal(data, &resp) @@ -10152,6 +10201,30 @@ func UnmarshalStarTransactionTypeAffiliateProgramCommission(data json.RawMessage return &resp, err } +func UnmarshalStarTransactionTypePaidMessageSend(data json.RawMessage) (*StarTransactionTypePaidMessageSend, error) { + var resp StarTransactionTypePaidMessageSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePaidMessageReceive(data json.RawMessage) (*StarTransactionTypePaidMessageReceive, error) { + var resp StarTransactionTypePaidMessageReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePremiumPurchase(data json.RawMessage) (*StarTransactionTypePremiumPurchase, error) { + var resp StarTransactionTypePremiumPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { var resp StarTransactionTypeUnsupported @@ -11696,6 +11769,14 @@ func UnmarshalPublicChatTypeIsLocationBased(data json.RawMessage) (*PublicChatTy return &resp, err } +func UnmarshalAccountInfo(data json.RawMessage) (*AccountInfo, error) { + var resp AccountInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatActionBarReportSpam(data json.RawMessage) (*ChatActionBarReportSpam, error) { var resp ChatActionBarReportSpam @@ -17696,6 +17777,14 @@ func UnmarshalStorePaymentPurposePremiumSubscription(data json.RawMessage) (*Sto return &resp, err } +func UnmarshalStorePaymentPurposePremiumGift(data json.RawMessage) (*StorePaymentPurposePremiumGift, error) { + var resp StorePaymentPurposePremiumGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStorePaymentPurposePremiumGiftCodes(data json.RawMessage) (*StorePaymentPurposePremiumGiftCodes, error) { var resp StorePaymentPurposePremiumGiftCodes @@ -17736,6 +17825,14 @@ func UnmarshalStorePaymentPurposeGiftedStars(data json.RawMessage) (*StorePaymen return &resp, err } +func UnmarshalTelegramPaymentPurposePremiumGift(data json.RawMessage) (*TelegramPaymentPurposePremiumGift, error) { + var resp TelegramPaymentPurposePremiumGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTelegramPaymentPurposePremiumGiftCodes(data json.RawMessage) (*TelegramPaymentPurposePremiumGiftCodes, error) { var resp TelegramPaymentPurposePremiumGiftCodes @@ -18400,6 +18497,30 @@ func UnmarshalPushMessageContentBasicGroupChatCreate(data json.RawMessage) (*Pus return &resp, err } +func UnmarshalPushMessageContentVideoChatStarted(data json.RawMessage) (*PushMessageContentVideoChatStarted, error) { + var resp PushMessageContentVideoChatStarted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentVideoChatEnded(data json.RawMessage) (*PushMessageContentVideoChatEnded, error) { + var resp PushMessageContentVideoChatEnded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentInviteVideoChatParticipants(data json.RawMessage) (*PushMessageContentInviteVideoChatParticipants, error) { + var resp PushMessageContentInviteVideoChatParticipants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentChatAddMembers(data json.RawMessage) (*PushMessageContentChatAddMembers, error) { var resp PushMessageContentChatAddMembers @@ -18480,6 +18601,14 @@ func UnmarshalPushMessageContentSuggestProfilePhoto(data json.RawMessage) (*Push return &resp, err } +func UnmarshalPushMessageContentProximityAlertTriggered(data json.RawMessage) (*PushMessageContentProximityAlertTriggered, error) { + var resp PushMessageContentProximityAlertTriggered + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentMessageForwards(data json.RawMessage) (*PushMessageContentMessageForwards, error) { var resp PushMessageContentMessageForwards @@ -18904,6 +19033,14 @@ func UnmarshalUserPrivacySettingAutosaveGifts(data json.RawMessage) (*UserPrivac return &resp, err } +func UnmarshalUserPrivacySettingAllowUnpaidMessages(data json.RawMessage) (*UserPrivacySettingAllowUnpaidMessages, error) { + var resp UserPrivacySettingAllowUnpaidMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReadDatePrivacySettings(data json.RawMessage) (*ReadDatePrivacySettings, error) { var resp ReadDatePrivacySettings @@ -18928,6 +19065,14 @@ func UnmarshalCanSendMessageToUserResultOk(data json.RawMessage) (*CanSendMessag return &resp, err } +func UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data json.RawMessage) (*CanSendMessageToUserResultUserHasPaidMessages, error) { + var resp CanSendMessageToUserResultUserHasPaidMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCanSendMessageToUserResultUserIsDeleted(data json.RawMessage) (*CanSendMessageToUserResultUserIsDeleted, error) { var resp CanSendMessageToUserResultUserIsDeleted @@ -20376,6 +20521,14 @@ func UnmarshalFileDownloadedPrefixSize(data json.RawMessage) (*FileDownloadedPre return &resp, err } +func UnmarshalStarCount(data json.RawMessage) (*StarCount, error) { + var resp StarCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeepLinkInfo(data json.RawMessage) (*DeepLinkInfo, error) { var resp DeepLinkInfo @@ -22596,11 +22749,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumStatePaymentOption: return UnmarshalPremiumStatePaymentOption(data) - case TypePremiumGiftCodePaymentOption: - return UnmarshalPremiumGiftCodePaymentOption(data) + case TypePremiumGiftPaymentOption: + return UnmarshalPremiumGiftPaymentOption(data) - case TypePremiumGiftCodePaymentOptions: - return UnmarshalPremiumGiftCodePaymentOptions(data) + case TypePremiumGiftPaymentOptions: + return UnmarshalPremiumGiftPaymentOptions(data) + + case TypePremiumGiveawayPaymentOption: + return UnmarshalPremiumGiveawayPaymentOption(data) + + case TypePremiumGiveawayPaymentOptions: + return UnmarshalPremiumGiveawayPaymentOptions(data) case TypePremiumGiftCodeInfo: return UnmarshalPremiumGiftCodeInfo(data) @@ -22746,6 +22905,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeAffiliateProgramCommission: return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + case TypeStarTransactionTypePaidMessageSend: + return UnmarshalStarTransactionTypePaidMessageSend(data) + + case TypeStarTransactionTypePaidMessageReceive: + return UnmarshalStarTransactionTypePaidMessageReceive(data) + + case TypeStarTransactionTypePremiumPurchase: + return UnmarshalStarTransactionTypePremiumPurchase(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -23325,6 +23493,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePublicChatTypeIsLocationBased: return UnmarshalPublicChatTypeIsLocationBased(data) + case TypeAccountInfo: + return UnmarshalAccountInfo(data) + case TypeChatActionBarReportSpam: return UnmarshalChatActionBarReportSpam(data) @@ -25575,6 +25746,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) + case TypeStorePaymentPurposePremiumGift: + return UnmarshalStorePaymentPurposePremiumGift(data) + case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -25590,6 +25764,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposeGiftedStars: return UnmarshalStorePaymentPurposeGiftedStars(data) + case TypeTelegramPaymentPurposePremiumGift: + return UnmarshalTelegramPaymentPurposePremiumGift(data) + case TypeTelegramPaymentPurposePremiumGiftCodes: return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) @@ -25839,6 +26016,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentBasicGroupChatCreate: return UnmarshalPushMessageContentBasicGroupChatCreate(data) + case TypePushMessageContentVideoChatStarted: + return UnmarshalPushMessageContentVideoChatStarted(data) + + case TypePushMessageContentVideoChatEnded: + return UnmarshalPushMessageContentVideoChatEnded(data) + + case TypePushMessageContentInviteVideoChatParticipants: + return UnmarshalPushMessageContentInviteVideoChatParticipants(data) + case TypePushMessageContentChatAddMembers: return UnmarshalPushMessageContentChatAddMembers(data) @@ -25869,6 +26055,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentSuggestProfilePhoto: return UnmarshalPushMessageContentSuggestProfilePhoto(data) + case TypePushMessageContentProximityAlertTriggered: + return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -26028,6 +26217,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingAutosaveGifts: return UnmarshalUserPrivacySettingAutosaveGifts(data) + case TypeUserPrivacySettingAllowUnpaidMessages: + return UnmarshalUserPrivacySettingAllowUnpaidMessages(data) + case TypeReadDatePrivacySettings: return UnmarshalReadDatePrivacySettings(data) @@ -26037,6 +26229,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCanSendMessageToUserResultOk: return UnmarshalCanSendMessageToUserResultOk(data) + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data) + case TypeCanSendMessageToUserResultUserIsDeleted: return UnmarshalCanSendMessageToUserResultUserIsDeleted(data) @@ -26580,6 +26775,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFileDownloadedPrefixSize: return UnmarshalFileDownloadedPrefixSize(data) + case TypeStarCount: + return UnmarshalStarCount(data) + case TypeDeepLinkInfo: return UnmarshalDeepLinkInfo(data) diff --git a/data/td_api.tl b/data/td_api.tl index 28709bd..8872945 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -529,12 +529,13 @@ poll id:int64 question:formattedText options:vector total_voter_coun //@description Describes an alternative re-encoded quality of a video file +//@id Unique identifier of the alternative video, which is used in the HLS 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; +alternativeVideo id:int64 width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; //@description Describes a chat background @@ -972,19 +973,30 @@ premiumPaymentOption currency:string amount:int53 discount_percentage:int32 mont //@last_transaction_id Identifier of the last in-store transaction for the currently used option premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is_upgrade:Bool last_transaction_id:string = PremiumStatePaymentOption; -//@description Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments +//@description Describes an option for gifting Telegram Premium to a user. Use telegramPaymentPurposePremiumGift for out-of-store payments or payments in Telegram Stars +//@currency ISO 4217 currency code for the payment +//@amount The amount to pay, in the smallest units of the currency +//@star_count The alternative amount of Telegram Stars to pay; 0 if payment in Telegram Stars is not possible +//@discount_percentage The discount associated with this option, as a percentage +//@month_count Number of months the Telegram Premium subscription will be active +//@store_product_id Identifier of the store product associated with the option +//@sticker A sticker to be shown along with the option; may be null if unknown +premiumGiftPaymentOption currency:string amount:int53 star_count:int53 discount_percentage:int32 month_count:int32 store_product_id:string sticker:sticker = PremiumGiftPaymentOption; + +//@description Contains a list of options for gifting Telegram Premium to a user @options The list of options sorted by Telegram Premium subscription duration +premiumGiftPaymentOptions options:vector = PremiumGiftPaymentOptions; + +//@description Describes an option for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments //@currency ISO 4217 currency code for Telegram Premium gift code payment //@amount The amount to pay, in the smallest units of the currency -//@discount_percentage The discount associated with this option, as a percentage //@winner_count Number of users which will be able to activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active //@store_product_id Identifier of the store product associated with the option; may be empty if none //@store_product_quantity Number of times the store product must be paid -//@sticker A sticker to be shown along with the gift code; may be null if unknown -premiumGiftCodePaymentOption currency:string amount:int53 discount_percentage:int32 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 sticker:sticker = PremiumGiftCodePaymentOption; +premiumGiveawayPaymentOption currency:string amount:int53 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiveawayPaymentOption; -//@description Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway @options The list of options -premiumGiftCodePaymentOptions options:vector = PremiumGiftCodePaymentOptions; +//@description Contains a list of options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members @options The list of options +premiumGiveawayPaymentOptions options:vector = PremiumGiveawayPaymentOptions; //@description Contains information about a Telegram Premium gift code //@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown. If null and the code is from messagePremiumGiftCode message, then creator_id from the message can be used @@ -1013,7 +1025,7 @@ starPaymentOptions options:vector = StarPaymentOptions; //@is_default True, if the option must be chosen by default starGiveawayWinnerOption winner_count:int32 won_star_count:int53 is_default:Bool = StarGiveawayWinnerOption; -//@description Describes an option for creating Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments +//@description Describes an option for creating of Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments //@currency ISO 4217 currency code for the payment //@amount The amount to pay, in the smallest units of the currency //@star_count Number of Telegram Stars that will be distributed among winners @@ -1024,7 +1036,7 @@ starGiveawayWinnerOption winner_count:int32 won_star_count:int53 is_default:Bool //@is_additional True, if the option must be shown only in the full list of payment options starGiveawayPaymentOption currency:string amount:int53 star_count:int53 store_product_id:string yearly_boost_count:int32 winner_options:vector is_default:Bool is_additional:Bool = StarGiveawayPaymentOption; -//@description Contains a list of options for creating Telegram Star giveaway @options The list of options +//@description Contains a list of options for creating of Telegram Star giveaway @options The list of options starGiveawayPaymentOptions options:vector = StarGiveawayPaymentOptions; @@ -1118,6 +1130,7 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@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 chat's profile page; only for the receiver of the gift +//@is_pinned True, if the gift is pinned to the top of the chat's profile page //@can_be_upgraded True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift //@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift //@was_refunded True, if the gift was refunded and isn't available anymore @@ -1127,7 +1140,7 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; //@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts @@ -1176,7 +1189,8 @@ starTransactionTypeUserDeposit user_id:int53 sticker:sticker = StarTransactionTy //@giveaway_message_id Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message starTransactionTypeGiveawayDeposit chat_id:int53 giveaway_message_id:int53 = StarTransactionType; -//@description The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only @withdrawal_state State of the withdrawal; may be null for refunds from Fragment +//@description The transaction is a withdrawal of earned Telegram Stars to Fragment; for regular users, bots, supergroup and channel chats only +//@withdrawal_state State of the withdrawal; may be null for refunds from Fragment starTransactionTypeFragmentWithdrawal withdrawal_state:RevenueWithdrawalState = StarTransactionType; //@description The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only @@ -1254,8 +1268,8 @@ starTransactionTypeGiftTransfer owner_id:MessageSender gift:upgradedGift = StarT //@description The transaction is a sale of a received gift; for regular users and channel chats only @user_id Identifier of the user that sent the gift @gift The gift starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; -//@description The transaction is an upgrade of a gift; for regular users only @gift The upgraded gift -starTransactionTypeGiftUpgrade gift:upgradedGift = StarTransactionType; +//@description The transaction is an upgrade of a gift; for regular users only @user_id Identifier of the user that initially sent the gift @gift The upgraded gift +starTransactionTypeGiftUpgrade user_id:int53 gift:upgradedGift = StarTransactionType; //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat @@ -1272,6 +1286,22 @@ starTransactionTypeChannelPaidReactionReceive user_id:int53 message_id:int53 = S //@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner starTransactionTypeAffiliateProgramCommission chat_id:int53 commission_per_mille:int32 = StarTransactionType; +//@description The transaction is a sending of a paid message; for regular users only @chat_id Identifier of the chat that received the payment @message_count Number of sent paid messages +starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTransactionType; + +//@description The transaction is a receiving of a paid message; for regular users and supergroup chats only +//@sender_id Identifier of the sender of the message +//@message_count Number of received paid messages +//@commission_per_mille The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending +//@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds +starTransactionTypePaidMessageReceive sender_id:MessageSender message_count:int32 commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; + +//@description The transaction is a purchase of Telegram Premium subscription; for regular users only +//@user_id Identifier of the user that received the Telegram Premium subscription +//@month_count Number of months the Telegram Premium subscription will be active +//@sticker A sticker to be shown in the transaction information; may be null if unknown +starTransactionTypePremiumPurchase user_id:int53 month_count:int32 sticker:sticker = StarTransactionType; + //@description The transaction is a transaction of an unsupported type starTransactionTypeUnsupported = StarTransactionType; @@ -1420,11 +1450,12 @@ usernames active_usernames:vector disabled_usernames:vector edit //@has_active_stories True, if the user has non-expired stories available to the current user //@has_unread_active_stories True, if the user has unread non-expired stories available to the current user //@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them +//@paid_message_star_count Number of Telegram Stars that must be paid by general user for each sent message to the user. If positive and userFullInfo is unknown, use canSendMessageToUser to check whether the current user must pay //@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool paid_message_star_count:int53 have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -1474,10 +1505,12 @@ botInfo short_description:string description:string photo:photo animation:animat //@personal_chat_id Identifier of the personal chat of the user; 0 if none //@gift_count Number of saved to profile gifts for other users or the total number of received gifts for the current 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 +//@incoming_paid_message_star_count Number of Telegram Stars that must be paid by the user for each sent message to the current user +//@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the user //@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown //@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 gift_count:int32 group_in_common_count:int32 bot_verification:botVerification 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 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 bot_verification:botVerification 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; @@ -1719,9 +1752,10 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@verification_status Information about verification status of the supergroup or channel; may be null if none //@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted +//@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1733,6 +1767,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@linked_chat_id Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown //@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds //@slow_mode_delay_expires_in Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero +//@can_enable_paid_messages True, if paid messages can be enabled in the supergroup chat; for supergroup only //@can_enable_paid_reaction True, if paid reaction can be enabled in the channel chat; for channels only //@can_get_members True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers //@has_hidden_members True, if non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers @@ -1761,7 +1796,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1973,8 +2008,9 @@ messageSendingStatePending sending_id:int32 = MessageSendingState; //@need_another_sender True, if the message can be re-sent only on behalf of a different sender //@need_another_reply_quote True, if the message can be re-sent only if another quote is chosen in the message that is replied by the given message //@need_drop_reply True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages +//@required_paid_message_star_count The number of Telegram Stars that must be paid to send the message; 0 if the current amount is correct //@retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes -messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool retry_after:double = MessageSendingState; +messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool required_paid_message_star_count:int53 retry_after:double = MessageSendingState; //@description Describes manually or automatically chosen quote from another message @@ -2062,6 +2098,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@via_bot_user_id If non-zero, the user identifier of the inline bot through which this message was sent //@sender_business_bot_user_id If non-zero, the user identifier of the business bot that sent this message //@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead +//@paid_message_star_count The number of Telegram Stars the sender paid to send the message //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums //@effect_id Unique identifier of the effect added to the message; 0 if none @@ -2069,7 +2106,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2489,6 +2526,15 @@ publicChatTypeHasUsername = PublicChatType; publicChatTypeIsLocationBased = PublicChatType; +//@description Contains basic information about another user that started a chat with the current user +//@registration_month Month when the user was registered in Telegram; 0-12; may be 0 if unknown +//@registration_year Year when the user was registered in Telegram; 0-9999; may be 0 if unknown +//@phone_number_country_code A two-letter ISO 3166-1 alpha-2 country code based on the phone number of the user; may be empty if unknown +//@last_name_change_date Point in time (Unix timestamp) when the user changed name last time; 0 if unknown +//@last_photo_change_date Point in time (Unix timestamp) when the user changed photo last time; 0 if unknown +accountInfo registration_month:int32 registration_year:int32 phone_number_country_code:string last_name_change_date:int32 last_photo_change_date:int32 = AccountInfo; + + //@class ChatActionBar @description Describes actions which must be possible to do through a chat action bar //@description The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown @@ -2501,7 +2547,8 @@ chatActionBarInviteMembers = ChatActionBar; //@description The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method setMessageSenderBlockList, //-or the other user can be added to the contact list using the method addContact. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown //@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings -chatActionBarReportAddBlock can_unarchive:Bool = ChatActionBar; +//@account_info Basic information about the other user in the chat; may be null if unknown +chatActionBarReportAddBlock can_unarchive:Bool account_info:accountInfo = ChatActionBar; //@description The chat is a private or secret chat and the other user can be added to the contact list using the method addContact chatActionBarAddContact = ChatActionBar; @@ -4248,12 +4295,13 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only //@allow_paid_broadcast Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only +//@paid_message_star_count The number of Telegram Stars the user agreed to pay to send the messages //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum -//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled +//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. @@ -5221,6 +5269,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@description Describes a group call //@id Group call identifier +//@from_call_id Identifier of one-to-one call from which the group call was created; 0 if unknown //@title Group call title //@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 @@ -5241,7 +5290,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@record_duration Duration of the ongoing group call recording, in seconds; 0 if none. An updateGroupCall update is not triggered when value of this field changes, but the same recording goes on //@is_video_recorded True, if a video file is being recorded for the call //@duration Call duration, in seconds; for ended calls only -groupCall id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; +groupCall id:int32 from_call_id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; //@description Describes a group of video synchronization source identifiers @semantics The semantics of sources, one of "SIM" or "FID" @source_ids The list of synchronization source identifiers groupCallVideoSourceGroup semantics:string source_ids:vector = GroupCallVideoSourceGroup; @@ -6258,8 +6307,15 @@ premiumState state:formattedText payment_options:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; -//@description Sends messages from a quick reply shortcut. Requires Telegram Business subscription +//@description Sends messages from a quick reply shortcut. Requires Telegram Business subscription. Can't be used to send paid messages //@chat_id Identifier of the chat to which to send messages. The chat must be a private chat with a regular user //@shortcut_id Unique identifier of the quick reply shortcut //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates @@ -9374,7 +9463,8 @@ sendQuickReplyShortcutMessages chat_id:int53 shortcut_id:int32 sending_id:int32 //@chat_id Identifier of the chat to send messages //@message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order //@quote New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false -resendMessages chat_id:int53 message_ids:vector quote:inputTextQuote = Messages; +//@paid_message_star_count The number of Telegram Stars the user agreed to pay to send the messages. Ignored if messageSendingStateFailed.required_paid_message_star_count == 0 +resendMessages chat_id:int53 message_ids:vector quote:inputTextQuote paid_message_star_count:int53 = Messages; //@description Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats @chat_id Chat identifier sendChatScreenshotTakenNotification chat_id:int53 = Ok; @@ -10888,7 +10978,7 @@ processChatJoinRequests chat_id:int53 invite_link:string approve:Bool = Ok; //@user_id Identifier of the user to be called //@protocol The call protocols supported by the application //@is_video Pass true to create a video call -//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored +//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none createCall user_id:int53 protocol:callProtocol is_video:Bool group_call_id:int32 = CallId; //@description Accepts an incoming call @call_id Call identifier @protocol The call protocols supported by the application @@ -10960,7 +11050,8 @@ toggleGroupCallEnabledStartNotification group_call_id:int32 enabled_start_notifi //@is_muted Pass true to join the call with muted microphone //@is_my_video_enabled Pass true if the user's video is enabled //@invite_hash If non-empty, invite hash to be used to join the group call without being muted by administrators -joinGroupCall group_call_id:int32 participant_id:MessageSender audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool invite_hash:string = Text; +//@key_fingerprint Fingerprint of the encryption key for E2E group calls not bound to a chat; pass 0 for voice chats +joinGroupCall group_call_id:int32 participant_id:MessageSender audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool invite_hash:string key_fingerprint:int64 = Text; //@description Starts screen sharing in a joined group call. Returns join response payload for tgcalls //@group_call_id Group call identifier @@ -11117,7 +11208,9 @@ getCloseFriends = Users; //@description Changes a personal profile photo of a contact user @user_id User identifier @photo Profile photo to set; pass null to delete the photo; inputChatPhotoPrevious isn't supported in this function setUserPersonalProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; -//@description Suggests a profile photo to another regular user with common messages @user_id User identifier @photo Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function +//@description Suggests a profile photo to another regular user with common messages and allowing non-paid messages +//@user_id User identifier +//@photo Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function suggestUserProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; //@description Toggles whether the bot can manage emoji status of the current user @bot_user_id User identifier of the bot @can_manage_emoji_status Pass true if the bot is allowed to change emoji status of the user; pass false otherwise @@ -11313,8 +11406,10 @@ removeRecentHashtag hashtag:string = Ok; //@link_preview_options Options to be used for generation of the link preview; pass null to use default link preview options getLinkPreview text:formattedText link_preview_options:linkPreviewOptions = LinkPreview; -//@description Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page @url The web page URL @force_full Pass true to get full instant view for the web page -getWebPageInstantView url:string force_full:Bool = WebPageInstantView; +//@description Returns an instant view version of a web page if available. This is an offline request if only_local is true. Returns a 404 error if the web page has no instant view page +//@url The web page URL +//@only_local Pass true to get only locally available information without sending network requests +getWebPageInstantView url:string only_local:Bool = WebPageInstantView; //@description Changes a profile photo for the current user @@ -11764,7 +11859,8 @@ getAvailableGifts = Gifts; //@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send //@owner_id Identifier of the user or the channel chat 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 +//@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. +//-Must be empty if the receiver enabled paid messages //@is_private Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them //@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; @@ -11772,11 +11868,16 @@ sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool //@description Sells a gift for Telegram Stars @received_gift_id Identifier of the gift sellGift received_gift_id:string = Ok; -//@description Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the chat +//@description Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat //@received_gift_id Identifier of the gift //@is_saved Pass true to display the gift on the user's or the channel's profile page; pass false to remove it from the profile page toggleGiftIsSaved received_gift_id:string is_saved:Bool = Ok; +//@description Changes the list of pinned gifts on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat +//@owner_id Identifier of the user or the channel chat that received the gifts +//@received_gift_ids New list of pinned gifts. All gifts must be upgraded and saved on the profile page first. There can be up to getOption("pinned_gift_count_max") pinned gifts +setPinnedGifts owner_id:MessageSender received_gift_ids:vector = Ok; + //@description Toggles whether notifications for new gifts received by a channel chat are sent to the current user; requires can_post_messages administrator right in the chat //@chat_id Identifier of the channel chat //@are_enabled Pass true to enable notifications about new gifts owned by the channel chat; pass false to disable the notifications @@ -11930,6 +12031,20 @@ setNewChatPrivacySettings settings:newChatPrivacySettings = Ok; //@description Returns privacy settings for new chat creation getNewChatPrivacySettings = NewChatPrivacySettings; +//@description Returns the total number of Telegram Stars received by the current user for paid messages from the given user @user_id Identifier of the user +getPaidMessageRevenue user_id:int53 = StarCount; + +//@description Allows the specified user to send unpaid private messages to the current user by adding a rule to userPrivacySettingAllowUnpaidMessages +//@user_id Identifier of the user +//@refund_payments Pass true to refund the user previously paid messages +allowUnpaidMessagesFromUser user_id:int53 refund_payments:Bool = Ok; + +//@description Changes the amount of Telegram Stars that must be paid to send a message to a supergroup chat; requires can_restrict_members administrator right and supergroupFullInfo.can_enable_paid_messages +//@chat_id Identifier of the supergroup chat +//@paid_message_star_count The new number of Telegram Stars that must be paid for each message that is sent to the supergroup chat unless the sender is an administrator of the chat; 0-getOption("paid_message_star_count_max"). +//-The supergroup will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending +setChatPaidMessageStarCount chat_id:int53 paid_message_star_count:int53 = Ok; + //@description Check whether the current user can message another user or try to create a chat with them //@user_id Identifier of the other user @@ -12012,12 +12127,12 @@ getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueT //@description Returns detailed Telegram Star revenue statistics -//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true //@is_dark Pass true if a dark theme is used by the application getStarRevenueStatistics owner_id:MessageSender is_dark:Bool = StarRevenueStatistics; //@description Returns a URL for Telegram Star withdrawal -//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat //@star_count The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") //@password The 2-step verification password of the current user getStarWithdrawalUrl owner_id:MessageSender star_count:int53 password:string = HttpUrl; @@ -12273,9 +12388,12 @@ clickPremiumSubscriptionButton = Ok; //@description Returns state of Telegram Premium subscription and promotion videos for Premium features getPremiumState = PremiumState; -//@description Returns available options for Telegram Premium gift code or Telegram Premium giveaway creation -//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none -getPremiumGiftCodePaymentOptions boosted_chat_id:int53 = PremiumGiftCodePaymentOptions; +//@description Returns available options for gifting Telegram Premium to a user +getPremiumGiftPaymentOptions = PremiumGiftPaymentOptions; + +//@description Returns available options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user +getPremiumGiveawayPaymentOptions boosted_chat_id:int53 = PremiumGiveawayPaymentOptions; //@description Return information about a Telegram Premium gift code @code The code to check checkPremiumGiftCode code:string = PremiumGiftCodeInfo; @@ -12306,7 +12424,7 @@ getStarGiveawayPaymentOptions = StarGiveawayPaymentOptions; //@description Returns the list of Telegram Star transactions for the specified owner //@owner_id Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, -//-or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true +//-or identifier of a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true //@subscription_id If non-empty, only transactions related to the Star Subscription will be returned //@direction Direction of the transactions to receive; pass null to get all transactions //@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results From 05b67218a96588edd23ee7158d3e2f7733e403c0 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Wed, 12 Mar 2025 00:35:34 +0800 Subject: [PATCH 12/29] Check space before @ --- client/extra.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/extra.go b/client/extra.go index 61dd7fc..0a6c60f 100644 --- a/client/extra.go +++ b/client/extra.go @@ -25,18 +25,18 @@ func IsCommand(text string) bool { func CheckCommand(text string, entities []*TextEntity) string { if IsCommand(text) { - // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] - // Result: "/hello" - if i := strings.Index(text, "@"); i != -1 { - return text[:i] - } - // e.g. ["/hello 123", "/hell o 123"] // Result: "/hello", "/hell" if i := strings.Index(text, " "); i != -1 { return text[:i] } + // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] + // Result: "/hello" + if i := strings.Index(text, "@"); i != -1 { + return text[:i] + } + return text } return "" From c695d13f46308de873f66d27c90db5a26aae4dcf Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 13 Apr 2025 20:30:45 +0800 Subject: [PATCH 13/29] Update to TDLib 1.8.47 --- client/function.go | 733 +++++++++++++++++++++++++++++++++++++----- client/type.go | 589 +++++++++++++++++++++++++++++---- client/unmarshaler.go | 277 ++++++++++++++-- data/td_api.tl | 314 ++++++++++++++---- 4 files changed, 1664 insertions(+), 249 deletions(-) diff --git a/client/function.go b/client/function.go index 51e31dc..f4c29cf 100755 --- a/client/function.go +++ b/client/function.go @@ -6,7 +6,7 @@ import ( "errors" ) -// Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization +// Returns the current authorization state. This is an offline method. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization func (client *Client) GetAuthorizationState() (AuthorizationState, error) { result, err := client.Send(Request{ meta: meta{ @@ -29,6 +29,9 @@ func (client *Client) GetAuthorizationState() (AuthorizationState, error) { case TypeAuthorizationStateWaitPhoneNumber: return UnmarshalAuthorizationStateWaitPhoneNumber(result.Data) + case TypeAuthorizationStateWaitPremiumPurchase: + return UnmarshalAuthorizationStateWaitPremiumPurchase(result.Data) + case TypeAuthorizationStateWaitEmailAddress: return UnmarshalAuthorizationStateWaitEmailAddress(result.Data) @@ -136,7 +139,7 @@ type SetAuthenticationPhoneNumberRequest struct { Settings *PhoneNumberAuthenticationSettings `json:"settings"` } -// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNumberRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -158,6 +161,70 @@ func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNu return UnmarshalOk(result.Data) } +type CheckAuthenticationPremiumPurchaseRequest struct { + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` +} + +// Checks whether an in-store purchase of Telegram Premium is possible before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +func (client *Client) CheckAuthenticationPremiumPurchase(req *CheckAuthenticationPremiumPurchaseRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkAuthenticationPremiumPurchase", + }, + Data: map[string]interface{}{ + "currency": req.Currency, + "amount": req.Amount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetAuthenticationPremiumPurchaseTransactionRequest struct { + // Information about the transaction + Transaction StoreTransaction `json:"transaction"` + // Pass true if this is a restore of a Telegram Premium purchase; only for App Store + IsRestore bool `json:"is_restore"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` +} + +// Informs server about an in-store purchase of Telegram Premium before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +func (client *Client) SetAuthenticationPremiumPurchaseTransaction(req *SetAuthenticationPremiumPurchaseTransactionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAuthenticationPremiumPurchaseTransaction", + }, + Data: map[string]interface{}{ + "transaction": req.Transaction, + "is_restore": req.IsRestore, + "currency": req.Currency, + "amount": req.Amount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetAuthenticationEmailAddressRequest struct { // The email address of the user EmailAddress string `json:"email_address"` @@ -267,7 +334,7 @@ type RequestQrCodeAuthenticationRequest struct { OtherUserIds []int64 `json:"other_user_ids"` } -// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword func (client *Client) RequestQrCodeAuthentication(req *RequestQrCodeAuthenticationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -1094,7 +1161,7 @@ type GetUserRequest struct { UserId int64 `json:"user_id"` } -// Returns information about a user by their identifier. This is an offline request if the current user is not a bot +// Returns information about a user by their identifier. This is an offline method if the current user is not a bot func (client *Client) GetUser(req *GetUserRequest) (*User, error) { result, err := client.Send(Request{ meta: meta{ @@ -1146,7 +1213,7 @@ type GetBasicGroupRequest struct { BasicGroupId int64 `json:"basic_group_id"` } -// Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot +// Returns information about a basic group by its identifier. This is an offline method if the current user is not a bot func (client *Client) GetBasicGroup(req *GetBasicGroupRequest) (*BasicGroup, error) { result, err := client.Send(Request{ meta: meta{ @@ -1198,7 +1265,7 @@ type GetSupergroupRequest struct { SupergroupId int64 `json:"supergroup_id"` } -// Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot +// Returns information about a supergroup or a channel by its identifier. This is an offline method if the current user is not a bot func (client *Client) GetSupergroup(req *GetSupergroupRequest) (*Supergroup, error) { result, err := client.Send(Request{ meta: meta{ @@ -1250,7 +1317,7 @@ type GetSecretChatRequest struct { SecretChatId int32 `json:"secret_chat_id"` } -// Returns information about a secret chat by its identifier. This is an offline request +// Returns information about a secret chat by its identifier. This is an offline method func (client *Client) GetSecretChat(req *GetSecretChatRequest) (*SecretChat, error) { result, err := client.Send(Request{ meta: meta{ @@ -1276,7 +1343,7 @@ type GetChatRequest struct { ChatId int64 `json:"chat_id"` } -// Returns information about a chat by its identifier; this is an offline request if the current user is not a bot +// Returns information about a chat by its identifier. This is an offline method if the current user is not a bot func (client *Client) GetChat(req *GetChatRequest) (*Chat, error) { result, err := client.Send(Request{ meta: meta{ @@ -1333,7 +1400,7 @@ type GetMessageLocallyRequest struct { MessageId int64 `json:"message_id"` } -// 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 +// 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 method func (client *Client) GetMessageLocally(req *GetMessageLocallyRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1478,7 +1545,7 @@ type GetMessagePropertiesRequest struct { MessageId int64 `json:"message_id"` } -// Returns properties of a message; this is an offline request +// Returns properties of a message. This is an offline method func (client *Client) GetMessageProperties(req *GetMessagePropertiesRequest) (*MessageProperties, error) { result, err := client.Send(Request{ meta: meta{ @@ -1610,7 +1677,7 @@ type GetFileRequest struct { FileId int32 `json:"file_id"` } -// Returns information about a file; this is an offline request +// Returns information about a file. This is an offline method func (client *Client) GetFile(req *GetFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -1638,7 +1705,7 @@ type GetRemoteFileRequest struct { FileType FileType `json:"file_type"` } -// Returns information about a file by its remote identifier; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +// Returns information about a file by its remote identifier. This is an offline method. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application func (client *Client) GetRemoteFile(req *GetRemoteFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -1777,7 +1844,7 @@ type SearchChatsRequest struct { Limit int32 `json:"limit"` } -// Searches for the specified query in the title and username of already known chats; this is an offline request. Returns chats in the order seen in the main chat list +// Searches for the specified query in the title and username of already known chats. This is an offline method. Returns chats in the order seen in the main chat list func (client *Client) SearchChats(req *SearchChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2080,7 +2147,7 @@ type SearchRecentlyFoundChatsRequest struct { Limit int32 `json:"limit"` } -// Searches for the specified query in the title and username of up to 50 recently found chats; this is an offline request +// Searches for the specified query in the title and username of up to 50 recently found chats. This is an offline method func (client *Client) SearchRecentlyFoundChats(req *SearchRecentlyFoundChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2178,7 +2245,7 @@ type GetRecentlyOpenedChatsRequest struct { Limit int32 `json:"limit"` } -// Returns recently opened chats; this is an offline request. Returns chats in the order of last opening +// Returns recently opened chats. This is an offline method. Returns chats in the order of last opening func (client *Client) GetRecentlyOpenedChats(req *GetRecentlyOpenedChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2606,7 +2673,7 @@ type GetChatHistoryRequest struct { OnlyLocal bool `json:"only_local"` } -// Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline request if only_local is true +// Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true func (client *Client) GetChatHistory(req *GetChatHistoryRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -3506,7 +3573,7 @@ type ReportChatSponsoredMessageRequest struct { } // Reports a sponsored message to Telegram moderators -func (client *Client) ReportChatSponsoredMessage(req *ReportChatSponsoredMessageRequest) (ReportChatSponsoredMessageResult, error) { +func (client *Client) ReportChatSponsoredMessage(req *ReportChatSponsoredMessageRequest) (ReportSponsoredResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "reportChatSponsoredMessage", @@ -3526,20 +3593,145 @@ func (client *Client) ReportChatSponsoredMessage(req *ReportChatSponsoredMessage } switch result.Type { - case TypeReportChatSponsoredMessageResultOk: - return UnmarshalReportChatSponsoredMessageResultOk(result.Data) + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(result.Data) - case TypeReportChatSponsoredMessageResultFailed: - return UnmarshalReportChatSponsoredMessageResultFailed(result.Data) + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(result.Data) - case TypeReportChatSponsoredMessageResultOptionRequired: - return UnmarshalReportChatSponsoredMessageResultOptionRequired(result.Data) + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(result.Data) - case TypeReportChatSponsoredMessageResultAdsHidden: - return UnmarshalReportChatSponsoredMessageResultAdsHidden(result.Data) + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(result.Data) - case TypeReportChatSponsoredMessageResultPremiumRequired: - return UnmarshalReportChatSponsoredMessageResultPremiumRequired(result.Data) + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetSearchSponsoredChatsRequest struct { + // Query the user searches for + Query string `json:"query"` +} + +// Returns sponsored chats to be shown in the search results +func (client *Client) GetSearchSponsoredChats(req *GetSearchSponsoredChatsRequest) (*SponsoredChats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSearchSponsoredChats", + }, + Data: map[string]interface{}{ + "query": req.Query, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSponsoredChats(result.Data) +} + +type ViewSponsoredChatRequest struct { + // Unique identifier of the sponsored chat + SponsoredChatUniqueId int64 `json:"sponsored_chat_unique_id"` +} + +// Informs TDLib that the user fully viewed a sponsored chat +func (client *Client) ViewSponsoredChat(req *ViewSponsoredChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "viewSponsoredChat", + }, + Data: map[string]interface{}{ + "sponsored_chat_unique_id": req.SponsoredChatUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type OpenSponsoredChatRequest struct { + // Unique identifier of the sponsored chat + SponsoredChatUniqueId int64 `json:"sponsored_chat_unique_id"` +} + +// Informs TDLib that the user opened a sponsored chat +func (client *Client) OpenSponsoredChat(req *OpenSponsoredChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openSponsoredChat", + }, + Data: map[string]interface{}{ + "sponsored_chat_unique_id": req.SponsoredChatUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportSponsoredChatRequest struct { + // Unique identifier of the sponsored chat + SponsoredChatUniqueId int64 `json:"sponsored_chat_unique_id"` + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` +} + +// Reports a sponsored chat to Telegram moderators +func (client *Client) ReportSponsoredChat(req *ReportSponsoredChatRequest) (ReportSponsoredResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportSponsoredChat", + }, + Data: map[string]interface{}{ + "sponsored_chat_unique_id": req.SponsoredChatUniqueId, + "option_id": req.OptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(result.Data) + + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(result.Data) + + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(result.Data) + + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(result.Data) + + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(result.Data) default: return nil, errors.New("invalid type") @@ -3617,7 +3809,7 @@ type GetMessageLinkRequest struct { InMessageThread bool `json:"in_message_thread"` } -// Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request +// Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline method func (client *Client) GetMessageLink(req *GetMessageLinkRequest) (*MessageLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -5080,6 +5272,343 @@ func (client *Client) SetBusinessMessageIsPinned(req *SetBusinessMessageIsPinned return UnmarshalOk(result.Data) } +type ReadBusinessMessageRequest struct { + // Unique identifier of business connection through which the message was received + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Reads a message on behalf of a business account; for bots only +func (client *Client) ReadBusinessMessage(req *ReadBusinessMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readBusinessMessage", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteBusinessMessagesRequest struct { + // Unique identifier of business connection through which the messages were received + BusinessConnectionId string `json:"business_connection_id"` + // Identifier of the messages + MessageIds []int64 `json:"message_ids"` +} + +// Deletes messages on behalf of a business account; for bots only +func (client *Client) DeleteBusinessMessages(req *DeleteBusinessMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBusinessMessages", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type EditBusinessStoryRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_chat_id"` + // Identifier of the story to edit + StoryId int32 `json:"story_id"` + // New content of the story + Content InputStoryContent `json:"content"` + // New clickable rectangle areas to be shown on the story media + Areas *InputStoryAreas `json:"areas"` + // New story caption + Caption *FormattedText `json:"caption"` + // The new privacy settings for the story + PrivacySettings StoryPrivacySettings `json:"privacy_settings"` +} + +// Changes a story sent by the bot on behalf of a business account; for bots only +func (client *Client) EditBusinessStory(req *EditBusinessStoryRequest) (*Story, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessStory", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + "content": req.Content, + "areas": req.Areas, + "caption": req.Caption, + "privacy_settings": req.PrivacySettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStory(result.Data) +} + +type DeleteBusinessStoryRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // Identifier of the story to delete + StoryId int32 `json:"story_id"` +} + +// Deletes a story sent by the bot on behalf of a business account; for bots only +func (client *Client) DeleteBusinessStory(req *DeleteBusinessStoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBusinessStory", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "story_id": req.StoryId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountNameRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new value of the first name for the business account; 1-64 characters + FirstName string `json:"first_name"` + // The new value of the optional last name for the business account; 0-64 characters + LastName string `json:"last_name"` +} + +// Changes the first and last name of a business account; for bots only +func (client *Client) SetBusinessAccountName(req *SetBusinessAccountNameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountName", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "first_name": req.FirstName, + "last_name": req.LastName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountBioRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new value of the bio; 0-getOption("bio_length_max") characters without line feeds + Bio string `json:"bio"` +} + +// Changes the bio of a business account; for bots only +func (client *Client) SetBusinessAccountBio(req *SetBusinessAccountBioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountBio", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "bio": req.Bio, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountProfilePhotoRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // Profile photo to set; pass null to remove the photo + Photo InputChatPhoto `json:"photo"` + // Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings + IsPublic bool `json:"is_public"` +} + +// Changes a profile photo of a business account; for bots only +func (client *Client) SetBusinessAccountProfilePhoto(req *SetBusinessAccountProfilePhotoRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountProfilePhoto", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "photo": req.Photo, + "is_public": req.IsPublic, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountUsernameRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new value of the username + Username string `json:"username"` +} + +// Changes the editable username of a business account; for bots only +func (client *Client) SetBusinessAccountUsername(req *SetBusinessAccountUsernameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountUsername", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "username": req.Username, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountGiftSettingsRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new settings + Settings *GiftSettings `json:"settings"` +} + +// Changes settings for gift receiving of a business account; for bots only +func (client *Client) SetBusinessAccountGiftSettings(req *SetBusinessAccountGiftSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountGiftSettings", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBusinessAccountStarAmountRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` +} + +// Returns the amount of Telegram Stars owned by a business account; for bots only +func (client *Client) GetBusinessAccountStarAmount(req *GetBusinessAccountStarAmountRequest) (*StarAmount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessAccountStarAmount", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarAmount(result.Data) +} + +type TransferBusinessAccountStarsRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // Number of Telegram Stars to transfer + StarCount int64 `json:"star_count"` +} + +// Transfer Telegram Stars from the business account to the business bot; for bots only +func (client *Client) TransferBusinessAccountStars(req *TransferBusinessAccountStarsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "transferBusinessAccountStars", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CheckQuickReplyShortcutNameRequest struct { // The name of the shortcut; 1-32 characters Name string `json:"name"` @@ -5554,7 +6083,7 @@ type GetForumTopicLinkRequest struct { MessageThreadId int64 `json:"message_thread_id"` } -// Returns an HTTPS link to a topic in a forum chat. This is an offline request +// Returns an HTTPS link to a topic in a forum chat. This is an offline method func (client *Client) GetForumTopicLink(req *GetForumTopicLinkRequest) (*MessageLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -7279,7 +7808,7 @@ type GetWebAppPlaceholderRequest struct { BotUserId int64 `json:"bot_user_id"` } -// Returns a default placeholder for Web Apps of a bot; this is an offline request. Returns a 404 error if the placeholder isn't known +// Returns a default placeholder for Web Apps of a bot. This is an offline method. Returns a 404 error if the placeholder isn't known func (client *Client) GetWebAppPlaceholder(req *GetWebAppPlaceholderRequest) (*Outline, error) { result, err := client.Send(Request{ meta: meta{ @@ -8667,7 +9196,7 @@ type GetChatListsToAddChatRequest struct { ChatId int64 `json:"chat_id"` } -// Returns chat lists to which the chat can be added. This is an offline request +// Returns chat lists to which the chat can be added. This is an offline method func (client *Client) GetChatListsToAddChat(req *GetChatListsToAddChatRequest) (*ChatLists, error) { result, err := client.Send(Request{ meta: meta{ @@ -11605,7 +12134,7 @@ type GetChatBoostLevelFeaturesRequest struct { Level int32 `json:"level"` } -// Returns the list of features available on the specific chat boost level; this is an offline request +// Returns the list of features available on the specific chat boost level. This is an offline method func (client *Client) GetChatBoostLevelFeatures(req *GetChatBoostLevelFeaturesRequest) (*ChatBoostLevelFeatures, error) { result, err := client.Send(Request{ meta: meta{ @@ -11632,7 +12161,7 @@ type GetChatBoostFeaturesRequest struct { IsChannel bool `json:"is_channel"` } -// Returns the list of features available for different chat boost levels; this is an offline request +// Returns the list of features available for different chat boost levels. This is an offline method func (client *Client) GetChatBoostFeatures(req *GetChatBoostFeaturesRequest) (*ChatBoostFeatures, error) { result, err := client.Send(Request{ meta: meta{ @@ -14932,7 +15461,7 @@ type GetStickerOutlineRequest struct { ForClickedAnimatedEmojiMessage bool `json:"for_clicked_animated_emoji_message"` } -// Returns outline of a sticker; this is an offline request. Returns a 404 error if the outline isn't known +// Returns outline of a sticker. This is an offline method. Returns a 404 error if the outline isn't known func (client *Client) GetStickerOutline(req *GetStickerOutlineRequest) (*Outline, error) { result, err := client.Send(Request{ meta: meta{ @@ -16082,7 +16611,7 @@ type GetWebPageInstantViewRequest struct { OnlyLocal bool `json:"only_local"` } -// Returns an instant view version of a web page if available. This is an offline request if only_local is true. Returns a 404 error if the web page has no instant view page +// Returns an instant view version of a web page if available. This is an offline method if only_local is true. Returns a 404 error if the web page has no instant view page func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) (*WebPageInstantView, error) { result, err := client.Send(Request{ meta: meta{ @@ -16107,7 +16636,7 @@ func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) ( type SetProfilePhotoRequest struct { // Profile photo to set Photo InputChatPhoto `json:"photo"` - // Pass true to set a public photo, which will be visible even the main photo is hidden by privacy settings + // Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings IsPublic bool `json:"is_public"` } @@ -18890,6 +19419,32 @@ func (client *Client) DeleteSavedCredentials() (*Ok, error) { return UnmarshalOk(result.Data) } +type SetGiftSettingsRequest struct { + // The new settings + Settings *GiftSettings `json:"settings"` +} + +// Changes settings for gift receiving for the current user +func (client *Client) SetGiftSettings(req *SetGiftSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftSettings", + }, + Data: map[string]interface{}{ + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns gifts that can be sent to other users and channel chats func (client *Client) GetAvailableGifts() (*Gifts, error) { result, err := client.Send(Request{ @@ -18948,6 +19503,8 @@ func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { } type SellGiftRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift ReceivedGiftId string `json:"received_gift_id"` } @@ -18959,6 +19516,7 @@ func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { Type: "sellGift", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "received_gift_id": req.ReceivedGiftId, }, }) @@ -19087,6 +19645,8 @@ func (client *Client) GetGiftUpgradePreview(req *GetGiftUpgradePreviewRequest) ( } type UpgradeGiftRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift ReceivedGiftId string `json:"received_gift_id"` // Pass true to keep the original gift text, sender and receiver in the upgraded gift @@ -19102,6 +19662,7 @@ func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, Type: "upgradeGift", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "received_gift_id": req.ReceivedGiftId, "keep_original_details": req.KeepOriginalDetails, "star_count": req.StarCount, @@ -19119,6 +19680,8 @@ func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, } type TransferGiftRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift ReceivedGiftId string `json:"received_gift_id"` // Identifier of the user or the channel chat that will receive the gift @@ -19134,6 +19697,7 @@ func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { Type: "transferGift", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "received_gift_id": req.ReceivedGiftId, "new_owner_id": req.NewOwnerId, "star_count": req.StarCount, @@ -19151,6 +19715,8 @@ func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { } type GetReceivedGiftsRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift receiver OwnerId MessageSender `json:"owner_id"` // Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right @@ -19178,6 +19744,7 @@ func (client *Client) GetReceivedGifts(req *GetReceivedGiftsRequest) (*ReceivedG Type: "getReceivedGifts", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "owner_id": req.OwnerId, "exclude_unsaved": req.ExcludeUnsaved, "exclude_saved": req.ExcludeSaved, @@ -19547,7 +20114,7 @@ type GetLocalizationTargetInfoRequest struct { OnlyLocal bool `json:"only_local"` } -// Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization +// Returns information about the current localization target. This is an offline method if only_local is true. Can be called before authorization func (client *Client) GetLocalizationTargetInfo(req *GetLocalizationTargetInfoRequest) (*LocalizationTargetInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -22455,6 +23022,41 @@ func (client *Client) ApplyPremiumGiftCode(req *ApplyPremiumGiftCodeRequest) (*O return UnmarshalOk(result.Data) } +type GiftPremiumWithStarsRequest struct { + // Identifier of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // The number of Telegram Stars to pay for subscription + StarCount int64 `json:"star_count"` + // Number of months the Telegram Premium subscription will be active for the user + MonthCount int32 `json:"month_count"` + // Text to show to the user receiving Telegram Premium; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` +} + +// Allows to buy a Telegram Premium subscription for another user with payment in Telegram Stars; for bots only +func (client *Client) GiftPremiumWithStars(req *GiftPremiumWithStarsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "giftPremiumWithStars", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "star_count": req.StarCount, + "month_count": req.MonthCount, + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type LaunchPrepaidGiveawayRequest struct { // Unique identifier of the prepaid giveaway GiveawayId JsonInt64 `json:"giveaway_id"` @@ -22664,7 +23266,7 @@ type CanPurchaseFromStoreRequest struct { Purpose StorePaymentPurpose `json:"purpose"` } -// Checks whether an in-store purchase is possible. Must be called before any in-store purchase +// Checks whether an in-store purchase is possible. Must be called before any in-store purchase. For official applications only func (client *Client) CanPurchaseFromStore(req *CanPurchaseFromStoreRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -22685,56 +23287,21 @@ func (client *Client) CanPurchaseFromStore(req *CanPurchaseFromStoreRequest) (*O return UnmarshalOk(result.Data) } -type AssignAppStoreTransactionRequest struct { - // App Store receipt - Receipt []byte `json:"receipt"` +type AssignStoreTransactionRequest struct { + // Information about the transaction + Transaction StoreTransaction `json:"transaction"` // Transaction purpose Purpose StorePaymentPurpose `json:"purpose"` } -// Informs server about a purchase through App Store. For official applications only -func (client *Client) AssignAppStoreTransaction(req *AssignAppStoreTransactionRequest) (*Ok, error) { +// Informs server about an in-store purchase. For official applications only +func (client *Client) AssignStoreTransaction(req *AssignStoreTransactionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "assignAppStoreTransaction", + Type: "assignStoreTransaction", }, Data: map[string]interface{}{ - "receipt": req.Receipt, - "purpose": req.Purpose, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - -type AssignGooglePlayTransactionRequest struct { - // Application package name - PackageName string `json:"package_name"` - // Identifier of the purchased store product - StoreProductId string `json:"store_product_id"` - // Google Play purchase token - PurchaseToken string `json:"purchase_token"` - // Transaction purpose - Purpose StorePaymentPurpose `json:"purpose"` -} - -// Informs server about a purchase through Google Play. For official applications only -func (client *Client) AssignGooglePlayTransaction(req *AssignGooglePlayTransactionRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "assignGooglePlayTransaction", - }, - Data: map[string]interface{}{ - "package_name": req.PackageName, - "store_product_id": req.StoreProductId, - "purchase_token": req.PurchaseToken, + "transaction": req.Transaction, "purpose": req.Purpose, }, }) @@ -24464,6 +25031,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(result.Data) + case TypeUpdateForumTopic: + return UnmarshalUpdateForumTopic(result.Data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(result.Data) @@ -24626,6 +25196,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(result.Data) + case TypeUpdateFreezeState: + return UnmarshalUpdateFreezeState(result.Data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(result.Data) diff --git a/client/type.go b/client/type.go index c4f4597..22df51f 100755 --- a/client/type.go +++ b/client/type.go @@ -48,7 +48,7 @@ const ( ClassMessageReplyTo = "MessageReplyTo" ClassInputMessageReplyTo = "InputMessageReplyTo" ClassMessageSource = "MessageSource" - ClassReportChatSponsoredMessageResult = "ReportChatSponsoredMessageResult" + ClassReportSponsoredResult = "ReportSponsoredResult" ClassNotificationSettingsScope = "NotificationSettingsScope" ClassReactionNotificationSource = "ReactionNotificationSource" ClassChatType = "ChatType" @@ -126,6 +126,7 @@ const ( ClassPremiumStoryFeature = "PremiumStoryFeature" ClassPremiumSource = "PremiumSource" ClassStorePaymentPurpose = "StorePaymentPurpose" + ClassStoreTransaction = "StoreTransaction" ClassTelegramPaymentPurpose = "TelegramPaymentPurpose" ClassDeviceToken = "DeviceToken" ClassBackgroundFill = "BackgroundFill" @@ -227,6 +228,7 @@ const ( ClassBusinessRecipients = "BusinessRecipients" ClassBusinessAwayMessageSettings = "BusinessAwayMessageSettings" ClassBusinessGreetingMessageSettings = "BusinessGreetingMessageSettings" + ClassBusinessBotRights = "BusinessBotRights" ClassBusinessConnectedBot = "BusinessConnectedBot" ClassBusinessStartPage = "BusinessStartPage" ClassInputBusinessStartPage = "InputBusinessStartPage" @@ -267,6 +269,8 @@ const ( ClassStarGiveawayWinnerOption = "StarGiveawayWinnerOption" ClassStarGiveawayPaymentOption = "StarGiveawayPaymentOption" ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" + ClassAcceptedGiftTypes = "AcceptedGiftTypes" + ClassGiftSettings = "GiftSettings" ClassUpgradedGiftModel = "UpgradedGiftModel" ClassUpgradedGiftSymbol = "UpgradedGiftSymbol" ClassUpgradedGiftBackdropColors = "UpgradedGiftBackdropColors" @@ -344,6 +348,8 @@ const ( ClassMessageSponsor = "MessageSponsor" ClassSponsoredMessage = "SponsoredMessage" ClassSponsoredMessages = "SponsoredMessages" + ClassSponsoredChat = "SponsoredChat" + ClassSponsoredChats = "SponsoredChats" ClassReportOption = "ReportOption" ClassFileDownload = "FileDownload" ClassDownloadedFileCounts = "DownloadedFileCounts" @@ -630,6 +636,7 @@ const ( TypeTermsOfService = "termsOfService" TypeAuthorizationStateWaitTdlibParameters = "authorizationStateWaitTdlibParameters" TypeAuthorizationStateWaitPhoneNumber = "authorizationStateWaitPhoneNumber" + TypeAuthorizationStateWaitPremiumPurchase = "authorizationStateWaitPremiumPurchase" TypeAuthorizationStateWaitEmailAddress = "authorizationStateWaitEmailAddress" TypeAuthorizationStateWaitEmailCode = "authorizationStateWaitEmailCode" TypeAuthorizationStateWaitCode = "authorizationStateWaitCode" @@ -722,6 +729,7 @@ const ( TypeBusinessRecipients = "businessRecipients" TypeBusinessAwayMessageSettings = "businessAwayMessageSettings" TypeBusinessGreetingMessageSettings = "businessGreetingMessageSettings" + TypeBusinessBotRights = "businessBotRights" TypeBusinessConnectedBot = "businessConnectedBot" TypeBusinessStartPage = "businessStartPage" TypeInputBusinessStartPage = "inputBusinessStartPage" @@ -776,6 +784,8 @@ const ( TypeStarGiveawayWinnerOption = "starGiveawayWinnerOption" TypeStarGiveawayPaymentOption = "starGiveawayPaymentOption" TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" + TypeAcceptedGiftTypes = "acceptedGiftTypes" + TypeGiftSettings = "giftSettings" TypeUpgradedGiftModel = "upgradedGiftModel" TypeUpgradedGiftSymbol = "upgradedGiftSymbol" TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" @@ -821,6 +831,8 @@ const ( TypeStarTransactionTypePaidMessageSend = "starTransactionTypePaidMessageSend" TypeStarTransactionTypePaidMessageReceive = "starTransactionTypePaidMessageReceive" TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" + TypeStarTransactionTypeBusinessBotTransferSend = "starTransactionTypeBusinessBotTransferSend" + TypeStarTransactionTypeBusinessBotTransferReceive = "starTransactionTypeBusinessBotTransferReceive" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" @@ -961,12 +973,14 @@ const ( TypeMessageSponsor = "messageSponsor" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" + TypeSponsoredChat = "sponsoredChat" + TypeSponsoredChats = "sponsoredChats" TypeReportOption = "reportOption" - TypeReportChatSponsoredMessageResultOk = "reportChatSponsoredMessageResultOk" - TypeReportChatSponsoredMessageResultFailed = "reportChatSponsoredMessageResultFailed" - TypeReportChatSponsoredMessageResultOptionRequired = "reportChatSponsoredMessageResultOptionRequired" - TypeReportChatSponsoredMessageResultAdsHidden = "reportChatSponsoredMessageResultAdsHidden" - TypeReportChatSponsoredMessageResultPremiumRequired = "reportChatSponsoredMessageResultPremiumRequired" + TypeReportSponsoredResultOk = "reportSponsoredResultOk" + TypeReportSponsoredResultFailed = "reportSponsoredResultFailed" + TypeReportSponsoredResultOptionRequired = "reportSponsoredResultOptionRequired" + TypeReportSponsoredResultAdsHidden = "reportSponsoredResultAdsHidden" + TypeReportSponsoredResultPremiumRequired = "reportSponsoredResultPremiumRequired" TypeFileDownload = "fileDownload" TypeDownloadedFileCounts = "downloadedFileCounts" TypeFoundFileDownloads = "foundFileDownloads" @@ -1338,6 +1352,8 @@ const ( TypeMessageGift = "messageGift" TypeMessageUpgradedGift = "messageUpgradedGift" TypeMessageRefundedUpgradedGift = "messageRefundedUpgradedGift" + TypeMessagePaidMessagesRefunded = "messagePaidMessagesRefunded" + TypeMessagePaidMessagePriceChanged = "messagePaidMessagePriceChanged" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1771,6 +1787,8 @@ const ( TypeStorePaymentPurposeStarGiveaway = "storePaymentPurposeStarGiveaway" TypeStorePaymentPurposeStars = "storePaymentPurposeStars" TypeStorePaymentPurposeGiftedStars = "storePaymentPurposeGiftedStars" + TypeStoreTransactionAppStore = "storeTransactionAppStore" + TypeStoreTransactionGooglePlay = "storeTransactionGooglePlay" TypeTelegramPaymentPurposePremiumGift = "telegramPaymentPurposePremiumGift" TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" @@ -2215,6 +2233,7 @@ const ( TypeUpdateQuickReplyShortcuts = "updateQuickReplyShortcuts" TypeUpdateQuickReplyShortcutMessages = "updateQuickReplyShortcutMessages" TypeUpdateForumTopicInfo = "updateForumTopicInfo" + TypeUpdateForumTopic = "updateForumTopic" TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" TypeUpdateReactionNotificationSettings = "updateReactionNotificationSettings" TypeUpdateNotification = "updateNotification" @@ -2269,6 +2288,7 @@ const ( TypeUpdateProfileAccentColors = "updateProfileAccentColors" TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" + TypeUpdateFreezeState = "updateFreezeState" TypeUpdateTermsOfService = "updateTermsOfService" TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" @@ -2532,9 +2552,9 @@ type MessageSource interface { MessageSourceType() string } -// Describes result of sponsored message report -type ReportChatSponsoredMessageResult interface { - ReportChatSponsoredMessageResultType() string +// Describes result of sponsored message or chat report +type ReportSponsoredResult interface { + ReportSponsoredResultType() string } // Describes the types of chats to which notification settings are relevant @@ -2922,6 +2942,11 @@ type StorePaymentPurpose interface { StorePaymentPurposeType() string } +// Describes an in-store transaction +type StoreTransaction interface { + StoreTransactionType() string +} + // Describes a purpose of a payment toward Telegram type TelegramPaymentPurpose interface { TelegramPaymentPurposeType() string @@ -3884,6 +3909,33 @@ func (*AuthorizationStateWaitPhoneNumber) AuthorizationStateType() string { return TypeAuthorizationStateWaitPhoneNumber } +// The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction +type AuthorizationStateWaitPremiumPurchase struct { + meta + // Identifier of the store product that must be bought + StoreProductId string `json:"store_product_id"` +} + +func (entity *AuthorizationStateWaitPremiumPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateWaitPremiumPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateWaitPremiumPurchase) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateWaitPremiumPurchase) GetType() string { + return TypeAuthorizationStateWaitPremiumPurchase +} + +func (*AuthorizationStateWaitPremiumPurchase) AuthorizationStateType() string { + return TypeAuthorizationStateWaitPremiumPurchase +} + // TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed type AuthorizationStateWaitEmailAddress struct { meta @@ -6771,6 +6823,55 @@ func (*BusinessGreetingMessageSettings) GetType() string { return TypeBusinessGreetingMessageSettings } +// Describes rights of a business bot +type BusinessBotRights struct { + meta + // True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours + CanReply bool `json:"can_reply"` + // True, if the bot can mark incoming private messages as read + CanReadMessages bool `json:"can_read_messages"` + // True, if the bot can delete sent messages + CanDeleteSentMessages bool `json:"can_delete_sent_messages"` + // True, if the bot can delete any message + CanDeleteAllMessages bool `json:"can_delete_all_messages"` + // True, if the bot can edit name of the business account + CanEditName bool `json:"can_edit_name"` + // True, if the bot can edit bio of the business account + CanEditBio bool `json:"can_edit_bio"` + // True, if the bot can edit profile photo of the business account + CanEditProfilePhoto bool `json:"can_edit_profile_photo"` + // True, if the bot can edit username of the business account + CanEditUsername bool `json:"can_edit_username"` + // True, if the bot can view gifts and amount of Telegram Stars owned by the business account + CanViewGiftsAndStars bool `json:"can_view_gifts_and_stars"` + // True, if the bot can sell regular gifts received by the business account + CanSellGifts bool `json:"can_sell_gifts"` + // True, if the bot can change gift receiving settings of the business account + CanChangeGiftSettings bool `json:"can_change_gift_settings"` + // True, if the bot can transfer and upgrade gifts received by the business account + CanTransferAndUpgradeGifts bool `json:"can_transfer_and_upgrade_gifts"` + // True, if the bot can transfer Telegram Stars received by the business account to account of the bot, or use them to upgrade and transfer gifts + CanTransferStars bool `json:"can_transfer_stars"` + // True, if the bot can send, edit and delete stories + CanManageStories bool `json:"can_manage_stories"` +} + +func (entity *BusinessBotRights) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessBotRights + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessBotRights) GetClass() string { + return ClassBusinessBotRights +} + +func (*BusinessBotRights) GetType() string { + return TypeBusinessBotRights +} + // Describes a bot connected to a business account type BusinessConnectedBot struct { meta @@ -6778,8 +6879,8 @@ type BusinessConnectedBot struct { BotUserId int64 `json:"bot_user_id"` // Private chats that will be accessible to the bot Recipients *BusinessRecipients `json:"recipients"` - // True, if the bot can send messages to the private chats; false otherwise - CanReply bool `json:"can_reply"` + // Rights of the bot + Rights *BusinessBotRights `json:"rights"` } func (entity *BusinessConnectedBot) MarshalJSON() ([]byte, error) { @@ -8488,6 +8589,60 @@ func (*StarGiveawayPaymentOptions) GetType() string { return TypeStarGiveawayPaymentOptions } +// Describes gift types that are accepted by a user +type AcceptedGiftTypes struct { + meta + // True, if unlimited regular gifts are accepted + UnlimitedGifts bool `json:"unlimited_gifts"` + // True, if limited regular gifts are accepted + LimitedGifts bool `json:"limited_gifts"` + // True, if upgraded gifts and regular gifts that can be upgraded for free are accepted + UpgradedGifts bool `json:"upgraded_gifts"` + // True, if Telegram Premium subscription is accepted + PremiumSubscription bool `json:"premium_subscription"` +} + +func (entity *AcceptedGiftTypes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AcceptedGiftTypes + + return json.Marshal((*stub)(entity)) +} + +func (*AcceptedGiftTypes) GetClass() string { + return ClassAcceptedGiftTypes +} + +func (*AcceptedGiftTypes) GetType() string { + return TypeAcceptedGiftTypes +} + +// Contains settings for gift receiving for a user +type GiftSettings struct { + meta + // True, if a button for sending a gift to the user or by the user must always be shown in the input field + ShowGiftButton bool `json:"show_gift_button"` + // Types of gifts accepted by the user; for Telegram Premium users only + AcceptedGiftTypes *AcceptedGiftTypes `json:"accepted_gift_types"` +} + +func (entity *GiftSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftSettings + + return json.Marshal((*stub)(entity)) +} + +func (*GiftSettings) GetClass() string { + return ClassGiftSettings +} + +func (*GiftSettings) GetType() string { + return TypeGiftSettings +} + // Describes a model of an upgraded gift type UpgradedGiftModel struct { meta @@ -8495,7 +8650,7 @@ type UpgradedGiftModel struct { Name string `json:"name"` // The sticker representing the upgraded gift Sticker *Sticker `json:"sticker"` - // The number of upgraded gift that receive this model for each 1000 gifts upgraded + // The number of upgraded gifts that receive this model for each 1000 gifts upgraded RarityPerMille int32 `json:"rarity_per_mille"` } @@ -8520,9 +8675,9 @@ type UpgradedGiftSymbol struct { meta // Name of the symbol Name string `json:"name"` - // The sticker representing the upgraded gift + // The sticker representing the symbol Sticker *Sticker `json:"sticker"` - // The number of upgraded gift that receive this symbol for each 1000 gifts upgraded + // The number of upgraded gifts that receive this symbol for each 1000 gifts upgraded RarityPerMille int32 `json:"rarity_per_mille"` } @@ -8578,7 +8733,7 @@ type UpgradedGiftBackdrop struct { Name string `json:"name"` // Colors of the backdrop Colors *UpgradedGiftBackdropColors `json:"colors"` - // The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded + // The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded RarityPerMille int32 `json:"rarity_per_mille"` } @@ -8733,11 +8888,11 @@ type UpgradedGift struct { MaxUpgradedCount int32 `json:"max_upgraded_count"` // Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown OwnerId MessageSender `json:"owner_id"` - // Address of the gift NFT owner in TON blockchain; may be empty if none + // Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address OwnerAddress string `json:"owner_address"` // Name of the owner for the case when owner identifier and address aren't known OwnerName string `json:"owner_name"` - // Address of the gift NFT in TON blockchain; may be empty if none + // Address of the gift NFT in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address GiftAddress string `json:"gift_address"` // Model of the upgraded gift Model *UpgradedGiftModel `json:"model"` @@ -10072,7 +10227,7 @@ func (starTransactionTypePaidMessageReceive *StarTransactionTypePaidMessageRecei return nil } -// The transaction is a purchase of Telegram Premium subscription; for regular users only +// The transaction is a purchase of Telegram Premium subscription; for regular users and bots only type StarTransactionTypePremiumPurchase struct { meta // Identifier of the user that received the Telegram Premium subscription @@ -10103,6 +10258,60 @@ func (*StarTransactionTypePremiumPurchase) StarTransactionTypeType() string { return TypeStarTransactionTypePremiumPurchase } +// The transaction is a transfer of Telegram Stars to a business bot; for regular users only +type StarTransactionTypeBusinessBotTransferSend struct { + meta + // Identifier of the bot that received Telegram Stars + UserId int64 `json:"user_id"` +} + +func (entity *StarTransactionTypeBusinessBotTransferSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBusinessBotTransferSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBusinessBotTransferSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBusinessBotTransferSend) GetType() string { + return TypeStarTransactionTypeBusinessBotTransferSend +} + +func (*StarTransactionTypeBusinessBotTransferSend) StarTransactionTypeType() string { + return TypeStarTransactionTypeBusinessBotTransferSend +} + +// The transaction is a transfer of Telegram Stars from a business account; for bots only +type StarTransactionTypeBusinessBotTransferReceive struct { + meta + // Identifier of the user that sent Telegram Stars + UserId int64 `json:"user_id"` +} + +func (entity *StarTransactionTypeBusinessBotTransferReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBusinessBotTransferReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBusinessBotTransferReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBusinessBotTransferReceive) GetType() string { + return TypeStarTransactionTypeBusinessBotTransferReceive +} + +func (*StarTransactionTypeBusinessBotTransferReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypeBusinessBotTransferReceive +} + // The transaction is a transaction of an unsupported type type StarTransactionTypeUnsupported struct{ meta @@ -11082,6 +11291,8 @@ type UserFullInfo struct { IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` // Number of Telegram Stars that must be paid by the current user for each sent message to the user OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + // Settings for gift receiving for the user + GiftSettings *GiftSettings `json:"gift_settings"` // Information about verification status of the user provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` // Information about business settings for Telegram Business accounts; may be null if none @@ -11128,6 +11339,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { GroupInCommonCount int32 `json:"group_in_common_count"` IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + GiftSettings *GiftSettings `json:"gift_settings"` BotVerification *BotVerification `json:"bot_verification"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` @@ -11157,6 +11369,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount userFullInfo.IncomingPaidMessageStarCount = tmp.IncomingPaidMessageStarCount userFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount + userFullInfo.GiftSettings = tmp.GiftSettings userFullInfo.BotVerification = tmp.BotVerification userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo @@ -15072,6 +15285,58 @@ func (*SponsoredMessages) GetType() string { return TypeSponsoredMessages } +// Describes a sponsored chat +type SponsoredChat struct { + meta + // Unique identifier of this result + UniqueId int64 `json:"unique_id"` + // Chat identifier + ChatId int64 `json:"chat_id"` + // Additional optional information about the sponsor to be shown along with the chat + SponsorInfo string `json:"sponsor_info"` + // If non-empty, additional information about the sponsored chat to be shown along with the chat + AdditionalInfo string `json:"additional_info"` +} + +func (entity *SponsoredChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SponsoredChat + + return json.Marshal((*stub)(entity)) +} + +func (*SponsoredChat) GetClass() string { + return ClassSponsoredChat +} + +func (*SponsoredChat) GetType() string { + return TypeSponsoredChat +} + +// Contains a list of sponsored chats +type SponsoredChats struct { + meta + // List of sponsored chats + Chats []*SponsoredChat `json:"chats"` +} + +func (entity *SponsoredChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SponsoredChats + + return json.Marshal((*stub)(entity)) +} + +func (*SponsoredChats) GetClass() string { + return ClassSponsoredChats +} + +func (*SponsoredChats) GetType() string { + return TypeSponsoredChats +} + // Describes an option to report an entity to Telegram type ReportOption struct { meta @@ -15098,57 +15363,57 @@ func (*ReportOption) GetType() string { } // The message was reported successfully -type ReportChatSponsoredMessageResultOk struct{ +type ReportSponsoredResultOk struct{ meta } -func (entity *ReportChatSponsoredMessageResultOk) MarshalJSON() ([]byte, error) { +func (entity *ReportSponsoredResultOk) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageResultOk + type stub ReportSponsoredResultOk return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageResultOk) GetClass() string { - return ClassReportChatSponsoredMessageResult +func (*ReportSponsoredResultOk) GetClass() string { + return ClassReportSponsoredResult } -func (*ReportChatSponsoredMessageResultOk) GetType() string { - return TypeReportChatSponsoredMessageResultOk +func (*ReportSponsoredResultOk) GetType() string { + return TypeReportSponsoredResultOk } -func (*ReportChatSponsoredMessageResultOk) ReportChatSponsoredMessageResultType() string { - return TypeReportChatSponsoredMessageResultOk +func (*ReportSponsoredResultOk) ReportSponsoredResultType() string { + return TypeReportSponsoredResultOk } // The sponsored message is too old or not found -type ReportChatSponsoredMessageResultFailed struct{ +type ReportSponsoredResultFailed struct{ meta } -func (entity *ReportChatSponsoredMessageResultFailed) MarshalJSON() ([]byte, error) { +func (entity *ReportSponsoredResultFailed) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageResultFailed + type stub ReportSponsoredResultFailed return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageResultFailed) GetClass() string { - return ClassReportChatSponsoredMessageResult +func (*ReportSponsoredResultFailed) GetClass() string { + return ClassReportSponsoredResult } -func (*ReportChatSponsoredMessageResultFailed) GetType() string { - return TypeReportChatSponsoredMessageResultFailed +func (*ReportSponsoredResultFailed) GetType() string { + return TypeReportSponsoredResultFailed } -func (*ReportChatSponsoredMessageResultFailed) ReportChatSponsoredMessageResultType() string { - return TypeReportChatSponsoredMessageResultFailed +func (*ReportSponsoredResultFailed) ReportSponsoredResultType() string { + return TypeReportSponsoredResultFailed } // The user must choose an option to report the message and repeat request with the chosen option -type ReportChatSponsoredMessageResultOptionRequired struct { +type ReportSponsoredResultOptionRequired struct { meta // Title for the option choice Title string `json:"title"` @@ -15156,74 +15421,74 @@ type ReportChatSponsoredMessageResultOptionRequired struct { Options []*ReportOption `json:"options"` } -func (entity *ReportChatSponsoredMessageResultOptionRequired) MarshalJSON() ([]byte, error) { +func (entity *ReportSponsoredResultOptionRequired) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageResultOptionRequired + type stub ReportSponsoredResultOptionRequired return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageResultOptionRequired) GetClass() string { - return ClassReportChatSponsoredMessageResult +func (*ReportSponsoredResultOptionRequired) GetClass() string { + return ClassReportSponsoredResult } -func (*ReportChatSponsoredMessageResultOptionRequired) GetType() string { - return TypeReportChatSponsoredMessageResultOptionRequired +func (*ReportSponsoredResultOptionRequired) GetType() string { + return TypeReportSponsoredResultOptionRequired } -func (*ReportChatSponsoredMessageResultOptionRequired) ReportChatSponsoredMessageResultType() string { - return TypeReportChatSponsoredMessageResultOptionRequired +func (*ReportSponsoredResultOptionRequired) ReportSponsoredResultType() string { + return TypeReportSponsoredResultOptionRequired } // Sponsored messages were hidden for the user in all chats -type ReportChatSponsoredMessageResultAdsHidden struct{ +type ReportSponsoredResultAdsHidden struct{ meta } -func (entity *ReportChatSponsoredMessageResultAdsHidden) MarshalJSON() ([]byte, error) { +func (entity *ReportSponsoredResultAdsHidden) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageResultAdsHidden + type stub ReportSponsoredResultAdsHidden return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageResultAdsHidden) GetClass() string { - return ClassReportChatSponsoredMessageResult +func (*ReportSponsoredResultAdsHidden) GetClass() string { + return ClassReportSponsoredResult } -func (*ReportChatSponsoredMessageResultAdsHidden) GetType() string { - return TypeReportChatSponsoredMessageResultAdsHidden +func (*ReportSponsoredResultAdsHidden) GetType() string { + return TypeReportSponsoredResultAdsHidden } -func (*ReportChatSponsoredMessageResultAdsHidden) ReportChatSponsoredMessageResultType() string { - return TypeReportChatSponsoredMessageResultAdsHidden +func (*ReportSponsoredResultAdsHidden) ReportSponsoredResultType() string { + return TypeReportSponsoredResultAdsHidden } // The user asked to hide sponsored messages, but Telegram Premium is required for this -type ReportChatSponsoredMessageResultPremiumRequired struct{ +type ReportSponsoredResultPremiumRequired struct{ meta } -func (entity *ReportChatSponsoredMessageResultPremiumRequired) MarshalJSON() ([]byte, error) { +func (entity *ReportSponsoredResultPremiumRequired) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageResultPremiumRequired + type stub ReportSponsoredResultPremiumRequired return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageResultPremiumRequired) GetClass() string { - return ClassReportChatSponsoredMessageResult +func (*ReportSponsoredResultPremiumRequired) GetClass() string { + return ClassReportSponsoredResult } -func (*ReportChatSponsoredMessageResultPremiumRequired) GetType() string { - return TypeReportChatSponsoredMessageResultPremiumRequired +func (*ReportSponsoredResultPremiumRequired) GetType() string { + return TypeReportSponsoredResultPremiumRequired } -func (*ReportChatSponsoredMessageResultPremiumRequired) ReportChatSponsoredMessageResultType() string { - return TypeReportChatSponsoredMessageResultPremiumRequired +func (*ReportSponsoredResultPremiumRequired) ReportSponsoredResultType() string { + return TypeReportSponsoredResultPremiumRequired } // Describes a file added to file download list @@ -18311,6 +18576,8 @@ func (*ForumTopicIcon) GetType() string { // Contains basic information about a forum topic type ForumTopicInfo struct { meta + // Identifier of the forum chat to which the topic belongs + ChatId int64 `json:"chat_id"` // Message thread identifier of the topic MessageThreadId int64 `json:"message_thread_id"` // Name of the topic @@ -18349,6 +18616,7 @@ func (*ForumTopicInfo) GetType() string { func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { var tmp struct { + ChatId int64 `json:"chat_id"` MessageThreadId int64 `json:"message_thread_id"` Name string `json:"name"` Icon *ForumTopicIcon `json:"icon"` @@ -18365,6 +18633,7 @@ func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { return err } + forumTopicInfo.ChatId = tmp.ChatId forumTopicInfo.MessageThreadId = tmp.MessageThreadId forumTopicInfo.Name = tmp.Name forumTopicInfo.Icon = tmp.Icon @@ -18387,6 +18656,8 @@ type ForumTopic struct { Info *ForumTopicInfo `json:"info"` // Last message in the topic; may be null if unknown LastMessage *Message `json:"last_message"` + // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order + Order JsonInt64 `json:"order"` // True, if the topic is pinned in the topic list IsPinned bool `json:"is_pinned"` // Number of unread messages in the topic @@ -27826,6 +28097,62 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da return nil } +// Paid messages were refunded +type MessagePaidMessagesRefunded struct { + meta + // The number of refunded messages + MessageCount int32 `json:"message_count"` + // The number of refunded Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *MessagePaidMessagesRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaidMessagesRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaidMessagesRefunded) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaidMessagesRefunded) GetType() string { + return TypeMessagePaidMessagesRefunded +} + +func (*MessagePaidMessagesRefunded) MessageContentType() string { + return TypeMessagePaidMessagesRefunded +} + +// A price for paid messages was changed in the supergroup chat +type MessagePaidMessagePriceChanged struct { + meta + // The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +func (entity *MessagePaidMessagePriceChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaidMessagePriceChanged + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaidMessagePriceChanged) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaidMessagePriceChanged) GetType() string { + return TypeMessagePaidMessagePriceChanged +} + +func (*MessagePaidMessagePriceChanged) MessageContentType() string { + return TypeMessagePaidMessagePriceChanged +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -35953,8 +36280,8 @@ type BusinessConnection struct { UserChatId int64 `json:"user_chat_id"` // Point in time (Unix timestamp) when the connection was established Date int32 `json:"date"` - // True, if the bot can send messages to the connected user; false otherwise - CanReply bool `json:"can_reply"` + // Rights of the bot; may be null if the connection was disabled + Rights *BusinessBotRights `json:"rights"` // True, if the connection is enabled; false otherwise IsEnabled bool `json:"is_enabled"` } @@ -42212,10 +42539,68 @@ func (*StorePaymentPurposeGiftedStars) StorePaymentPurposeType() string { return TypeStorePaymentPurposeGiftedStars } +// A purchase through App Store +type StoreTransactionAppStore struct { + meta + // App Store receipt + Receipt []byte `json:"receipt"` +} + +func (entity *StoreTransactionAppStore) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoreTransactionAppStore + + return json.Marshal((*stub)(entity)) +} + +func (*StoreTransactionAppStore) GetClass() string { + return ClassStoreTransaction +} + +func (*StoreTransactionAppStore) GetType() string { + return TypeStoreTransactionAppStore +} + +func (*StoreTransactionAppStore) StoreTransactionType() string { + return TypeStoreTransactionAppStore +} + +// A purchase through Google Play +type StoreTransactionGooglePlay struct { + meta + // Application package name + PackageName string `json:"package_name"` + // Identifier of the purchased store product + StoreProductId string `json:"store_product_id"` + // Google Play purchase token + PurchaseToken string `json:"purchase_token"` +} + +func (entity *StoreTransactionGooglePlay) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoreTransactionGooglePlay + + return json.Marshal((*stub)(entity)) +} + +func (*StoreTransactionGooglePlay) GetClass() string { + return ClassStoreTransaction +} + +func (*StoreTransactionGooglePlay) GetType() string { + return TypeStoreTransactionGooglePlay +} + +func (*StoreTransactionGooglePlay) StoreTransactionType() string { + return TypeStoreTransactionGooglePlay +} + // The user gifting Telegram Premium to another user type TelegramPaymentPurposePremiumGift struct { meta - // ISO 4217 currency code of the payment currency + // ISO 4217 currency code of the payment currency, or "XTR" for payments in Telegram Stars Currency string `json:"currency"` // Paid amount, in the smallest units of the currency Amount int64 `json:"amount"` @@ -46578,7 +46963,7 @@ type NewChatPrivacySettings struct { meta // True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting AllowNewChatsFromUnknownUsers bool `json:"allow_new_chats_from_unknown_users"` - // Number of Telegram Stars that must be paid for every incoming private message by non-contacts; 0-getOption("paid_message_star_count_max"). If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending + // Number of Telegram Stars that must be paid for every incoming private message by non-contacts; 0-getOption("paid_message_star_count_max"). If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. Can be positive, only if getOption("can_enable_paid_messages") is true IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` } @@ -55269,8 +55654,6 @@ func (*UpdateQuickReplyShortcutMessages) UpdateType() string { // Basic information about a topic in a forum chat was changed type UpdateForumTopicInfo struct { meta - // Chat identifier - ChatId int64 `json:"chat_id"` // New information about the topic Info *ForumTopicInfo `json:"info"` } @@ -55295,6 +55678,41 @@ func (*UpdateForumTopicInfo) UpdateType() string { return TypeUpdateForumTopicInfo } +// Information about a topic in a forum chat was changed +type UpdateForumTopic struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message thread identifier of the topic + MessageThreadId int64 `json:"message_thread_id"` + // True, if the topic is pinned in the topic list + IsPinned bool `json:"is_pinned"` + // Identifier of the last read outgoing message + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Notification settings for the topic + NotificationSettings *ChatNotificationSettings `json:"notification_settings"` +} + +func (entity *UpdateForumTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateForumTopic + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateForumTopic) GetClass() string { + return ClassUpdate +} + +func (*UpdateForumTopic) GetType() string { + return TypeUpdateForumTopic +} + +func (*UpdateForumTopic) UpdateType() string { + return TypeUpdateForumTopic +} + // Notification settings for some type of chats were updated type UpdateScopeNotificationSettings struct { meta @@ -57166,6 +57584,39 @@ func (updateConnectionState *UpdateConnectionState) UnmarshalJSON(data []byte) e return nil } +// The freeze state of the current user's account has changed +type UpdateFreezeState struct { + meta + // True, if the account is frozen + IsFrozen bool `json:"is_frozen"` + // Point in time (Unix timestamp) when the account was frozen; 0 if the account isn't frozen + FreezingDate int32 `json:"freezing_date"` + // Point in time (Unix timestamp) when the account will be deleted and can't be unfrozen; 0 if the account isn't frozen + DeletionDate int32 `json:"deletion_date"` + // The link to open to send an appeal to unfreeze the account + AppealLink string `json:"appeal_link"` +} + +func (entity *UpdateFreezeState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateFreezeState + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateFreezeState) GetClass() string { + return ClassUpdate +} + +func (*UpdateFreezeState) GetType() string { + return TypeUpdateFreezeState +} + +func (*UpdateFreezeState) UpdateType() string { + return TypeUpdateFreezeState +} + // New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" type UpdateTermsOfService struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 62cd54e..31bc0c7 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -151,6 +151,9 @@ func UnmarshalAuthorizationState(data json.RawMessage) (AuthorizationState, erro case TypeAuthorizationStateWaitPhoneNumber: return UnmarshalAuthorizationStateWaitPhoneNumber(data) + case TypeAuthorizationStateWaitPremiumPurchase: + return UnmarshalAuthorizationStateWaitPremiumPurchase(data) + case TypeAuthorizationStateWaitEmailAddress: return UnmarshalAuthorizationStateWaitEmailAddress(data) @@ -931,6 +934,12 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypePremiumPurchase: return UnmarshalStarTransactionTypePremiumPurchase(data) + case TypeStarTransactionTypeBusinessBotTransferSend: + return UnmarshalStarTransactionTypeBusinessBotTransferSend(data) + + case TypeStarTransactionTypeBusinessBotTransferReceive: + return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -1707,7 +1716,7 @@ func UnmarshalListOfMessageSource(dataList []json.RawMessage) ([]MessageSource, return list, nil } -func UnmarshalReportChatSponsoredMessageResult(data json.RawMessage) (ReportChatSponsoredMessageResult, error) { +func UnmarshalReportSponsoredResult(data json.RawMessage) (ReportSponsoredResult, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -1716,31 +1725,31 @@ func UnmarshalReportChatSponsoredMessageResult(data json.RawMessage) (ReportChat } switch meta.Type { - case TypeReportChatSponsoredMessageResultOk: - return UnmarshalReportChatSponsoredMessageResultOk(data) + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(data) - case TypeReportChatSponsoredMessageResultFailed: - return UnmarshalReportChatSponsoredMessageResultFailed(data) + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(data) - case TypeReportChatSponsoredMessageResultOptionRequired: - return UnmarshalReportChatSponsoredMessageResultOptionRequired(data) + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(data) - case TypeReportChatSponsoredMessageResultAdsHidden: - return UnmarshalReportChatSponsoredMessageResultAdsHidden(data) + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(data) - case TypeReportChatSponsoredMessageResultPremiumRequired: - return UnmarshalReportChatSponsoredMessageResultPremiumRequired(data) + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfReportChatSponsoredMessageResult(dataList []json.RawMessage) ([]ReportChatSponsoredMessageResult, error) { - list := []ReportChatSponsoredMessageResult{} +func UnmarshalListOfReportSponsoredResult(dataList []json.RawMessage) ([]ReportSponsoredResult, error) { + list := []ReportSponsoredResult{} for _, data := range dataList { - entity, err := UnmarshalReportChatSponsoredMessageResult(data) + entity, err := UnmarshalReportSponsoredResult(data) if err != nil { return nil, err } @@ -3507,6 +3516,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageRefundedUpgradedGift: return UnmarshalMessageRefundedUpgradedGift(data) + case TypeMessagePaidMessagesRefunded: + return UnmarshalMessagePaidMessagesRefunded(data) + + case TypeMessagePaidMessagePriceChanged: + return UnmarshalMessagePaidMessagePriceChanged(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -5772,6 +5787,40 @@ func UnmarshalListOfStorePaymentPurpose(dataList []json.RawMessage) ([]StorePaym return list, nil } +func UnmarshalStoreTransaction(data json.RawMessage) (StoreTransaction, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoreTransactionAppStore: + return UnmarshalStoreTransactionAppStore(data) + + case TypeStoreTransactionGooglePlay: + return UnmarshalStoreTransactionGooglePlay(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoreTransaction(dataList []json.RawMessage) ([]StoreTransaction, error) { + list := []StoreTransaction{} + + for _, data := range dataList { + entity, err := UnmarshalStoreTransaction(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpose, error) { var meta meta @@ -8153,6 +8202,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) + case TypeUpdateForumTopic: + return UnmarshalUpdateForumTopic(data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) @@ -8315,6 +8367,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(data) + case TypeUpdateFreezeState: + return UnmarshalUpdateFreezeState(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) @@ -8697,6 +8752,14 @@ func UnmarshalAuthorizationStateWaitPhoneNumber(data json.RawMessage) (*Authoriz return &resp, err } +func UnmarshalAuthorizationStateWaitPremiumPurchase(data json.RawMessage) (*AuthorizationStateWaitPremiumPurchase, error) { + var resp AuthorizationStateWaitPremiumPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAuthorizationStateWaitEmailAddress(data json.RawMessage) (*AuthorizationStateWaitEmailAddress, error) { var resp AuthorizationStateWaitEmailAddress @@ -9433,6 +9496,14 @@ func UnmarshalBusinessGreetingMessageSettings(data json.RawMessage) (*BusinessGr return &resp, err } +func UnmarshalBusinessBotRights(data json.RawMessage) (*BusinessBotRights, error) { + var resp BusinessBotRights + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBusinessConnectedBot(data json.RawMessage) (*BusinessConnectedBot, error) { var resp BusinessConnectedBot @@ -9865,6 +9936,22 @@ func UnmarshalStarGiveawayPaymentOptions(data json.RawMessage) (*StarGiveawayPay return &resp, err } +func UnmarshalAcceptedGiftTypes(data json.RawMessage) (*AcceptedGiftTypes, error) { + var resp AcceptedGiftTypes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftSettings(data json.RawMessage) (*GiftSettings, error) { + var resp GiftSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { var resp UpgradedGiftModel @@ -10225,6 +10312,22 @@ func UnmarshalStarTransactionTypePremiumPurchase(data json.RawMessage) (*StarTra return &resp, err } +func UnmarshalStarTransactionTypeBusinessBotTransferSend(data json.RawMessage) (*StarTransactionTypeBusinessBotTransferSend, error) { + var resp StarTransactionTypeBusinessBotTransferSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeBusinessBotTransferReceive(data json.RawMessage) (*StarTransactionTypeBusinessBotTransferReceive, error) { + var resp StarTransactionTypeBusinessBotTransferReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { var resp StarTransactionTypeUnsupported @@ -11345,6 +11448,22 @@ func UnmarshalSponsoredMessages(data json.RawMessage) (*SponsoredMessages, error return &resp, err } +func UnmarshalSponsoredChat(data json.RawMessage) (*SponsoredChat, error) { + var resp SponsoredChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSponsoredChats(data json.RawMessage) (*SponsoredChats, error) { + var resp SponsoredChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) { var resp ReportOption @@ -11353,40 +11472,40 @@ func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) { return &resp, err } -func UnmarshalReportChatSponsoredMessageResultOk(data json.RawMessage) (*ReportChatSponsoredMessageResultOk, error) { - var resp ReportChatSponsoredMessageResultOk +func UnmarshalReportSponsoredResultOk(data json.RawMessage) (*ReportSponsoredResultOk, error) { + var resp ReportSponsoredResultOk err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalReportChatSponsoredMessageResultFailed(data json.RawMessage) (*ReportChatSponsoredMessageResultFailed, error) { - var resp ReportChatSponsoredMessageResultFailed +func UnmarshalReportSponsoredResultFailed(data json.RawMessage) (*ReportSponsoredResultFailed, error) { + var resp ReportSponsoredResultFailed err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalReportChatSponsoredMessageResultOptionRequired(data json.RawMessage) (*ReportChatSponsoredMessageResultOptionRequired, error) { - var resp ReportChatSponsoredMessageResultOptionRequired +func UnmarshalReportSponsoredResultOptionRequired(data json.RawMessage) (*ReportSponsoredResultOptionRequired, error) { + var resp ReportSponsoredResultOptionRequired err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalReportChatSponsoredMessageResultAdsHidden(data json.RawMessage) (*ReportChatSponsoredMessageResultAdsHidden, error) { - var resp ReportChatSponsoredMessageResultAdsHidden +func UnmarshalReportSponsoredResultAdsHidden(data json.RawMessage) (*ReportSponsoredResultAdsHidden, error) { + var resp ReportSponsoredResultAdsHidden err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalReportChatSponsoredMessageResultPremiumRequired(data json.RawMessage) (*ReportChatSponsoredMessageResultPremiumRequired, error) { - var resp ReportChatSponsoredMessageResultPremiumRequired +func UnmarshalReportSponsoredResultPremiumRequired(data json.RawMessage) (*ReportSponsoredResultPremiumRequired, error) { + var resp ReportSponsoredResultPremiumRequired err := json.Unmarshal(data, &resp) @@ -14361,6 +14480,22 @@ func UnmarshalMessageRefundedUpgradedGift(data json.RawMessage) (*MessageRefunde return &resp, err } +func UnmarshalMessagePaidMessagesRefunded(data json.RawMessage) (*MessagePaidMessagesRefunded, error) { + var resp MessagePaidMessagesRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePaidMessagePriceChanged(data json.RawMessage) (*MessagePaidMessagePriceChanged, error) { + var resp MessagePaidMessagePriceChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -17825,6 +17960,22 @@ func UnmarshalStorePaymentPurposeGiftedStars(data json.RawMessage) (*StorePaymen return &resp, err } +func UnmarshalStoreTransactionAppStore(data json.RawMessage) (*StoreTransactionAppStore, error) { + var resp StoreTransactionAppStore + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoreTransactionGooglePlay(data json.RawMessage) (*StoreTransactionGooglePlay, error) { + var resp StoreTransactionGooglePlay + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTelegramPaymentPurposePremiumGift(data json.RawMessage) (*TelegramPaymentPurposePremiumGift, error) { var resp TelegramPaymentPurposePremiumGift @@ -21377,6 +21528,14 @@ func UnmarshalUpdateForumTopicInfo(data json.RawMessage) (*UpdateForumTopicInfo, return &resp, err } +func UnmarshalUpdateForumTopic(data json.RawMessage) (*UpdateForumTopic, error) { + var resp UpdateForumTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateScopeNotificationSettings(data json.RawMessage) (*UpdateScopeNotificationSettings, error) { var resp UpdateScopeNotificationSettings @@ -21809,6 +21968,14 @@ func UnmarshalUpdateConnectionState(data json.RawMessage) (*UpdateConnectionStat return &resp, err } +func UnmarshalUpdateFreezeState(data json.RawMessage) (*UpdateFreezeState, error) { + var resp UpdateFreezeState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, error) { var resp UpdateTermsOfService @@ -22341,6 +22508,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAuthorizationStateWaitPhoneNumber: return UnmarshalAuthorizationStateWaitPhoneNumber(data) + case TypeAuthorizationStateWaitPremiumPurchase: + return UnmarshalAuthorizationStateWaitPremiumPurchase(data) + case TypeAuthorizationStateWaitEmailAddress: return UnmarshalAuthorizationStateWaitEmailAddress(data) @@ -22617,6 +22787,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBusinessGreetingMessageSettings: return UnmarshalBusinessGreetingMessageSettings(data) + case TypeBusinessBotRights: + return UnmarshalBusinessBotRights(data) + case TypeBusinessConnectedBot: return UnmarshalBusinessConnectedBot(data) @@ -22779,6 +22952,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarGiveawayPaymentOptions: return UnmarshalStarGiveawayPaymentOptions(data) + case TypeAcceptedGiftTypes: + return UnmarshalAcceptedGiftTypes(data) + + case TypeGiftSettings: + return UnmarshalGiftSettings(data) + case TypeUpgradedGiftModel: return UnmarshalUpgradedGiftModel(data) @@ -22914,6 +23093,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypePremiumPurchase: return UnmarshalStarTransactionTypePremiumPurchase(data) + case TypeStarTransactionTypeBusinessBotTransferSend: + return UnmarshalStarTransactionTypeBusinessBotTransferSend(data) + + case TypeStarTransactionTypeBusinessBotTransferReceive: + return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -23334,23 +23519,29 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSponsoredMessages: return UnmarshalSponsoredMessages(data) + case TypeSponsoredChat: + return UnmarshalSponsoredChat(data) + + case TypeSponsoredChats: + return UnmarshalSponsoredChats(data) + case TypeReportOption: return UnmarshalReportOption(data) - case TypeReportChatSponsoredMessageResultOk: - return UnmarshalReportChatSponsoredMessageResultOk(data) + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(data) - case TypeReportChatSponsoredMessageResultFailed: - return UnmarshalReportChatSponsoredMessageResultFailed(data) + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(data) - case TypeReportChatSponsoredMessageResultOptionRequired: - return UnmarshalReportChatSponsoredMessageResultOptionRequired(data) + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(data) - case TypeReportChatSponsoredMessageResultAdsHidden: - return UnmarshalReportChatSponsoredMessageResultAdsHidden(data) + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(data) - case TypeReportChatSponsoredMessageResultPremiumRequired: - return UnmarshalReportChatSponsoredMessageResultPremiumRequired(data) + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(data) case TypeFileDownload: return UnmarshalFileDownload(data) @@ -24465,6 +24656,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageRefundedUpgradedGift: return UnmarshalMessageRefundedUpgradedGift(data) + case TypeMessagePaidMessagesRefunded: + return UnmarshalMessagePaidMessagesRefunded(data) + + case TypeMessagePaidMessagePriceChanged: + return UnmarshalMessagePaidMessagePriceChanged(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -25764,6 +25961,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposeGiftedStars: return UnmarshalStorePaymentPurposeGiftedStars(data) + case TypeStoreTransactionAppStore: + return UnmarshalStoreTransactionAppStore(data) + + case TypeStoreTransactionGooglePlay: + return UnmarshalStoreTransactionGooglePlay(data) + case TypeTelegramPaymentPurposePremiumGift: return UnmarshalTelegramPaymentPurposePremiumGift(data) @@ -27096,6 +27299,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) + case TypeUpdateForumTopic: + return UnmarshalUpdateForumTopic(data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) @@ -27258,6 +27464,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(data) + case TypeUpdateFreezeState: + return UnmarshalUpdateFreezeState(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) diff --git a/data/td_api.tl b/data/td_api.tl index 8872945..9247a4e 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -129,6 +129,10 @@ authorizationStateWaitTdlibParameters = AuthorizationState; //@description TDLib needs the user's phone number to authorize. Call setAuthenticationPhoneNumber to provide the phone number, or use requestQrCodeAuthentication or checkAuthenticationBotToken for other authentication options authorizationStateWaitPhoneNumber = AuthorizationState; +//@description The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction +//@store_product_id Identifier of the store product that must be bought +authorizationStateWaitPremiumPurchase store_product_id:string = AuthorizationState; + //@description TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed //@allow_apple_id True, if authorization through Apple ID is allowed //@allow_google_id True, if authorization through Google ID is allowed @@ -681,11 +685,28 @@ businessAwayMessageSettings shortcut_id:int32 recipients:businessRecipients sche //@inactivity_days The number of days after which a chat will be considered as inactive; currently, must be on of 7, 14, 21, or 28 businessGreetingMessageSettings shortcut_id:int32 recipients:businessRecipients inactivity_days:int32 = BusinessGreetingMessageSettings; +//@description Describes rights of a business bot +//@can_reply True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours +//@can_read_messages True, if the bot can mark incoming private messages as read +//@can_delete_sent_messages True, if the bot can delete sent messages +//@can_delete_all_messages True, if the bot can delete any message +//@can_edit_name True, if the bot can edit name of the business account +//@can_edit_bio True, if the bot can edit bio of the business account +//@can_edit_profile_photo True, if the bot can edit profile photo of the business account +//@can_edit_username True, if the bot can edit username of the business account +//@can_view_gifts_and_stars True, if the bot can view gifts and amount of Telegram Stars owned by the business account +//@can_sell_gifts True, if the bot can sell regular gifts received by the business account +//@can_change_gift_settings True, if the bot can change gift receiving settings of the business account +//@can_transfer_and_upgrade_gifts True, if the bot can transfer and upgrade gifts received by the business account +//@can_transfer_stars True, if the bot can transfer Telegram Stars received by the business account to account of the bot, or use them to upgrade and transfer gifts +//@can_manage_stories True, if the bot can send, edit and delete stories +businessBotRights can_reply:Bool can_read_messages:Bool can_delete_sent_messages:Bool can_delete_all_messages:Bool can_edit_name:Bool can_edit_bio:Bool can_edit_profile_photo:Bool can_edit_username:Bool can_view_gifts_and_stars:Bool can_sell_gifts:Bool can_change_gift_settings:Bool can_transfer_and_upgrade_gifts:Bool can_transfer_stars:Bool can_manage_stories:Bool = BusinessBotRights; + //@description Describes a bot connected to a business account //@bot_user_id User identifier of the bot //@recipients Private chats that will be accessible to the bot -//@can_reply True, if the bot can send messages to the private chats; false otherwise -businessConnectedBot bot_user_id:int53 recipients:businessRecipients can_reply:Bool = BusinessConnectedBot; +//@rights Rights of the bot +businessConnectedBot bot_user_id:int53 recipients:businessRecipients rights:businessBotRights = BusinessConnectedBot; //@description Describes settings for a business account start page //@title Title text of the start page @@ -1040,16 +1061,28 @@ starGiveawayPaymentOption currency:string amount:int53 star_count:int53 store_pr starGiveawayPaymentOptions options:vector = StarGiveawayPaymentOptions; +//@description Describes gift types that are accepted by a user +//@unlimited_gifts True, if unlimited regular gifts are accepted +//@limited_gifts True, if limited regular gifts are accepted +//@upgraded_gifts True, if upgraded gifts and regular gifts that can be upgraded for free are accepted +//@premium_subscription True, if Telegram Premium subscription is accepted +acceptedGiftTypes unlimited_gifts:Bool limited_gifts:Bool upgraded_gifts:Bool premium_subscription:Bool = AcceptedGiftTypes; + +//@description Contains settings for gift receiving for a user +//@show_gift_button True, if a button for sending a gift to the user or by the user must always be shown in the input field +//@accepted_gift_types Types of gifts accepted by the user; for Telegram Premium users only +giftSettings show_gift_button:Bool accepted_gift_types:acceptedGiftTypes = GiftSettings; + //@description Describes a model of an upgraded gift //@name Name of the model //@sticker The sticker representing the upgraded gift -//@rarity_per_mille The number of upgraded gift that receive this model for each 1000 gifts upgraded +//@rarity_per_mille The number of upgraded gifts that receive this model for each 1000 gifts upgraded upgradedGiftModel name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftModel; //@description Describes a symbol shown on the pattern of an upgraded gift //@name Name of the symbol -//@sticker The sticker representing the upgraded gift -//@rarity_per_mille The number of upgraded gift that receive this symbol for each 1000 gifts upgraded +//@sticker The sticker representing the symbol +//@rarity_per_mille The number of upgraded gifts that receive this symbol for each 1000 gifts upgraded upgradedGiftSymbol name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftSymbol; //@description Describes colors of a backdrop of an upgraded gift @@ -1062,7 +1095,7 @@ upgradedGiftBackdropColors center_color:int32 edge_color:int32 symbol_color:int3 //@description Describes a backdrop of an upgraded gift //@name Name of the backdrop //@colors Colors of the backdrop -//@rarity_per_mille The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded +//@rarity_per_mille The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded upgradedGiftBackdrop name:string colors:upgradedGiftBackdropColors rarity_per_mille:int32 = UpgradedGiftBackdrop; //@description Describes the original details about the gift @@ -1096,9 +1129,9 @@ gifts gifts:vector = Gifts; //@total_upgraded_count Total number of gifts that were upgraded from the same gift //@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift //@owner_id Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown -//@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none +//@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address //@owner_name Name of the owner for the case when owner identifier and address aren't known -//@gift_address Address of the gift NFT in TON blockchain; may be empty if none +//@gift_address Address of the gift NFT in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address //@model Model of the upgraded gift //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift @@ -1296,12 +1329,18 @@ starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTrans //@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds starTransactionTypePaidMessageReceive sender_id:MessageSender message_count:int32 commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; -//@description The transaction is a purchase of Telegram Premium subscription; for regular users only +//@description The transaction is a purchase of Telegram Premium subscription; for regular users and bots only //@user_id Identifier of the user that received the Telegram Premium subscription //@month_count Number of months the Telegram Premium subscription will be active //@sticker A sticker to be shown in the transaction information; may be null if unknown starTransactionTypePremiumPurchase user_id:int53 month_count:int32 sticker:sticker = StarTransactionType; +//@description The transaction is a transfer of Telegram Stars to a business bot; for regular users only @user_id Identifier of the bot that received Telegram Stars +starTransactionTypeBusinessBotTransferSend user_id:int53 = StarTransactionType; + +//@description The transaction is a transfer of Telegram Stars from a business account; for bots only @user_id Identifier of the user that sent Telegram Stars +starTransactionTypeBusinessBotTransferReceive user_id:int53 = StarTransactionType; + //@description The transaction is a transaction of an unsupported type starTransactionTypeUnsupported = StarTransactionType; @@ -1507,10 +1546,11 @@ botInfo short_description:string description:string photo:photo animation:animat //@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 //@incoming_paid_message_star_count Number of Telegram Stars that must be paid by the user for each sent message to the current user //@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the user +//@gift_settings Settings for gift receiving for the user //@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown //@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 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 bot_verification:botVerification 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 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 gift_settings:giftSettings bot_verification:botVerification 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; @@ -2193,27 +2233,37 @@ 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 a sponsored chat +//@unique_id Unique identifier of this result +//@chat_id Chat identifier +//@sponsor_info Additional optional information about the sponsor to be shown along with the chat +//@additional_info If non-empty, additional information about the sponsored chat to be shown along with the chat +sponsoredChat unique_id:int53 chat_id:int53 sponsor_info:string additional_info:string = SponsoredChat; + +//@description Contains a list of sponsored chats @chats List of sponsored chats +sponsoredChats chats:vector = SponsoredChats; + //@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 +//@class ReportSponsoredResult @description Describes result of sponsored message or chat report //@description The message was reported successfully -reportChatSponsoredMessageResultOk = ReportChatSponsoredMessageResult; +reportSponsoredResultOk = ReportSponsoredResult; //@description The sponsored message is too old or not found -reportChatSponsoredMessageResultFailed = ReportChatSponsoredMessageResult; +reportSponsoredResultFailed = ReportSponsoredResult; //@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; +reportSponsoredResultOptionRequired title:string options:vector = ReportSponsoredResult; //@description Sponsored messages were hidden for the user in all chats -reportChatSponsoredMessageResultAdsHidden = ReportChatSponsoredMessageResult; +reportSponsoredResultAdsHidden = ReportSponsoredResult; //@description The user asked to hide sponsored messages, but Telegram Premium is required for this -reportChatSponsoredMessageResultPremiumRequired = ReportChatSponsoredMessageResult; +reportSponsoredResultPremiumRequired = ReportSponsoredResult; //@description Describes a file added to file download list @@ -2774,6 +2824,7 @@ savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@description Contains basic information about a forum topic +//@chat_id Identifier of the forum chat to which the topic belongs //@message_thread_id Message thread identifier of the topic //@name Name of the topic //@icon Icon of the topic @@ -2783,11 +2834,12 @@ forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@is_outgoing True, if the topic was created by the current user //@is_closed True, if the topic is closed //@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only -forumTopicInfo message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; +forumTopicInfo chat_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; //@description Describes a forum topic //@info Basic information about the topic //@last_message Last message in the topic; may be null if unknown +//@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order //@is_pinned True, if the topic is pinned in the topic list //@unread_count Number of unread messages in the topic //@last_read_inbox_message_id Identifier of the last read incoming message @@ -2796,7 +2848,7 @@ forumTopicInfo message_thread_id:int53 name:string icon:forumTopicIcon creation_ //@unread_reaction_count Number of messages with unread reactions in the topic //@notification_settings Notification settings for the topic //@draft_message A draft of a message in the topic; may be null if none -forumTopic info:forumTopicInfo last_message:message is_pinned:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings draft_message:draftMessage = ForumTopic; +forumTopic info:forumTopicInfo last_message:message order:int64 is_pinned:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings draft_message:draftMessage = ForumTopic; //@description Describes a list of forum topics //@total_count Approximate total number of forum topics found @@ -4138,6 +4190,12 @@ messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:s //@is_upgrade True, if the gift was obtained by upgrading of a previously received gift messageRefundedUpgradedGift gift:gift sender_id:MessageSender is_upgrade:Bool = MessageContent; +//@description Paid messages were refunded @message_count The number of refunded messages @star_count The number of refunded Telegram Stars +messagePaidMessagesRefunded message_count:int32 star_count:int53 = MessageContent; + +//@description A price for paid messages was changed in the supergroup chat @paid_message_star_count The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message +messagePaidMessagePriceChanged paid_message_star_count:int53 = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -5469,9 +5527,9 @@ speechRecognitionResultError error:error = SpeechRecognitionResult; //@user_id Identifier of the business user that created the connection //@user_chat_id Chat identifier of the private chat with the user //@date Point in time (Unix timestamp) when the connection was established -//@can_reply True, if the bot can send messages to the connected user; false otherwise +//@rights Rights of the bot; may be null if the connection was disabled //@is_enabled True, if the connection is enabled; false otherwise -businessConnection id:string user_id:int53 user_chat_id:int53 date:int32 can_reply:Bool is_enabled:Bool = BusinessConnection; +businessConnection id:string user_id:int53 user_chat_id:int53 date:int32 rights:businessBotRights is_enabled:Bool = BusinessConnection; //@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB format for light themes @dark_color Color in the RGB format for dark themes @@ -6350,10 +6408,22 @@ storePaymentPurposeStars currency:string amount:int53 star_count:int53 = StorePa storePaymentPurposeGiftedStars user_id:int53 currency:string amount:int53 star_count:int53 = StorePaymentPurpose; +//@class StoreTransaction @description Describes an in-store transaction + +//@description A purchase through App Store @receipt App Store receipt +storeTransactionAppStore receipt:bytes = StoreTransaction; + +//@description A purchase through Google Play +//@package_name Application package name +//@store_product_id Identifier of the purchased store product +//@purchase_token Google Play purchase token +storeTransactionGooglePlay package_name:string store_product_id:string purchase_token:string = StoreTransaction; + + //@class TelegramPaymentPurpose @description Describes a purpose of a payment toward Telegram //@description The user gifting Telegram Premium to another user -//@currency ISO 4217 currency code of the payment currency +//@currency ISO 4217 currency code of the payment currency, or "XTR" for payments in Telegram Stars //@amount Paid amount, in the smallest units of the currency //@user_id Identifier of the user which will receive Telegram Premium //@month_count Number of months the Telegram Premium subscription will be active for the user @@ -6975,7 +7045,8 @@ readDatePrivacySettings show_read_date:Bool = ReadDatePrivacySettings; //@description Contains privacy settings for chats with non-contacts //@allow_new_chats_from_unknown_users True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting //@incoming_paid_message_star_count Number of Telegram Stars that must be paid for every incoming private message by non-contacts; 0-getOption("paid_message_star_count_max"). -//-If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending +//-If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. +//-Can be positive, only if getOption("can_enable_paid_messages") is true newChatPrivacySettings allow_new_chats_from_unknown_users:Bool incoming_paid_message_star_count:int53 = NewChatPrivacySettings; @@ -8281,8 +8352,16 @@ updateQuickReplyShortcuts shortcut_ids:vector = Update; //@messages The new list of quick reply messages for the shortcut in order from the first to the last sent updateQuickReplyShortcutMessages shortcut_id:int32 messages:vector = Update; -//@description Basic information about a topic in a forum chat was changed @chat_id Chat identifier @info New information about the topic -updateForumTopicInfo chat_id:int53 info:forumTopicInfo = Update; +//@description Basic information about a topic in a forum chat was changed @info New information about the topic +updateForumTopicInfo info:forumTopicInfo = Update; + +//@description Information about a topic in a forum chat was changed +//@chat_id Chat identifier +//@message_thread_id Message thread identifier of the topic +//@is_pinned True, if the topic is pinned in the topic list +//@last_read_outbox_message_id Identifier of the last read outgoing message +//@notification_settings Notification settings for the topic +updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_outbox_message_id:int53 notification_settings:chatNotificationSettings = Update; //@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; @@ -8510,6 +8589,13 @@ updateLanguagePackStrings localization_target:string language_pack_id:string str //@description The connection state has changed. This update must be used only to show a human-readable description of the connection state @state The new connection state updateConnectionState state:ConnectionState = Update; +//@description The freeze state of the current user's account has changed +//@is_frozen True, if the account is frozen +//@freezing_date Point in time (Unix timestamp) when the account was frozen; 0 if the account isn't frozen +//@deletion_date Point in time (Unix timestamp) when the account will be deleted and can't be unfrozen; 0 if the account isn't frozen +//@appeal_link The link to open to send an appeal to unfreeze the account +updateFreezeState is_frozen:Bool freezing_date:int32 deletion_date:int32 appeal_link:string = Update; + //@description New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" @terms_of_service_id Identifier of the terms of service @terms_of_service The new terms of service updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService = Update; @@ -8773,7 +8859,7 @@ testVectorStringObject value:vector = TestVectorStringObject; ---functions--- -//@description Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization +//@description Returns the current authorization state. This is an offline method. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization getAuthorizationState = AuthorizationState; @@ -8795,11 +8881,24 @@ getAuthorizationState = AuthorizationState; setTdlibParameters use_test_dc:Bool database_directory:string files_directory:string database_encryption_key:bytes use_file_database:Bool use_chat_info_database:Bool use_message_database:Bool use_secret_chats:Bool api_id:int32 api_hash:string system_language_code:string device_model:string system_version:string application_version:string = Ok; //@description Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, -//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, +//-authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword //@phone_number The phone number of the user, in international format //@settings Settings for the authentication of the user's phone number; pass null to use default settings setAuthenticationPhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = Ok; +//@description Checks whether an in-store purchase of Telegram Premium is possible before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +checkAuthenticationPremiumPurchase currency:string amount:int53 = Ok; + +//@description Informs server about an in-store purchase of Telegram Premium before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +//@transaction Information about the transaction +//@is_restore Pass true if this is a restore of a Telegram Premium purchase; only for App Store +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +setAuthenticationPremiumPurchaseTransaction transaction:StoreTransaction is_restore:Bool currency:string amount:int53 = Ok; + //@description Sets the email address of the user and sends an authentication code to the email address. Works only when the current authorization state is authorizationStateWaitEmailAddress @email_address The email address of the user setAuthenticationEmailAddress email_address:string = Ok; @@ -8815,7 +8914,8 @@ checkAuthenticationEmailCode code:EmailAddressAuthentication = Ok; checkAuthenticationCode code:string = Ok; //@description Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, -//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, +//-authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword //@other_user_ids List of user identifiers of other users currently using the application requestQrCodeAuthentication other_user_ids:vector = Ok; @@ -8945,28 +9045,28 @@ getTemporaryPasswordState = TemporaryPasswordState; //@description Returns the current user getMe = User; -//@description Returns information about a user by their identifier. This is an offline request if the current user is not a bot @user_id User identifier +//@description Returns information about a user by their identifier. This is an offline method if the current user is not a bot @user_id User identifier getUser user_id:int53 = User; //@description Returns full information about a user by their identifier @user_id User identifier getUserFullInfo user_id:int53 = UserFullInfo; -//@description Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot @basic_group_id Basic group identifier +//@description Returns information about a basic group by its identifier. This is an offline method if the current user is not a bot @basic_group_id Basic group identifier getBasicGroup basic_group_id:int53 = BasicGroup; //@description Returns full information about a basic group by its identifier @basic_group_id Basic group identifier getBasicGroupFullInfo basic_group_id:int53 = BasicGroupFullInfo; -//@description Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot @supergroup_id Supergroup or channel identifier +//@description Returns information about a supergroup or a channel by its identifier. This is an offline method if the current user is not a bot @supergroup_id Supergroup or channel identifier getSupergroup supergroup_id:int53 = Supergroup; //@description Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute @supergroup_id Supergroup or channel identifier getSupergroupFullInfo supergroup_id:int53 = SupergroupFullInfo; -//@description Returns information about a secret chat by its identifier. This is an offline request @secret_chat_id Secret chat identifier +//@description Returns information about a secret chat by its identifier. This is an offline method @secret_chat_id Secret chat identifier 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 +//@description Returns information about a chat by its identifier. This is an offline method if the current user is not a bot @chat_id Chat identifier getChat chat_id:int53 = Chat; //@description Returns information about a message. Returns a 404 error if the message doesn't exist @@ -8974,7 +9074,7 @@ getChat chat_id:int53 = Chat; //@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. Returns a 404 error if message isn't available locally. This is an offline request +//@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 method //@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; @@ -8996,7 +9096,7 @@ getCallbackQueryMessage chat_id:int53 message_id:int53 callback_query_id:int64 = //@description Returns information about messages. If a message is not found, returns null on the corresponding position of the result @chat_id Identifier of the chat the messages belong to @message_ids Identifiers of the messages to get getMessages chat_id:int53 message_ids:vector = Messages; -//@description Returns properties of a message; this is an offline request @chat_id Chat identifier @message_id Identifier of the message +//@description Returns properties of a message. This is an offline method @chat_id Chat identifier @message_id Identifier of the message getMessageProperties chat_id:int53 message_id:int53 = MessageProperties; //@description Returns information about a message thread. Can be used only if messageProperties.can_get_message_thread == true @chat_id Chat identifier @message_id Identifier of the message @@ -9012,10 +9112,10 @@ getMessageReadDate chat_id:int53 message_id:int53 = MessageReadDate; //@message_id Identifier of the message getMessageViewers chat_id:int53 message_id:int53 = MessageViewers; -//@description Returns information about a file; this is an offline request @file_id Identifier of the file to get +//@description Returns information about a file. This is an offline method @file_id Identifier of the file to get getFile file_id:int32 = File; -//@description Returns information about a file by its remote identifier; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. +//@description Returns information about a file by its remote identifier. This is an offline method. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. //-For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application //@remote_file_id Remote identifier of the file to get //@file_type File type; pass null if unknown @@ -9039,7 +9139,7 @@ searchPublicChat username:string = Chat; //@query Query to search for searchPublicChats query:string = Chats; -//@description Searches for the specified query in the title and username of already known chats; this is an offline request. Returns chats in the order seen in the main chat list +//@description Searches for the specified query in the title and username of already known chats. This is an offline method. Returns chats in the order seen in the main chat list //@query Query to search for. If the query is empty, returns up to 50 recently found chats //@limit The maximum number of chats to be returned searchChats query:string limit:int32 = Chats; @@ -9082,7 +9182,7 @@ getTopChats category:TopChatCategory limit:int32 = Chats; //@description Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled @category Category of frequently used chats @chat_id Chat identifier removeTopChat category:TopChatCategory chat_id:int53 = Ok; -//@description Searches for the specified query in the title and username of up to 50 recently found chats; this is an offline request +//@description Searches for the specified query in the title and username of up to 50 recently found chats. This is an offline method //@query Query to search for //@limit The maximum number of chats to be returned searchRecentlyFoundChats query:string limit:int32 = Chats; @@ -9096,7 +9196,7 @@ removeRecentlyFoundChat chat_id:int53 = Ok; //@description Clears the list of recently found chats clearRecentlyFoundChats = Ok; -//@description Returns recently opened chats; this is an offline request. Returns chats in the order of last opening @limit The maximum number of chats to be returned +//@description Returns recently opened chats. This is an offline method. Returns chats in the order of last opening @limit The maximum number of chats to be returned getRecentlyOpenedChats limit:int32 = Chats; //@description Checks whether a username can be set for a chat @chat_id Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or 0 if the chat is being created @username Username to be checked @@ -9162,7 +9262,7 @@ getGroupsInCommon user_id:int53 offset_chat_id:int53 limit:int32 = Chats; //@description Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). -//-For optimal performance, the number of returned messages is chosen by TDLib. This is an offline request if only_local is true +//-For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true //@chat_id Chat identifier //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages @@ -9344,7 +9444,21 @@ clickChatSponsoredMessage chat_id:int53 message_id:int53 is_media_click:Bool fro //@chat_id Chat identifier of the sponsored message //@message_id Identifier of the sponsored message //@option_id Option identifier chosen by the user; leave empty for the initial request -reportChatSponsoredMessage chat_id:int53 message_id:int53 option_id:bytes = ReportChatSponsoredMessageResult; +reportChatSponsoredMessage chat_id:int53 message_id:int53 option_id:bytes = ReportSponsoredResult; + +//@description Returns sponsored chats to be shown in the search results @query Query the user searches for +getSearchSponsoredChats query:string = SponsoredChats; + +//@description Informs TDLib that the user fully viewed a sponsored chat @sponsored_chat_unique_id Unique identifier of the sponsored chat +viewSponsoredChat sponsored_chat_unique_id:int53 = Ok; + +//@description Informs TDLib that the user opened a sponsored chat @sponsored_chat_unique_id Unique identifier of the sponsored chat +openSponsoredChat sponsored_chat_unique_id:int53 = Ok; + +//@description Reports a sponsored chat to Telegram moderators +//@sponsored_chat_unique_id Unique identifier of the sponsored chat +//@option_id Option identifier chosen by the user; leave empty for the initial request +reportSponsoredChat sponsored_chat_unique_id:int53 option_id:bytes = ReportSponsoredResult; //@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user @notification_group_id Identifier of notification group to which the notification belongs @notification_id Identifier of removed notification @@ -9354,7 +9468,7 @@ removeNotification notification_group_id:int32 notification_id:int32 = Ok; removeNotificationGroup notification_group_id:int32 max_notification_id:int32 = Ok; -//@description Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request +//@description Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline method //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message //@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its link preview @@ -9663,6 +9777,66 @@ stopBusinessPoll business_connection_id:string chat_id:int53 message_id:int53 re //@is_pinned Pass true to pin the message, pass false to unpin it setBusinessMessageIsPinned business_connection_id:string chat_id:int53 message_id:int53 is_pinned:Bool = Ok; +//@description Reads a message on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection through which the message was received +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +readBusinessMessage business_connection_id:string chat_id:int53 message_id:int53 = Ok; + +//@description Deletes messages on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection through which the messages were received +//@message_ids Identifier of the messages +deleteBusinessMessages business_connection_id:string message_ids:vector = Ok; + +//@description Changes a story sent by the bot on behalf of a business account; for bots only +//@story_sender_chat_id Identifier of the chat that posted the story +//@story_id Identifier of the story to edit +//@content New content of the story +//@areas New clickable rectangle areas to be shown on the story media +//@caption New story caption +//@privacy_settings The new privacy settings for the story +editBusinessStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings = Story; + +//@description Deletes a story sent by the bot on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@story_id Identifier of the story to delete +deleteBusinessStory business_connection_id:string story_id:int32 = Ok; + +//@description Changes the first and last name of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@first_name The new value of the first name for the business account; 1-64 characters +//@last_name The new value of the optional last name for the business account; 0-64 characters +setBusinessAccountName business_connection_id:string first_name:string last_name:string = Ok; + +//@description Changes the bio of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@bio The new value of the bio; 0-getOption("bio_length_max") characters without line feeds +setBusinessAccountBio business_connection_id:string bio:string = Ok; + +//@description Changes a profile photo of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@photo Profile photo to set; pass null to remove the photo +//@is_public Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings +setBusinessAccountProfilePhoto business_connection_id:string photo:InputChatPhoto is_public:Bool = Ok; + +//@description Changes the editable username of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@username The new value of the username +setBusinessAccountUsername business_connection_id:string username:string = Ok; + +//@description Changes settings for gift receiving of a business account; for bots only +//@business_connection_id Unique identifier of business connection +//@settings The new settings +setBusinessAccountGiftSettings business_connection_id:string settings:giftSettings = Ok; + +//@description Returns the amount of Telegram Stars owned by a business account; for bots only @business_connection_id Unique identifier of business connection +getBusinessAccountStarAmount business_connection_id:string = StarAmount; + +//@description Transfer Telegram Stars from the business account to the business bot; for bots only +//@business_connection_id Unique identifier of business connection +//@star_count Number of Telegram Stars to transfer +transferBusinessAccountStars business_connection_id:string star_count:int53 = Ok; + //@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters checkQuickReplyShortcutName name:string = Ok; @@ -9745,7 +9919,7 @@ editForumTopic chat_id:int53 message_thread_id:int53 name:string edit_icon_custo //@description Returns information about a forum topic @chat_id Identifier of the chat @message_thread_id Message thread identifier of the forum topic getForumTopic chat_id:int53 message_thread_id:int53 = ForumTopic; -//@description Returns an HTTPS link to a topic in a forum chat. This is an offline request @chat_id Identifier of the chat @message_thread_id Message thread identifier of the forum topic +//@description Returns an HTTPS link to a topic in a forum chat. This is an offline method @chat_id Identifier of the chat @message_thread_id Message thread identifier of the forum topic getForumTopicLink chat_id:int53 message_thread_id:int53 = MessageLink; //@description Returns found forum topics in a forum chat. This is a temporary method for getting information about topic list from the server @@ -10025,7 +10199,7 @@ getGrossingWebAppBots offset:string limit:int32 = FoundUsers; //@web_app_short_name Short name of the Web App searchWebApp bot_user_id:int53 web_app_short_name:string = FoundWebApp; -//@description Returns a default placeholder for Web Apps of a bot; this is an offline request. Returns a 404 error if the placeholder isn't known @bot_user_id Identifier of the target bot +//@description Returns a default placeholder for Web Apps of a bot. This is an offline method. Returns a 404 error if the placeholder isn't known @bot_user_id Identifier of the target bot getWebAppPlaceholder bot_user_id:int53 = Outline; //@description Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked @@ -10227,7 +10401,7 @@ createNewSecretChat user_id:int53 = Chat; upgradeBasicGroupChatToSupergroupChat chat_id:int53 = Chat; -//@description Returns chat lists to which the chat can be added. This is an offline request @chat_id Chat identifier +//@description Returns chat lists to which the chat can be added. This is an offline method @chat_id Chat identifier getChatListsToAddChat chat_id:int53 = ChatLists; //@description Adds a chat to a chat list. A chat can't be simultaneously in Main and Archive chat lists, so it is automatically removed from another one if needed @@ -10692,12 +10866,12 @@ activateStoryStealthMode = Ok; getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; -//@description Returns the list of features available on the specific chat boost level; this is an offline request +//@description Returns the list of features available on the specific chat boost level. This is an offline method //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups //@level Chat boost level getChatBoostLevelFeatures is_channel:Bool level:int32 = ChatBoostLevelFeatures; -//@description Returns the list of features available for different chat boost levels; this is an offline request +//@description Returns the list of features available for different chat boost levels. This is an offline method //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups getChatBoostFeatures is_channel:Bool = ChatBoostFeatures; @@ -11233,7 +11407,7 @@ sharePhoneNumber user_id:int53 = Ok; getUserProfilePhotos user_id:int53 offset:int32 limit:int32 = ChatPhotos; -//@description Returns outline of a sticker; this is an offline request. Returns a 404 error if the outline isn't known +//@description Returns outline of a sticker. This is an offline method. Returns a 404 error if the outline isn't known //@sticker_file_id File identifier of the sticker //@for_animated_emoji Pass true to get the outline scaled for animated emoji //@for_clicked_animated_emoji_message Pass true to get the outline scaled for clicked animated emoji message @@ -11406,7 +11580,7 @@ removeRecentHashtag hashtag:string = Ok; //@link_preview_options Options to be used for generation of the link preview; pass null to use default link preview options getLinkPreview text:formattedText link_preview_options:linkPreviewOptions = LinkPreview; -//@description Returns an instant view version of a web page if available. This is an offline request if only_local is true. Returns a 404 error if the web page has no instant view page +//@description Returns an instant view version of a web page if available. This is an offline method if only_local is true. Returns a 404 error if the web page has no instant view page //@url The web page URL //@only_local Pass true to get only locally available information without sending network requests getWebPageInstantView url:string only_local:Bool = WebPageInstantView; @@ -11414,7 +11588,7 @@ getWebPageInstantView url:string only_local:Bool = WebPageInstantView; //@description Changes a profile photo for the current user //@photo Profile photo to set -//@is_public Pass true to set a public photo, which will be visible even the main photo is hidden by privacy settings +//@is_public Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings setProfilePhoto photo:InputChatPhoto is_public:Bool = Ok; //@description Deletes a profile photo @profile_photo_id Identifier of the profile photo to delete @@ -11853,6 +12027,9 @@ deleteSavedOrderInfo = Ok; deleteSavedCredentials = Ok; +//@description Changes settings for gift receiving for the current user @settings The new settings +setGiftSettings settings:giftSettings = Ok; + //@description Returns gifts that can be sent to other users and channel chats getAvailableGifts = Gifts; @@ -11865,8 +12042,10 @@ getAvailableGifts = Gifts; //@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; -//@description Sells a gift for Telegram Stars @received_gift_id Identifier of the gift -sellGift received_gift_id:string = Ok; +//@description Sells a gift for Telegram Stars +//@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only +//@received_gift_id Identifier of the gift +sellGift business_connection_id:string received_gift_id:string = Ok; //@description Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat //@received_gift_id Identifier of the gift @@ -11887,18 +12066,21 @@ toggleChatGiftNotifications chat_id:int53 are_enabled:Bool = Ok; getGiftUpgradePreview gift_id:int64 = GiftUpgradePreview; //@description Upgrades a regular gift +//@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@received_gift_id Identifier of the gift //@keep_original_details Pass true to keep the original gift text, sender and receiver in the upgraded gift //@star_count The amount of Telegram Stars required to pay for the upgrade. It the gift has prepaid_upgrade_star_count > 0, then pass 0, otherwise, pass gift.upgrade_star_count -upgradeGift received_gift_id:string keep_original_details:Bool star_count:int53 = UpgradeGiftResult; +upgradeGift business_connection_id:string received_gift_id:string keep_original_details:Bool star_count:int53 = UpgradeGiftResult; //@description Sends an upgraded gift to another user or a channel chat +//@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@received_gift_id Identifier of the gift //@new_owner_id Identifier of the user or the channel chat that will receive the gift //@star_count The amount of Telegram Stars required to pay for the transfer -transferGift received_gift_id:string new_owner_id:MessageSender star_count:int53 = Ok; +transferGift business_connection_id:string received_gift_id:string new_owner_id:MessageSender star_count:int53 = Ok; //@description Returns gifts received by the given user or chat +//@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@owner_id Identifier of the gift receiver //@exclude_unsaved Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right //@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right @@ -11908,7 +12090,7 @@ transferGift received_gift_id:string new_owner_id:MessageSender star_count:int53 //@sort_by_price Pass true to sort results by gift price instead of send date //@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 -getReceivedGifts owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; +getReceivedGifts business_connection_id:string owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; //@description Returns information about a received gift @received_gift_id Identifier of the gift getReceivedGift received_gift_id:string = ReceivedGift; @@ -11962,7 +12144,7 @@ removeInstalledBackground background_id:int64 = Ok; resetInstalledBackgrounds = Ok; -//@description Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization @only_local Pass true to get only locally available information without sending network requests +//@description Returns information about the current localization target. This is an offline method if only_local is true. Can be called before authorization @only_local Pass true to get only locally available information without sending network requests getLocalizationTargetInfo only_local:Bool = LocalizationTargetInfo; //@description Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization @language_pack_id Language pack identifier @@ -12401,6 +12583,13 @@ checkPremiumGiftCode code:string = PremiumGiftCodeInfo; //@description Applies a Telegram Premium gift code @code The code to apply applyPremiumGiftCode code:string = Ok; +//@description Allows to buy a Telegram Premium subscription for another user with payment in Telegram Stars; for bots only +//@user_id Identifier of the user which will receive Telegram Premium +//@star_count The number of Telegram Stars to pay for subscription +//@month_count Number of months the Telegram Premium subscription will be active for the user +//@text Text to show to the user receiving Telegram Premium; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed +giftPremiumWithStars user_id:int53 star_count:int53 month_count:int32 text:formattedText = Ok; + //@description Launches a prepaid giveaway //@giveaway_id Unique identifier of the prepaid giveaway //@parameters Giveaway parameters @@ -12436,18 +12625,11 @@ getStarTransactions owner_id:MessageSender subscription_id:string direction:Star //@offset Offset of the first subscription to return as received from the previous request; use empty string to get the first chunk of results getStarSubscriptions only_expiring:Bool offset:string = StarSubscriptions; -//@description Checks whether an in-store purchase is possible. Must be called before any in-store purchase @purpose Transaction purpose +//@description Checks whether an in-store purchase is possible. Must be called before any in-store purchase. For official applications only @purpose Transaction purpose canPurchaseFromStore purpose:StorePaymentPurpose = Ok; -//@description Informs server about a purchase through App Store. For official applications only @receipt App Store receipt @purpose Transaction purpose -assignAppStoreTransaction receipt:bytes purpose:StorePaymentPurpose = Ok; - -//@description Informs server about a purchase through Google Play. For official applications only -//@package_name Application package name -//@store_product_id Identifier of the purchased store product -//@purchase_token Google Play purchase token -//@purpose Transaction purpose -assignGooglePlayTransaction package_name:string store_product_id:string purchase_token:string purpose:StorePaymentPurpose = Ok; +//@description Informs server about an in-store purchase. For official applications only @transaction Information about the transaction @purpose Transaction purpose +assignStoreTransaction transaction:StoreTransaction purpose:StorePaymentPurpose = Ok; //@description Cancels or re-enables Telegram Star subscription //@subscription_id Identifier of the subscription to change From dc9ae3ed546e976f6360c5ba050dde64c91c077f Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 1 May 2025 18:12:43 +0800 Subject: [PATCH 14/29] Fallback --- client/extra.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/extra.go b/client/extra.go index 0a6c60f..827c857 100644 --- a/client/extra.go +++ b/client/extra.go @@ -28,6 +28,10 @@ func CheckCommand(text string, entities []*TextEntity) string { // e.g. ["/hello 123", "/hell o 123"] // Result: "/hello", "/hell" if i := strings.Index(text, " "); i != -1 { + // Fallback: remove @bot + if i2 := strings.Index(text, "@"); i2 != -1 { + return text[:i2] + } return text[:i] } From b943b2fe5e7b209d4d1dfcb9f99d3ef42f502a20 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 1 May 2025 18:13:00 +0800 Subject: [PATCH 15/29] Update to TDLib 1.8.48 --- client/function.go | 522 +++++++++++++++------ client/type.go | 1015 +++++++++++++++++++++++++++++++---------- client/unmarshaler.go | 477 +++++++++++++++---- data/td_api.tl | 468 ++++++++++++------- 4 files changed, 1824 insertions(+), 658 deletions(-) diff --git a/client/function.go b/client/function.go index f4c29cf..ed53166 100755 --- a/client/function.go +++ b/client/function.go @@ -2979,7 +2979,7 @@ type SearchCallMessagesRequest struct { OnlyMissed bool `json:"only_missed"` } -// Searches for call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib +// Searches for call and group call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib func (client *Client) SearchCallMessages(req *SearchCallMessagesRequest) (*FoundMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -3065,7 +3065,7 @@ func (client *Client) SearchPublicMessagesByTag(req *SearchPublicMessagesByTagRe type SearchPublicStoriesByTagRequest struct { // Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Hashtag or cashtag to search for Tag string `json:"tag"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -3081,7 +3081,7 @@ func (client *Client) SearchPublicStoriesByTag(req *SearchPublicStoriesByTagRequ Type: "searchPublicStoriesByTag", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "tag": req.Tag, "offset": req.Offset, "limit": req.Limit, @@ -5335,7 +5335,7 @@ func (client *Client) DeleteBusinessMessages(req *DeleteBusinessMessagesRequest) type EditBusinessStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story to edit StoryId int32 `json:"story_id"` // New content of the story @@ -5348,14 +5348,14 @@ type EditBusinessStoryRequest struct { PrivacySettings StoryPrivacySettings `json:"privacy_settings"` } -// Changes a story sent by the bot on behalf of a business account; for bots only +// Changes a story posted by the bot on behalf of a business account; for bots only func (client *Client) EditBusinessStory(req *EditBusinessStoryRequest) (*Story, error) { result, err := client.Send(Request{ meta: meta{ Type: "editBusinessStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "content": req.Content, "areas": req.Areas, @@ -5381,7 +5381,7 @@ type DeleteBusinessStoryRequest struct { StoryId int32 `json:"story_id"` } -// Deletes a story sent by the bot on behalf of a business account; for bots only +// Deletes a story posted by the bot on behalf of a business account; for bots only func (client *Client) DeleteBusinessStory(req *DeleteBusinessStoryRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8684,6 +8684,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(result.Data) + case TypeInternalLinkTypeGroupCall: + return UnmarshalInternalLinkTypeGroupCall(result.Data) + case TypeInternalLinkTypeInstantView: return UnmarshalInternalLinkTypeInstantView(result.Data) @@ -11323,7 +11326,7 @@ func (client *Client) GetCurrentWeather(req *GetCurrentWeatherRequest) (*Current type GetStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` // Pass true to get only locally available information without sending network requests @@ -11337,7 +11340,7 @@ func (client *Client) GetStory(req *GetStoryRequest) (*Story, error) { Type: "getStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "only_local": req.OnlyLocal, }, @@ -11353,11 +11356,11 @@ func (client *Client) GetStory(req *GetStoryRequest) (*Story, error) { return UnmarshalStory(result.Data) } -// Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there -func (client *Client) GetChatsToSendStories() (*Chats, error) { +// Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canPostStory before actually trying to post a story there +func (client *Client) GetChatsToPostStories() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatsToSendStories", + Type: "getChatsToPostStories", }, Data: map[string]interface{}{}, }) @@ -11372,16 +11375,16 @@ func (client *Client) GetChatsToSendStories() (*Chats, error) { return UnmarshalChats(result.Data) } -type CanSendStoryRequest struct { +type CanPostStoryRequest struct { // Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user ChatId int64 `json:"chat_id"` } -// Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats -func (client *Client) CanSendStory(req *CanSendStoryRequest) (CanSendStoryResult, error) { +// Checks whether the current user can post a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +func (client *Client) CanPostStory(req *CanPostStoryRequest) (CanPostStoryResult, error) { result, err := client.Send(Request{ meta: meta{ - Type: "canSendStory", + Type: "canPostStory", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -11396,30 +11399,30 @@ func (client *Client) CanSendStory(req *CanSendStoryRequest) (CanSendStoryResult } switch result.Type { - case TypeCanSendStoryResultOk: - return UnmarshalCanSendStoryResultOk(result.Data) + case TypeCanPostStoryResultOk: + return UnmarshalCanPostStoryResultOk(result.Data) - case TypeCanSendStoryResultPremiumNeeded: - return UnmarshalCanSendStoryResultPremiumNeeded(result.Data) + case TypeCanPostStoryResultPremiumNeeded: + return UnmarshalCanPostStoryResultPremiumNeeded(result.Data) - case TypeCanSendStoryResultBoostNeeded: - return UnmarshalCanSendStoryResultBoostNeeded(result.Data) + case TypeCanPostStoryResultBoostNeeded: + return UnmarshalCanPostStoryResultBoostNeeded(result.Data) - case TypeCanSendStoryResultActiveStoryLimitExceeded: - return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(result.Data) + case TypeCanPostStoryResultActiveStoryLimitExceeded: + return UnmarshalCanPostStoryResultActiveStoryLimitExceeded(result.Data) - case TypeCanSendStoryResultWeeklyLimitExceeded: - return UnmarshalCanSendStoryResultWeeklyLimitExceeded(result.Data) + case TypeCanPostStoryResultWeeklyLimitExceeded: + return UnmarshalCanPostStoryResultWeeklyLimitExceeded(result.Data) - case TypeCanSendStoryResultMonthlyLimitExceeded: - return UnmarshalCanSendStoryResultMonthlyLimitExceeded(result.Data) + case TypeCanPostStoryResultMonthlyLimitExceeded: + return UnmarshalCanPostStoryResultMonthlyLimitExceeded(result.Data) default: return nil, errors.New("invalid type") } } -type SendStoryRequest struct { +type PostStoryRequest struct { // Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user ChatId int64 `json:"chat_id"` // Content of the story @@ -11428,7 +11431,7 @@ type SendStoryRequest struct { Areas *InputStoryAreas `json:"areas"` // Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") Caption *FormattedText `json:"caption"` - // The privacy settings for the story; ignored for stories sent to supergroup and channel chats + // The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats PrivacySettings StoryPrivacySettings `json:"privacy_settings"` // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise ActivePeriod int32 `json:"active_period"` @@ -11440,11 +11443,11 @@ type SendStoryRequest struct { ProtectContent bool `json:"protect_content"` } -// Sends a new story to a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story -func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { +// Posts a new story on behalf of a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story +func (client *Client) PostStory(req *PostStoryRequest) (*Story, error) { result, err := client.Send(Request{ meta: meta{ - Type: "sendStory", + Type: "postStory", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -11471,7 +11474,7 @@ func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { type EditStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story to edit StoryId int32 `json:"story_id"` // New content of the story; pass null to keep the current content @@ -11489,7 +11492,7 @@ func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { Type: "editStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "content": req.Content, "areas": req.Areas, @@ -11509,7 +11512,7 @@ func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { type EditStoryCoverRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story to edit StoryId int32 `json:"story_id"` // New timestamp of the frame, which will be used as video thumbnail @@ -11523,7 +11526,7 @@ func (client *Client) EditStoryCover(req *EditStoryCoverRequest) (*Ok, error) { Type: "editStoryCover", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "cover_frame_timestamp": req.CoverFrameTimestamp, }, @@ -11570,7 +11573,7 @@ func (client *Client) SetStoryPrivacySettings(req *SetStoryPrivacySettingsReques type ToggleStoryIsPostedToChatPageRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story StoryId int32 `json:"story_id"` // Pass true to make the story accessible after expiration; pass false to make it private @@ -11584,7 +11587,7 @@ func (client *Client) ToggleStoryIsPostedToChatPage(req *ToggleStoryIsPostedToCh Type: "toggleStoryIsPostedToChatPage", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "is_posted_to_chat_page": req.IsPostedToChatPage, }, @@ -11602,19 +11605,19 @@ func (client *Client) ToggleStoryIsPostedToChatPage(req *ToggleStoryIsPostedToCh type DeleteStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story to delete StoryId int32 `json:"story_id"` } -// Deletes a previously sent story. Can be called only if story.can_be_deleted == true +// Deletes a previously posted story. Can be called only if story.can_be_deleted == true func (client *Client) DeleteStory(req *DeleteStoryRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "deleteStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, }, }) @@ -11653,7 +11656,7 @@ type LoadActiveStoriesRequest struct { StoryList StoryList `json:"story_list"` } -// Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by the pair (active_stories.order, active_stories.story_sender_chat_id) in descending order. Returns a 404 error if all active stories have been loaded +// Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by the pair (active_stories.order, active_stories.story_poster_chat_id) in descending order. Returns a 404 error if all active stories have been loaded func (client *Client) LoadActiveStories(req *LoadActiveStoriesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11823,8 +11826,8 @@ func (client *Client) SetChatPinnedStories(req *SetChatPinnedStoriesRequest) (*O } type OpenStoryRequest struct { - // The identifier of the sender of the opened story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the chat that posted the opened story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -11836,7 +11839,7 @@ func (client *Client) OpenStory(req *OpenStoryRequest) (*Ok, error) { Type: "openStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, }, }) @@ -11852,8 +11855,8 @@ func (client *Client) OpenStory(req *OpenStoryRequest) (*Ok, error) { } type CloseStoryRequest struct { - // The identifier of the sender of the story to close - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story to close + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -11865,7 +11868,7 @@ func (client *Client) CloseStory(req *CloseStoryRequest) (*Ok, error) { Type: "closeStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, }, }) @@ -11907,8 +11910,8 @@ func (client *Client) GetStoryAvailableReactions(req *GetStoryAvailableReactions } type SetStoryReactionRequest struct { - // The identifier of the sender of the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` // Type of the reaction to set; pass null to remove the reaction. Custom emoji reactions can be used only by Telegram Premium users. Paid reactions can't be set @@ -11924,7 +11927,7 @@ func (client *Client) SetStoryReaction(req *SetStoryReactionRequest) (*Ok, error Type: "setStoryReaction", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "reaction_type": req.ReactionType, "update_recent_reactions": req.UpdateRecentReactions, @@ -11986,8 +11989,8 @@ func (client *Client) GetStoryInteractions(req *GetStoryInteractionsRequest) (*S } type GetChatStoryInteractionsRequest struct { - // The identifier of the sender of the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` // Pass the default heart reaction or a suggested reaction type to receive only interactions with the specified reaction type; pass null to receive all interactions; reactionTypePaid isn't supported @@ -12007,7 +12010,7 @@ func (client *Client) GetChatStoryInteractions(req *GetChatStoryInteractionsRequ Type: "getChatStoryInteractions", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "reaction_type": req.ReactionType, "prefer_forwards": req.PreferForwards, @@ -12027,8 +12030,8 @@ func (client *Client) GetChatStoryInteractions(req *GetChatStoryInteractionsRequ } type ReportStoryRequest struct { - // The identifier of the sender of the story to report - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story to report + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story to report StoryId int32 `json:"story_id"` // Option identifier chosen by the user; leave empty for the initial request @@ -12044,7 +12047,7 @@ func (client *Client) ReportStory(req *ReportStoryRequest) (ReportStoryResult, e Type: "reportStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "option_id": req.OptionId, "text": req.Text, @@ -12093,8 +12096,8 @@ func (client *Client) ActivateStoryStealthMode() (*Ok, error) { } type GetStoryPublicForwardsRequest struct { - // The identifier of the sender of the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -12110,7 +12113,7 @@ func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) Type: "getStoryPublicForwards", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "offset": req.Offset, "limit": req.Limit, @@ -12868,7 +12871,7 @@ type ReadFilePartRequest struct { } // Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct read from the file -func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*FilePart, error) { +func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*Data, error) { result, err := client.Send(Request{ meta: meta{ Type: "readFilePart", @@ -12887,7 +12890,7 @@ func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*FilePart, error) return nil, buildResponseError(result.Data) } - return UnmarshalFilePart(result.Data) + return UnmarshalData(result.Data) } type DeleteFileRequest struct { @@ -13781,8 +13784,6 @@ type CreateCallRequest struct { Protocol *CallProtocol `json:"protocol"` // Pass true to create a video call IsVideo bool `json:"is_video"` - // Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none - GroupCallId int32 `json:"group_call_id"` } // Creates a new call @@ -13795,7 +13796,6 @@ func (client *Client) CreateCall(req *CreateCallRequest) (*CallId, error) { "user_id": req.UserId, "protocol": req.Protocol, "is_video": req.IsVideo, - "group_call_id": req.GroupCallId, }, }) if err != nil { @@ -13872,6 +13872,8 @@ type DiscardCallRequest struct { CallId int32 `json:"call_id"` // Pass true if the user was disconnected IsDisconnected bool `json:"is_disconnected"` + // If the call was upgraded to a group call, pass invite link to the group call + InviteLink string `json:"invite_link"` // The call duration, in seconds Duration int32 `json:"duration"` // Pass true if the call was a video call @@ -13889,6 +13891,7 @@ func (client *Client) DiscardCall(req *DiscardCallRequest) (*Ok, error) { Data: map[string]interface{}{ "call_id": req.CallId, "is_disconnected": req.IsDisconnected, + "invite_link": req.InviteLink, "duration": req.Duration, "is_video": req.IsVideo, "connection_id": req.ConnectionId, @@ -14089,18 +14092,18 @@ func (client *Client) CreateVideoChat(req *CreateVideoChatRequest) (*GroupCallId } type CreateGroupCallRequest struct { - // Call identifier - CallId int32 `json:"call_id"` + // Parameters to join the call; pass null to only create call link without joining the call + JoinParameters *GroupCallJoinParameters `json:"join_parameters"` } -// Creates a group call from a one-to-one call -func (client *Client) CreateGroupCall(req *CreateGroupCallRequest) (*Ok, error) { +// Creates a new group call that isn't bound to a chat +func (client *Client) CreateGroupCall(req *CreateGroupCallRequest) (*GroupCallInfo, error) { result, err := client.Send(Request{ meta: meta{ Type: "createGroupCall", }, Data: map[string]interface{}{ - "call_id": req.CallId, + "join_parameters": req.JoinParameters, }, }) if err != nil { @@ -14111,7 +14114,7 @@ func (client *Client) CreateGroupCall(req *CreateGroupCallRequest) (*Ok, error) return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + return UnmarshalGroupCallInfo(result.Data) } type GetVideoChatRtmpUrlRequest struct { @@ -14119,7 +14122,7 @@ type GetVideoChatRtmpUrlRequest struct { ChatId int64 `json:"chat_id"` } -// Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right +// Returns RTMP URL for streaming to the video chat of a chat; requires can_manage_video_chats administrator right func (client *Client) GetVideoChatRtmpUrl(req *GetVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -14145,7 +14148,7 @@ type ReplaceVideoChatRtmpUrlRequest struct { ChatId int64 `json:"chat_id"` } -// Replaces the current RTMP URL for streaming to the chat; requires owner privileges +// Replaces the current RTMP URL for streaming to the video chat of a chat; requires owner privileges in the chat func (client *Client) ReplaceVideoChatRtmpUrl(req *ReplaceVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -14192,16 +14195,16 @@ func (client *Client) GetGroupCall(req *GetGroupCallRequest) (*GroupCall, error) return UnmarshalGroupCall(result.Data) } -type StartScheduledGroupCallRequest struct { - // Group call identifier +type StartScheduledVideoChatRequest struct { + // Group call identifier of the video chat GroupCallId int32 `json:"group_call_id"` } -// Starts a scheduled group call -func (client *Client) StartScheduledGroupCall(req *StartScheduledGroupCallRequest) (*Ok, error) { +// Starts a scheduled video chat +func (client *Client) StartScheduledVideoChat(req *StartScheduledVideoChatRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "startScheduledGroupCall", + Type: "startScheduledVideoChat", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14218,18 +14221,18 @@ func (client *Client) StartScheduledGroupCall(req *StartScheduledGroupCallReques return UnmarshalOk(result.Data) } -type ToggleGroupCallEnabledStartNotificationRequest struct { +type ToggleVideoChatEnabledStartNotificationRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // New value of the enabled_start_notification setting EnabledStartNotification bool `json:"enabled_start_notification"` } -// Toggles whether the current user will receive a notification when the group call starts; scheduled group calls only -func (client *Client) ToggleGroupCallEnabledStartNotification(req *ToggleGroupCallEnabledStartNotificationRequest) (*Ok, error) { +// Toggles whether the current user will receive a notification when the video chat starts; for scheduled video chats only +func (client *Client) ToggleVideoChatEnabledStartNotification(req *ToggleVideoChatEnabledStartNotificationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "toggleGroupCallEnabledStartNotification", + Type: "toggleVideoChatEnabledStartNotification", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14248,39 +14251,56 @@ func (client *Client) ToggleGroupCallEnabledStartNotification(req *ToggleGroupCa } type JoinGroupCallRequest struct { - // Group call identifier - GroupCallId int32 `json:"group_call_id"` - // Identifier of a group call participant, which will be used to join the call; pass null to join as self; video chats only - ParticipantId MessageSender `json:"participant_id"` - // Caller audio channel synchronization source identifier; received from tgcalls - AudioSourceId int32 `json:"audio_source_id"` - // Group call join payload; received from tgcalls - Payload string `json:"payload"` - // Pass true to join the call with muted microphone - IsMuted bool `json:"is_muted"` - // Pass true if the user's video is enabled - IsMyVideoEnabled bool `json:"is_my_video_enabled"` - // If non-empty, invite hash to be used to join the group call without being muted by administrators - InviteHash string `json:"invite_hash"` - // Fingerprint of the encryption key for E2E group calls not bound to a chat; pass 0 for voice chats - KeyFingerprint JsonInt64 `json:"key_fingerprint"` + // The group call to join + InputGroupCall InputGroupCall `json:"input_group_call"` + // Parameters to join the call + JoinParameters *GroupCallJoinParameters `json:"join_parameters"` } -// Joins an active group call. Returns join response payload for tgcalls -func (client *Client) JoinGroupCall(req *JoinGroupCallRequest) (*Text, error) { +// Joins a group call that is not bound to a chat +func (client *Client) JoinGroupCall(req *JoinGroupCallRequest) (*GroupCallInfo, error) { result, err := client.Send(Request{ meta: meta{ Type: "joinGroupCall", }, + Data: map[string]interface{}{ + "input_group_call": req.InputGroupCall, + "join_parameters": req.JoinParameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGroupCallInfo(result.Data) +} + +type JoinVideoChatRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Identifier of a group call participant, which will be used to join the call; pass null to join as self; video chats only + ParticipantId MessageSender `json:"participant_id"` + // Parameters to join the call + JoinParameters *GroupCallJoinParameters `json:"join_parameters"` + // Invite hash as received from internalLinkTypeVideoChat + InviteHash string `json:"invite_hash"` +} + +// Joins an active video chat. Returns join response payload for tgcalls +func (client *Client) JoinVideoChat(req *JoinVideoChatRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "joinVideoChat", + }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, "participant_id": req.ParticipantId, - "audio_source_id": req.AudioSourceId, - "payload": req.Payload, - "is_muted": req.IsMuted, - "is_my_video_enabled": req.IsMyVideoEnabled, + "join_parameters": req.JoinParameters, "invite_hash": req.InviteHash, - "key_fingerprint": req.KeyFingerprint, }, }) if err != nil { @@ -14381,18 +14401,18 @@ func (client *Client) EndGroupCallScreenSharing(req *EndGroupCallScreenSharingRe return UnmarshalOk(result.Data) } -type SetGroupCallTitleRequest struct { +type SetVideoChatTitleRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // New group call title; 1-64 characters Title string `json:"title"` } -// Sets group call title. Requires groupCall.can_be_managed group call flag -func (client *Client) SetGroupCallTitle(req *SetGroupCallTitleRequest) (*Ok, error) { +// Sets title of a video chat; requires groupCall.can_be_managed right +func (client *Client) SetVideoChatTitle(req *SetVideoChatTitleRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "setGroupCallTitle", + Type: "setVideoChatTitle", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14410,18 +14430,18 @@ func (client *Client) SetGroupCallTitle(req *SetGroupCallTitleRequest) (*Ok, err return UnmarshalOk(result.Data) } -type ToggleGroupCallMuteNewParticipantsRequest struct { +type ToggleVideoChatMuteNewParticipantsRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // New value of the mute_new_participants setting MuteNewParticipants bool `json:"mute_new_participants"` } -// Toggles whether new participants of a group call can be unmuted only by administrators of the group call. Requires groupCall.can_toggle_mute_new_participants group call flag -func (client *Client) ToggleGroupCallMuteNewParticipants(req *ToggleGroupCallMuteNewParticipantsRequest) (*Ok, error) { +// Toggles whether new participants of a video chat can be unmuted only by administrators of the video chat. Requires groupCall.can_toggle_mute_new_participants right +func (client *Client) ToggleVideoChatMuteNewParticipants(req *ToggleVideoChatMuteNewParticipantsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "toggleGroupCallMuteNewParticipants", + Type: "toggleVideoChatMuteNewParticipants", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14439,18 +14459,94 @@ func (client *Client) ToggleGroupCallMuteNewParticipants(req *ToggleGroupCallMut return UnmarshalOk(result.Data) } -type InviteGroupCallParticipantsRequest struct { +type InviteGroupCallParticipantRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` - // User identifiers. At most 10 users can be invited simultaneously - UserIds []int64 `json:"user_ids"` + // User identifier + UserId int64 `json:"user_id"` + // Pass true if the group call is a video call + IsVideo bool `json:"is_video"` } -// Invites users to an active group call. Sends a service message of type messageInviteVideoChatParticipants for video chats -func (client *Client) InviteGroupCallParticipants(req *InviteGroupCallParticipantsRequest) (*Ok, error) { +// Invites a user to an active group call; for group calls not bound to a chat only. Sends a service message of the type messageGroupCall. The group call can have at most getOption("group_call_participant_count_max") participants +func (client *Client) InviteGroupCallParticipant(req *InviteGroupCallParticipantRequest) (InviteGroupCallParticipantResult, error) { result, err := client.Send(Request{ meta: meta{ - Type: "inviteGroupCallParticipants", + Type: "inviteGroupCallParticipant", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "user_id": req.UserId, + "is_video": req.IsVideo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeInviteGroupCallParticipantResultUserPrivacyRestricted: + return UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(result.Data) + + case TypeInviteGroupCallParticipantResultUserAlreadyParticipant: + return UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(result.Data) + + case TypeInviteGroupCallParticipantResultUserWasBanned: + return UnmarshalInviteGroupCallParticipantResultUserWasBanned(result.Data) + + case TypeInviteGroupCallParticipantResultSuccess: + return UnmarshalInviteGroupCallParticipantResultSuccess(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type DeclineGroupCallInvitationRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message of the type messageGroupCall + MessageId int64 `json:"message_id"` +} + +// Declines an invitation to an active group call via messageGroupCall. Can be called both by the sender and the receiver of the invitation +func (client *Client) DeclineGroupCallInvitation(req *DeclineGroupCallInvitationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "declineGroupCallInvitation", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type BanGroupCallParticipantsRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Identifiers of group call participants to ban; identifiers of unknown users from the update updateGroupCallParticipants can be also passed to the method + UserIds []JsonInt64 `json:"user_ids"` +} + +// Bans users from a group call not bound to a chat; requires groupCall.is_owned. Only the owner of the group call can invite the banned users back +func (client *Client) BanGroupCallParticipants(req *BanGroupCallParticipantsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "banGroupCallParticipants", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14468,18 +14564,47 @@ func (client *Client) InviteGroupCallParticipants(req *InviteGroupCallParticipan return UnmarshalOk(result.Data) } -type GetGroupCallInviteLinkRequest struct { +type InviteVideoChatParticipantsRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` - // Pass true if the invite link needs to contain an invite hash, passing which to joinGroupCall would allow the invited user to unmute themselves. Requires groupCall.can_be_managed group call flag + // User identifiers. At most 10 users can be invited simultaneously + UserIds []int64 `json:"user_ids"` +} + +// Invites users to an active video chat. Sends a service message of the type messageInviteVideoChatParticipants to the chat bound to the group call +func (client *Client) InviteVideoChatParticipants(req *InviteVideoChatParticipantsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "inviteVideoChatParticipants", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "user_ids": req.UserIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetVideoChatInviteLinkRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Pass true if the invite link needs to contain an invite hash, passing which to joinVideoChat would allow the invited user to unmute themselves. Requires groupCall.can_be_managed right CanSelfUnmute bool `json:"can_self_unmute"` } // Returns invite link to a video chat in a public chat -func (client *Client) GetGroupCallInviteLink(req *GetGroupCallInviteLinkRequest) (*HttpUrl, error) { +func (client *Client) GetVideoChatInviteLink(req *GetVideoChatInviteLinkRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getGroupCallInviteLink", + Type: "getVideoChatInviteLink", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14502,7 +14627,7 @@ type RevokeGroupCallInviteLinkRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Revokes invite link for a group call. Requires groupCall.can_be_managed group call flag +// Revokes invite link for a group call. Requires groupCall.can_be_managed right for video chats or groupCall.is_owned otherwise func (client *Client) RevokeGroupCallInviteLink(req *RevokeGroupCallInviteLinkRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14534,7 +14659,7 @@ type StartGroupCallRecordingRequest struct { UsePortraitOrientation bool `json:"use_portrait_orientation"` } -// Starts recording of an active group call. Requires groupCall.can_be_managed group call flag +// Starts recording of an active group call; for video chats only. Requires groupCall.can_be_managed right func (client *Client) StartGroupCallRecording(req *StartGroupCallRecordingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14563,7 +14688,7 @@ type EndGroupCallRecordingRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Ends recording of an active group call. Requires groupCall.can_be_managed group call flag +// Ends recording of an active group call; for video chats only. Requires groupCall.can_be_managed right func (client *Client) EndGroupCallRecording(req *EndGroupCallRecordingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14651,7 +14776,7 @@ type SetGroupCallParticipantIsSpeakingRequest struct { IsSpeaking bool `json:"is_speaking"` } -// Informs TDLib that speaking state of a participant of an active group has changed +// Informs TDLib that speaking state of a participant of an active group call has changed func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallParticipantIsSpeakingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14715,7 +14840,7 @@ type SetGroupCallParticipantVolumeLevelRequest struct { VolumeLevel int32 `json:"volume_level"` } -// Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant's volume level will be changed for all users with the default volume level +// Changes volume level of a participant of an active group call. If the current user can manage the group call or is the owner of the group call, then the participant's volume level will be changed for all users with the default volume level func (client *Client) SetGroupCallParticipantVolumeLevel(req *SetGroupCallParticipantVolumeLevelRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14743,11 +14868,11 @@ type ToggleGroupCallParticipantIsHandRaisedRequest struct { GroupCallId int32 `json:"group_call_id"` // Participant identifier ParticipantId MessageSender `json:"participant_id"` - // Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed group call flag to lower other's hand + // Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed right to lower other's hand IsHandRaised bool `json:"is_hand_raised"` } -// Toggles whether a group call participant hand is rased +// Toggles whether a group call participant hand is rased; for video chats only func (client *Client) ToggleGroupCallParticipantIsHandRaised(req *ToggleGroupCallParticipantIsHandRaisedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14770,6 +14895,35 @@ func (client *Client) ToggleGroupCallParticipantIsHandRaised(req *ToggleGroupCal return UnmarshalOk(result.Data) } +type GetGroupCallParticipantsRequest struct { + // The group call which participants will be returned + InputGroupCall InputGroupCall `json:"input_group_call"` + // The maximum number of participants to return; must be positive + Limit int32 `json:"limit"` +} + +// Returns information about participants of a non-joined group call that is not bound to a chat +func (client *Client) GetGroupCallParticipants(req *GetGroupCallParticipantsRequest) (*GroupCallParticipants, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGroupCallParticipants", + }, + Data: map[string]interface{}{ + "input_group_call": req.InputGroupCall, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGroupCallParticipants(result.Data) +} + type LoadGroupCallParticipantsRequest struct { // Group call identifier. The group call must be previously received through getGroupCall and must be joined or being joined GroupCallId int32 `json:"group_call_id"` @@ -14830,7 +14984,7 @@ type EndGroupCallRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Ends a group call. Requires groupCall.can_be_managed +// Ends a group call. Requires groupCall.can_be_managed right for video chats or groupCall.is_owned otherwise func (client *Client) EndGroupCall(req *EndGroupCallRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14851,16 +15005,16 @@ func (client *Client) EndGroupCall(req *EndGroupCallRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -type GetGroupCallStreamsRequest struct { +type GetVideoChatStreamsRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` } -// Returns information about available group call streams -func (client *Client) GetGroupCallStreams(req *GetGroupCallStreamsRequest) (*GroupCallStreams, error) { +// Returns information about available video chat streams +func (client *Client) GetVideoChatStreams(req *GetVideoChatStreamsRequest) (*VideoChatStreams, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getGroupCallStreams", + Type: "getVideoChatStreams", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14874,10 +15028,10 @@ func (client *Client) GetGroupCallStreams(req *GetGroupCallStreamsRequest) (*Gro return nil, buildResponseError(result.Data) } - return UnmarshalGroupCallStreams(result.Data) + return UnmarshalVideoChatStreams(result.Data) } -type GetGroupCallStreamSegmentRequest struct { +type GetVideoChatStreamSegmentRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // Point in time when the stream segment begins; Unix timestamp in milliseconds @@ -14890,11 +15044,11 @@ type GetGroupCallStreamSegmentRequest struct { VideoQuality GroupCallVideoQuality `json:"video_quality"` } -// Returns a file with a segment of a group call stream in a modified OGG format for audio or MPEG-4 format for video -func (client *Client) GetGroupCallStreamSegment(req *GetGroupCallStreamSegmentRequest) (*FilePart, error) { +// Returns a file with a segment of a video chat stream in a modified OGG format for audio or MPEG-4 format for video +func (client *Client) GetVideoChatStreamSegment(req *GetVideoChatStreamSegmentRequest) (*Data, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getGroupCallStreamSegment", + Type: "getVideoChatStreamSegment", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -14912,7 +15066,77 @@ func (client *Client) GetGroupCallStreamSegment(req *GetGroupCallStreamSegmentRe return nil, buildResponseError(result.Data) } - return UnmarshalFilePart(result.Data) + return UnmarshalData(result.Data) +} + +type EncryptGroupCallDataRequest struct { + // Group call identifier. The call must not be a video chat + GroupCallId int32 `json:"group_call_id"` + // Data channel for which data is encrypted + DataChannel GroupCallDataChannel `json:"data_channel"` + // Data to encrypt + Data []byte `json:"data"` + // Size of data prefix that must be kept unencrypted + UnencryptedPrefixSize int32 `json:"unencrypted_prefix_size"` +} + +// Encrypts group call data before sending them over network using tgcalls +func (client *Client) EncryptGroupCallData(req *EncryptGroupCallDataRequest) (*Data, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "encryptGroupCallData", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "data_channel": req.DataChannel, + "data": req.Data, + "unencrypted_prefix_size": req.UnencryptedPrefixSize, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalData(result.Data) +} + +type DecryptGroupCallDataRequest struct { + // Group call identifier. The call must not be a video chat + GroupCallId int32 `json:"group_call_id"` + // Identifier of the group call participant, which sent the data + ParticipantId MessageSender `json:"participant_id"` + // Data channel for which data was encrypted; pass null if unknown + DataChannel GroupCallDataChannel `json:"data_channel"` + // Data to decrypt + Data []byte `json:"data"` +} + +// Decrypts group call data received by tgcalls +func (client *Client) DecryptGroupCallData(req *DecryptGroupCallDataRequest) (*Data, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "decryptGroupCallData", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "participant_id": req.ParticipantId, + "data_channel": req.DataChannel, + "data": req.Data, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalData(result.Data) } type SetMessageSenderBlockListRequest struct { @@ -25121,6 +25345,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateGroupCallParticipant: return UnmarshalUpdateGroupCallParticipant(result.Data) + case TypeUpdateGroupCallParticipants: + return UnmarshalUpdateGroupCallParticipants(result.Data) + + case TypeUpdateGroupCallVerificationState: + return UnmarshalUpdateGroupCallVerificationState(result.Data) + case TypeUpdateNewCallSignalingData: return UnmarshalUpdateNewCallSignalingData(result.Data) @@ -25139,11 +25369,11 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateStoryDeleted: return UnmarshalUpdateStoryDeleted(result.Data) - case TypeUpdateStorySendSucceeded: - return UnmarshalUpdateStorySendSucceeded(result.Data) + case TypeUpdateStoryPostSucceeded: + return UnmarshalUpdateStoryPostSucceeded(result.Data) - case TypeUpdateStorySendFailed: - return UnmarshalUpdateStorySendFailed(result.Data) + case TypeUpdateStoryPostFailed: + return UnmarshalUpdateStoryPostFailed(result.Data) case TypeUpdateChatActiveStories: return UnmarshalUpdateChatActiveStories(result.Data) diff --git a/client/type.go b/client/type.go index 22df51f..1848a98 100755 --- a/client/type.go +++ b/client/type.go @@ -107,6 +107,9 @@ const ( ClassCallServerType = "CallServerType" ClassCallState = "CallState" ClassGroupCallVideoQuality = "GroupCallVideoQuality" + ClassInviteGroupCallParticipantResult = "InviteGroupCallParticipantResult" + ClassGroupCallDataChannel = "GroupCallDataChannel" + ClassInputGroupCall = "InputGroupCall" ClassCallProblem = "CallProblem" ClassFirebaseAuthenticationSettings = "FirebaseAuthenticationSettings" ClassReactionUnavailabilityReason = "ReactionUnavailabilityReason" @@ -132,7 +135,7 @@ const ( ClassBackgroundFill = "BackgroundFill" ClassBackgroundType = "BackgroundType" ClassInputBackground = "InputBackground" - ClassCanSendStoryResult = "CanSendStoryResult" + ClassCanPostStoryResult = "CanPostStoryResult" ClassCanTransferOwnershipResult = "CanTransferOwnershipResult" ClassCheckChatUsernameResult = "CheckChatUsernameResult" ClassCheckStickerSetNameResult = "CheckStickerSetNameResult" @@ -488,14 +491,17 @@ const ( ClassCallServer = "CallServer" ClassCallId = "CallId" ClassGroupCallId = "GroupCallId" - ClassGroupCallStream = "GroupCallStream" - ClassGroupCallStreams = "GroupCallStreams" + ClassGroupCallJoinParameters = "GroupCallJoinParameters" + ClassVideoChatStream = "VideoChatStream" + ClassVideoChatStreams = "VideoChatStreams" ClassRtmpUrl = "RtmpUrl" ClassGroupCallRecentSpeaker = "GroupCallRecentSpeaker" ClassGroupCall = "GroupCall" ClassGroupCallVideoSourceGroup = "GroupCallVideoSourceGroup" ClassGroupCallParticipantVideoInfo = "GroupCallParticipantVideoInfo" ClassGroupCallParticipant = "GroupCallParticipant" + ClassGroupCallParticipants = "GroupCallParticipants" + ClassGroupCallInfo = "GroupCallInfo" ClassCall = "Call" ClassPhoneNumberAuthenticationSettings = "PhoneNumberAuthenticationSettings" ClassAddedReaction = "AddedReaction" @@ -557,7 +563,6 @@ const ( ClassMessageLinkInfo = "MessageLinkInfo" ClassChatBoostLink = "ChatBoostLink" ClassChatBoostLinkInfo = "ChatBoostLinkInfo" - ClassFilePart = "FilePart" ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" ClassStorageStatisticsByChat = "StorageStatisticsByChat" ClassStorageStatistics = "StorageStatistics" @@ -575,6 +580,7 @@ const ( ClassTMeUrls = "TMeUrls" ClassCount = "Count" ClassText = "Text" + ClassData = "Data" ClassSeconds = "Seconds" ClassFileDownloadedPrefixSize = "FileDownloadedPrefixSize" ClassStarCount = "StarCount" @@ -1154,6 +1160,7 @@ const ( TypeLinkPreviewTypeEmbeddedVideoPlayer = "linkPreviewTypeEmbeddedVideoPlayer" TypeLinkPreviewTypeExternalAudio = "linkPreviewTypeExternalAudio" TypeLinkPreviewTypeExternalVideo = "linkPreviewTypeExternalVideo" + TypeLinkPreviewTypeGroupCall = "linkPreviewTypeGroupCall" TypeLinkPreviewTypeInvoice = "linkPreviewTypeInvoice" TypeLinkPreviewTypeMessage = "linkPreviewTypeMessage" TypeLinkPreviewTypePhoto = "linkPreviewTypePhoto" @@ -1310,6 +1317,7 @@ const ( TypeMessageStory = "messageStory" TypeMessageInvoice = "messageInvoice" TypeMessageCall = "messageCall" + TypeMessageGroupCall = "messageGroupCall" TypeMessageVideoChatScheduled = "messageVideoChatScheduled" TypeMessageVideoChatStarted = "messageVideoChatStarted" TypeMessageVideoChatEnded = "messageVideoChatEnded" @@ -1544,7 +1552,7 @@ const ( TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected" TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp" - TypeCallDiscardReasonAllowGroupCall = "callDiscardReasonAllowGroupCall" + TypeCallDiscardReasonUpgradeToGroupCall = "callDiscardReasonUpgradeToGroupCall" TypeCallProtocol = "callProtocol" TypeCallServerTypeTelegramReflector = "callServerTypeTelegramReflector" TypeCallServerTypeWebrtc = "callServerTypeWebrtc" @@ -1557,17 +1565,28 @@ const ( TypeCallStateHangingUp = "callStateHangingUp" TypeCallStateDiscarded = "callStateDiscarded" TypeCallStateError = "callStateError" + TypeGroupCallJoinParameters = "groupCallJoinParameters" TypeGroupCallVideoQualityThumbnail = "groupCallVideoQualityThumbnail" TypeGroupCallVideoQualityMedium = "groupCallVideoQualityMedium" TypeGroupCallVideoQualityFull = "groupCallVideoQualityFull" - TypeGroupCallStream = "groupCallStream" - TypeGroupCallStreams = "groupCallStreams" + TypeVideoChatStream = "videoChatStream" + TypeVideoChatStreams = "videoChatStreams" TypeRtmpUrl = "rtmpUrl" TypeGroupCallRecentSpeaker = "groupCallRecentSpeaker" TypeGroupCall = "groupCall" TypeGroupCallVideoSourceGroup = "groupCallVideoSourceGroup" TypeGroupCallParticipantVideoInfo = "groupCallParticipantVideoInfo" TypeGroupCallParticipant = "groupCallParticipant" + TypeGroupCallParticipants = "groupCallParticipants" + TypeGroupCallInfo = "groupCallInfo" + TypeInviteGroupCallParticipantResultUserPrivacyRestricted = "inviteGroupCallParticipantResultUserPrivacyRestricted" + TypeInviteGroupCallParticipantResultUserAlreadyParticipant = "inviteGroupCallParticipantResultUserAlreadyParticipant" + TypeInviteGroupCallParticipantResultUserWasBanned = "inviteGroupCallParticipantResultUserWasBanned" + TypeInviteGroupCallParticipantResultSuccess = "inviteGroupCallParticipantResultSuccess" + TypeGroupCallDataChannelMain = "groupCallDataChannelMain" + TypeGroupCallDataChannelScreenSharing = "groupCallDataChannelScreenSharing" + TypeInputGroupCallLink = "inputGroupCallLink" + TypeInputGroupCallMessage = "inputGroupCallMessage" TypeCallProblemEcho = "callProblemEcho" TypeCallProblemNoise = "callProblemNoise" TypeCallProblemInterruptions = "callProblemInterruptions" @@ -1721,8 +1740,8 @@ const ( TypePremiumLimitTypeChatFolderInviteLinkCount = "premiumLimitTypeChatFolderInviteLinkCount" TypePremiumLimitTypeShareableChatFolderCount = "premiumLimitTypeShareableChatFolderCount" TypePremiumLimitTypeActiveStoryCount = "premiumLimitTypeActiveStoryCount" - TypePremiumLimitTypeWeeklySentStoryCount = "premiumLimitTypeWeeklySentStoryCount" - TypePremiumLimitTypeMonthlySentStoryCount = "premiumLimitTypeMonthlySentStoryCount" + TypePremiumLimitTypeWeeklyPostedStoryCount = "premiumLimitTypeWeeklyPostedStoryCount" + TypePremiumLimitTypeMonthlyPostedStoryCount = "premiumLimitTypeMonthlyPostedStoryCount" TypePremiumLimitTypeStoryCaptionLength = "premiumLimitTypeStoryCaptionLength" TypePremiumLimitTypeStorySuggestedReactionAreaCount = "premiumLimitTypeStorySuggestedReactionAreaCount" TypePremiumLimitTypeSimilarChatCount = "premiumLimitTypeSimilarChatCount" @@ -1823,12 +1842,12 @@ const ( TypeTimeZone = "timeZone" TypeTimeZones = "timeZones" TypeHashtags = "hashtags" - TypeCanSendStoryResultOk = "canSendStoryResultOk" - TypeCanSendStoryResultPremiumNeeded = "canSendStoryResultPremiumNeeded" - TypeCanSendStoryResultBoostNeeded = "canSendStoryResultBoostNeeded" - TypeCanSendStoryResultActiveStoryLimitExceeded = "canSendStoryResultActiveStoryLimitExceeded" - TypeCanSendStoryResultWeeklyLimitExceeded = "canSendStoryResultWeeklyLimitExceeded" - TypeCanSendStoryResultMonthlyLimitExceeded = "canSendStoryResultMonthlyLimitExceeded" + TypeCanPostStoryResultOk = "canPostStoryResultOk" + TypeCanPostStoryResultPremiumNeeded = "canPostStoryResultPremiumNeeded" + TypeCanPostStoryResultBoostNeeded = "canPostStoryResultBoostNeeded" + TypeCanPostStoryResultActiveStoryLimitExceeded = "canPostStoryResultActiveStoryLimitExceeded" + TypeCanPostStoryResultWeeklyLimitExceeded = "canPostStoryResultWeeklyLimitExceeded" + TypeCanPostStoryResultMonthlyLimitExceeded = "canPostStoryResultMonthlyLimitExceeded" TypeCanTransferOwnershipResultOk = "canTransferOwnershipResultOk" TypeCanTransferOwnershipResultPasswordNeeded = "canTransferOwnershipResultPasswordNeeded" TypeCanTransferOwnershipResultPasswordTooFresh = "canTransferOwnershipResultPasswordTooFresh" @@ -2006,6 +2025,7 @@ const ( TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings = "internalLinkTypeDefaultMessageAutoDeleteTimerSettings" TypeInternalLinkTypeEditProfileSettings = "internalLinkTypeEditProfileSettings" TypeInternalLinkTypeGame = "internalLinkTypeGame" + TypeInternalLinkTypeGroupCall = "internalLinkTypeGroupCall" TypeInternalLinkTypeInstantView = "internalLinkTypeInstantView" TypeInternalLinkTypeInvoice = "internalLinkTypeInvoice" TypeInternalLinkTypeLanguagePack = "internalLinkTypeLanguagePack" @@ -2041,7 +2061,6 @@ const ( TypeChatBoostLinkInfo = "chatBoostLinkInfo" TypeBlockListMain = "blockListMain" TypeBlockListStories = "blockListStories" - TypeFilePart = "filePart" TypeFileTypeNone = "fileTypeNone" TypeFileTypeAnimation = "fileTypeAnimation" TypeFileTypeAudio = "fileTypeAudio" @@ -2124,6 +2143,7 @@ const ( TypeSuggestedActionExtendStarSubscriptions = "suggestedActionExtendStarSubscriptions" TypeCount = "count" TypeText = "text" + TypeData = "data" TypeSeconds = "seconds" TypeFileDownloadedPrefixSize = "fileDownloadedPrefixSize" TypeStarCount = "starCount" @@ -2263,14 +2283,16 @@ const ( TypeUpdateCall = "updateCall" TypeUpdateGroupCall = "updateGroupCall" TypeUpdateGroupCallParticipant = "updateGroupCallParticipant" + TypeUpdateGroupCallParticipants = "updateGroupCallParticipants" + TypeUpdateGroupCallVerificationState = "updateGroupCallVerificationState" TypeUpdateNewCallSignalingData = "updateNewCallSignalingData" TypeUpdateUserPrivacySettingRules = "updateUserPrivacySettingRules" TypeUpdateUnreadMessageCount = "updateUnreadMessageCount" TypeUpdateUnreadChatCount = "updateUnreadChatCount" TypeUpdateStory = "updateStory" TypeUpdateStoryDeleted = "updateStoryDeleted" - TypeUpdateStorySendSucceeded = "updateStorySendSucceeded" - TypeUpdateStorySendFailed = "updateStorySendFailed" + TypeUpdateStoryPostSucceeded = "updateStoryPostSucceeded" + TypeUpdateStoryPostFailed = "updateStoryPostFailed" TypeUpdateChatActiveStories = "updateChatActiveStories" TypeUpdateStoryListChatCount = "updateStoryListChatCount" TypeUpdateStoryStealthMode = "updateStoryStealthMode" @@ -2792,7 +2814,7 @@ type StoryContent interface { StoryContentType() string } -// The content of a story to send +// The content of a story to post type InputStoryContent interface { InputStoryContentType() string } @@ -2847,6 +2869,21 @@ type GroupCallVideoQuality interface { GroupCallVideoQualityType() string } +// Describes result of group call participant invitation +type InviteGroupCallParticipantResult interface { + InviteGroupCallParticipantResultType() string +} + +// Describes data channel for a group call +type GroupCallDataChannel interface { + GroupCallDataChannelType() string +} + +// Describes a non-joined group call that isn't bound to a chat +type InputGroupCall interface { + InputGroupCallType() string +} + // Describes the exact type of problem with a call type CallProblem interface { CallProblemType() string @@ -2972,9 +3009,9 @@ type InputBackground interface { InputBackgroundType() string } -// Represents result of checking whether the current user can send a story in the specific chat -type CanSendStoryResult interface { - CanSendStoryResultType() string +// Represents result of checking whether the current user can post a story on behalf of the specific chat +type CanPostStoryResult interface { + CanPostStoryResultType() string } // Represents result of checking whether the current session can be used to transfer a chat ownership to another user @@ -6852,7 +6889,7 @@ type BusinessBotRights struct { CanTransferAndUpgradeGifts bool `json:"can_transfer_and_upgrade_gifts"` // True, if the bot can transfer Telegram Stars received by the business account to account of the bot, or use them to upgrade and transfer gifts CanTransferStars bool `json:"can_transfer_stars"` - // True, if the bot can send, edit and delete stories + // True, if the bot can post, edit and delete stories CanManageStories bool `json:"can_manage_stories"` } @@ -12671,7 +12708,7 @@ type Supergroup struct { Date int32 `json:"date"` // Status of the current user in the supergroup or channel; custom title will always be empty Status ChatMemberStatus `json:"status"` - // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards and foundStories + // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToPostStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards and foundStories MemberCount int32 `json:"member_count"` // Approximate boost level for the chat BoostLevel int32 `json:"boost_level"` @@ -14342,8 +14379,8 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e // Describes a story replied by a given message type MessageReplyToStory struct { meta - // The identifier of the sender of the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -14431,8 +14468,8 @@ func (*InputMessageReplyToExternalMessage) InputMessageReplyToType() string { // Describes a story to be replied type InputMessageReplyToStory struct { meta - // The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat and channel stories can't be replied - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story. Currently, stories can be replied only in the chat that posted the story; channel stories can't be replied + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -15674,10 +15711,10 @@ type ChatNotificationSettings struct { UseDefaultStorySound bool `json:"use_default_story_sound"` // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundId JsonInt64 `json:"story_sound_id"` - // If true, the value for the relevant type of chat is used instead of show_story_sender - UseDefaultShowStorySender bool `json:"use_default_show_story_sender"` - // True, if the sender of stories must be displayed in notifications - ShowStorySender bool `json:"show_story_sender"` + // If true, the value for the relevant type of chat is used instead of show_story_poster + UseDefaultShowStoryPoster bool `json:"use_default_show_story_poster"` + // True, if the chat that posted a story must be displayed in notifications + ShowStoryPoster bool `json:"show_story_poster"` // If true, the value for the relevant type of chat or the forum chat is used instead of disable_pinned_message_notifications UseDefaultDisablePinnedMessageNotifications bool `json:"use_default_disable_pinned_message_notifications"` // If true, notifications for incoming pinned messages will be created as for an ordinary unread message @@ -15719,8 +15756,8 @@ type ScopeNotificationSettings struct { MuteStories bool `json:"mute_stories"` // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundId JsonInt64 `json:"story_sound_id"` - // True, if the sender of stories must be displayed in notifications - ShowStorySender bool `json:"show_story_sender"` + // True, if the chat that posted a story must be displayed in notifications + ShowStoryPoster bool `json:"show_story_poster"` // True, if notifications for incoming pinned messages will be created as for an ordinary unread message DisablePinnedMessageNotifications bool `json:"disable_pinned_message_notifications"` // True, if notifications for messages with mentions will be created as for an ordinary unread message @@ -16721,7 +16758,7 @@ func (*BusinessBotManageBar) GetType() string { return TypeBusinessBotManageBar } -// Describes a video chat +// Describes a video chat, i.e. a group call bound to a chat type VideoChat struct { meta // Group call identifier of an active video chat; 0 if none. Full information about the video chat can be received through the method getGroupCall @@ -21724,6 +21761,31 @@ func (*LinkPreviewTypeExternalVideo) LinkPreviewTypeType() string { return TypeLinkPreviewTypeExternalVideo } +// The link is a link to a group call that isn't bound to a chat +type LinkPreviewTypeGroupCall struct{ + meta +} + +func (entity *LinkPreviewTypeGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeGroupCall) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeGroupCall) GetType() string { + return TypeLinkPreviewTypeGroupCall +} + +func (*LinkPreviewTypeGroupCall) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeGroupCall +} + // The link is a link to an invoice type LinkPreviewTypeInvoice struct{ meta @@ -21909,7 +21971,7 @@ func (*LinkPreviewTypeStickerSet) LinkPreviewTypeType() string { type LinkPreviewTypeStory struct { meta // The identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` } @@ -26393,7 +26455,7 @@ func (*MessagePoll) MessageContentType() string { type MessageStory struct { meta // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` // True, if the story was automatically forwarded because of a mention of the user @@ -26548,6 +26610,66 @@ func (messageCall *MessageCall) UnmarshalJSON(data []byte) error { return nil } +// A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden +type MessageGroupCall struct { + meta + // True, if the call is active, i.e. the called user joined the call + IsActive bool `json:"is_active"` + // True, if the called user missed or declined the call + WasMissed bool `json:"was_missed"` + // True, if the call is a video call + IsVideo bool `json:"is_video"` + // Call duration, in seconds; for left calls only + Duration int32 `json:"duration"` + // Identifiers of some other call participants + OtherParticipantIds []MessageSender `json:"other_participant_ids"` +} + +func (entity *MessageGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGroupCall) GetClass() string { + return ClassMessageContent +} + +func (*MessageGroupCall) GetType() string { + return TypeMessageGroupCall +} + +func (*MessageGroupCall) MessageContentType() string { + return TypeMessageGroupCall +} + +func (messageGroupCall *MessageGroupCall) UnmarshalJSON(data []byte) error { + var tmp struct { + IsActive bool `json:"is_active"` + WasMissed bool `json:"was_missed"` + IsVideo bool `json:"is_video"` + Duration int32 `json:"duration"` + OtherParticipantIds []json.RawMessage `json:"other_participant_ids"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageGroupCall.IsActive = tmp.IsActive + messageGroupCall.WasMissed = tmp.WasMissed + messageGroupCall.IsVideo = tmp.IsVideo + messageGroupCall.Duration = tmp.Duration + + fieldOtherParticipantIds, _ := UnmarshalListOfMessageSender(tmp.OtherParticipantIds) + messageGroupCall.OtherParticipantIds = fieldOtherParticipantIds + + return nil +} + // A new video chat was scheduled type MessageVideoChatScheduled struct { meta @@ -30357,11 +30479,11 @@ func (inputMessagePoll *InputMessagePoll) UnmarshalJSON(data []byte) error { return nil } -// A message with a forwarded story. Stories can't be sent to secret chats. A story can be forwarded only if story.can_be_forwarded +// A message with a forwarded story. Stories can't be forwarded to secret chats. A story can be forwarded only if story.can_be_forwarded type InputMessageStory struct { meta // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` } @@ -32756,7 +32878,7 @@ func (*InputStoryAreas) GetType() string { return TypeInputStoryAreas } -// Describes a video file sent in a story +// Describes a video file posted as a story type StoryVideo struct { meta // Duration of the video, in seconds @@ -33036,7 +33158,7 @@ func (*StoryListArchive) StoryListType() string { return TypeStoryListArchive } -// The original story was a public story with known sender +// The original story was a public story that was posted by a known chat type StoryOriginPublicStory struct { meta // Identifier of the chat that posted original story @@ -33065,11 +33187,11 @@ func (*StoryOriginPublicStory) StoryOriginType() string { return TypeStoryOriginPublicStory } -// The original story was sent by an unknown user +// The original story was posted by an unknown user type StoryOriginHiddenUser struct { meta - // Name of the story sender - SenderName string `json:"sender_name"` + // Name of the user or the chat that posted the story + PosterName string `json:"poster_name"` } func (entity *StoryOriginHiddenUser) MarshalJSON() ([]byte, error) { @@ -33168,21 +33290,21 @@ func (*StoryInteractionInfo) GetType() string { // Represents a story type Story struct { meta - // Unique story identifier among stories of the given sender + // Unique story identifier among stories posted by the given chat Id int32 `json:"id"` // Identifier of the chat that posted the story - SenderChatId int64 `json:"sender_chat_id"` - // Identifier of the sender of the story; may be null if the story is posted on behalf of the sender_chat_id - SenderId MessageSender `json:"sender_id"` + PosterChatId int64 `json:"poster_chat_id"` + // Identifier of the user or chat that posted the story; may be null if the story is posted on behalf of the poster_chat_id + PosterId MessageSender `json:"poster_id"` // Point in time (Unix timestamp) when the story was published Date int32 `json:"date"` - // True, if the story is being sent by the current user - IsBeingSent bool `json:"is_being_sent"` + // True, if the story is being posted by the current user + IsBeingPosted bool `json:"is_being_posted"` // True, if the story is being edited by the current user IsBeingEdited bool `json:"is_being_edited"` // True, if the story was edited IsEdited bool `json:"is_edited"` - // True, if the story is saved in the sender's profile and will be available there after expiration + // True, if the story is saved in the profile of the chat that posted it and will be available there after expiration IsPostedToChatPage bool `json:"is_posted_to_chat_page"` // True, if the story is visible only for the current user IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` @@ -33192,7 +33314,7 @@ type Story struct { CanBeEdited bool `json:"can_be_edited"` // True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden CanBeForwarded bool `json:"can_be_forwarded"` - // True, if the story can be replied in the chat with the story sender + // True, if the story can be replied in the chat with the user that posted the story CanBeReplied bool `json:"can_be_replied"` // True, if the story's is_posted_to_chat_page value can be changed CanToggleIsPostedToChatPage bool `json:"can_toggle_is_posted_to_chat_page"` @@ -33237,10 +33359,10 @@ func (*Story) GetType() string { func (story *Story) UnmarshalJSON(data []byte) error { var tmp struct { Id int32 `json:"id"` - SenderChatId int64 `json:"sender_chat_id"` - SenderId json.RawMessage `json:"sender_id"` + PosterChatId int64 `json:"poster_chat_id"` + PosterId json.RawMessage `json:"poster_id"` Date int32 `json:"date"` - IsBeingSent bool `json:"is_being_sent"` + IsBeingPosted bool `json:"is_being_posted"` IsBeingEdited bool `json:"is_being_edited"` IsEdited bool `json:"is_edited"` IsPostedToChatPage bool `json:"is_posted_to_chat_page"` @@ -33268,9 +33390,9 @@ func (story *Story) UnmarshalJSON(data []byte) error { } story.Id = tmp.Id - story.SenderChatId = tmp.SenderChatId + story.PosterChatId = tmp.PosterChatId story.Date = tmp.Date - story.IsBeingSent = tmp.IsBeingSent + story.IsBeingPosted = tmp.IsBeingPosted story.IsBeingEdited = tmp.IsBeingEdited story.IsEdited = tmp.IsEdited story.IsPostedToChatPage = tmp.IsPostedToChatPage @@ -33288,8 +33410,8 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.Areas = tmp.Areas story.Caption = tmp.Caption - fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) - story.SenderId = fieldSenderId + fieldPosterId, _ := UnmarshalMessageSender(tmp.PosterId) + story.PosterId = fieldPosterId fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) story.ChosenReactionType = fieldChosenReactionType @@ -33357,12 +33479,12 @@ func (*FoundStories) GetType() string { return TypeFoundStories } -// Contains identifier of a story along with identifier of its sender +// Contains identifier of a story along with identifier of the chat that posted it type StoryFullId struct { meta // Identifier of the chat that posted the story - SenderChatId int64 `json:"sender_chat_id"` - // Unique story identifier among stories of the given sender + PosterChatId int64 `json:"poster_chat_id"` + // Unique story identifier among stories of the chat StoryId int32 `json:"story_id"` } @@ -33385,7 +33507,7 @@ func (*StoryFullId) GetType() string { // Contains basic information about a story type StoryInfo struct { meta - // Unique story identifier among stories of the given sender + // Unique story identifier among stories of the chat StoryId int32 `json:"story_id"` // Point in time (Unix timestamp) when the story was published Date int32 `json:"date"` @@ -33416,7 +33538,7 @@ type ChatActiveStories struct { ChatId int64 `json:"chat_id"` // Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list List StoryList `json:"list"` - // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order + // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order Order int64 `json:"order"` // Identifier of the last read active story MaxReadStoryId int32 `json:"max_read_story_id"` @@ -34557,31 +34679,31 @@ func (*CallDiscardReasonHungUp) CallDiscardReasonType() string { return TypeCallDiscardReasonHungUp } -// The call was ended because it has been used successfully to transfer private encryption key for the associated group call -type CallDiscardReasonAllowGroupCall struct { +// The call was ended because it has been upgraded to a group call +type CallDiscardReasonUpgradeToGroupCall struct { meta - // Encrypted using the call private key encryption key for the associated group call - EncryptedGroupCallKey []byte `json:"encrypted_group_call_key"` + // Invite link for the group call + InviteLink string `json:"invite_link"` } -func (entity *CallDiscardReasonAllowGroupCall) MarshalJSON() ([]byte, error) { +func (entity *CallDiscardReasonUpgradeToGroupCall) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CallDiscardReasonAllowGroupCall + type stub CallDiscardReasonUpgradeToGroupCall return json.Marshal((*stub)(entity)) } -func (*CallDiscardReasonAllowGroupCall) GetClass() string { +func (*CallDiscardReasonUpgradeToGroupCall) GetClass() string { return ClassCallDiscardReason } -func (*CallDiscardReasonAllowGroupCall) GetType() string { - return TypeCallDiscardReasonAllowGroupCall +func (*CallDiscardReasonUpgradeToGroupCall) GetType() string { + return TypeCallDiscardReasonUpgradeToGroupCall } -func (*CallDiscardReasonAllowGroupCall) CallDiscardReasonType() string { - return TypeCallDiscardReasonAllowGroupCall +func (*CallDiscardReasonUpgradeToGroupCall) CallDiscardReasonType() string { + return TypeCallDiscardReasonUpgradeToGroupCall } // Specifies the supported call protocols @@ -34848,6 +34970,8 @@ type CallStateReady struct { Emojis []string `json:"emojis"` // True, if peer-to-peer connection is allowed by users privacy settings AllowP2p bool `json:"allow_p2p"` + // True, if the other party supports upgrading of the call to a group call + IsGroupCallSupported bool `json:"is_group_call_supported"` // Custom JSON-encoded call parameters to be passed to tgcalls CustomParameters string `json:"custom_parameters"` } @@ -34980,6 +35104,35 @@ func (*CallStateError) CallStateType() string { return TypeCallStateError } +// Describes parameters used to join a group call +type GroupCallJoinParameters struct { + meta + // Audio channel synchronization source identifier; received from tgcalls + AudioSourceId int32 `json:"audio_source_id"` + // Group call join payload; received from tgcalls + Payload string `json:"payload"` + // Pass true to join the call with muted microphone + IsMuted bool `json:"is_muted"` + // Pass true if the user's video is enabled + IsMyVideoEnabled bool `json:"is_my_video_enabled"` +} + +func (entity *GroupCallJoinParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallJoinParameters + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallJoinParameters) GetClass() string { + return ClassGroupCallJoinParameters +} + +func (*GroupCallJoinParameters) GetType() string { + return TypeGroupCallJoinParameters +} + // The worst available video quality type GroupCallVideoQualityThumbnail struct{ meta @@ -35055,8 +35208,8 @@ func (*GroupCallVideoQualityFull) GroupCallVideoQualityType() string { return TypeGroupCallVideoQualityFull } -// Describes an available stream in a group call -type GroupCallStream struct { +// Describes an available stream in a video chat +type VideoChatStream struct { meta // Identifier of an audio/video channel ChannelId int32 `json:"channel_id"` @@ -35066,43 +35219,43 @@ type GroupCallStream struct { TimeOffset int64 `json:"time_offset"` } -func (entity *GroupCallStream) MarshalJSON() ([]byte, error) { +func (entity *VideoChatStream) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub GroupCallStream + type stub VideoChatStream return json.Marshal((*stub)(entity)) } -func (*GroupCallStream) GetClass() string { - return ClassGroupCallStream +func (*VideoChatStream) GetClass() string { + return ClassVideoChatStream } -func (*GroupCallStream) GetType() string { - return TypeGroupCallStream +func (*VideoChatStream) GetType() string { + return TypeVideoChatStream } -// Represents a list of group call streams -type GroupCallStreams struct { +// Represents a list of video chat streams +type VideoChatStreams struct { meta - // A list of group call streams - Streams []*GroupCallStream `json:"streams"` + // A list of video chat streams + Streams []*VideoChatStream `json:"streams"` } -func (entity *GroupCallStreams) MarshalJSON() ([]byte, error) { +func (entity *VideoChatStreams) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub GroupCallStreams + type stub VideoChatStreams return json.Marshal((*stub)(entity)) } -func (*GroupCallStreams) GetClass() string { - return ClassGroupCallStreams +func (*VideoChatStreams) GetClass() string { + return ClassVideoChatStreams } -func (*GroupCallStreams) GetType() string { - return TypeGroupCallStreams +func (*VideoChatStreams) GetType() string { + return TypeVideoChatStreams } // Represents an RTMP URL @@ -35179,27 +35332,31 @@ type GroupCall struct { meta // Group call identifier Id int32 `json:"id"` - // Identifier of one-to-one call from which the group call was created; 0 if unknown - FromCallId int32 `json:"from_call_id"` - // Group call title + // Group call title; for video chats only Title string `json:"title"` - // 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 + // Invite link for the group call; for group calls that aren't bound to a chat. For video chats call getVideoChatInviteLink to get the link + InviteLink string `json:"invite_link"` + // 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; for video chats only 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 + // True, if the group call is scheduled and the current user will receive a notification when the group call starts; for video chats only EnabledStartNotification bool `json:"enabled_start_notification"` // True, if the call is active IsActive bool `json:"is_active"` - // True, if the chat is an RTMP stream instead of an ordinary video chat + // True, if the call is bound to a chat + IsVideoChat bool `json:"is_video_chat"` + // True, if the call is an RTMP stream instead of an ordinary video chat; for video chats only IsRtmpStream bool `json:"is_rtmp_stream"` // True, if the call is joined IsJoined bool `json:"is_joined"` // True, if user was kicked from the call because of network loss and the call needs to be rejoined NeedRejoin bool `json:"need_rejoin"` - // True, if the current user can manage the group call + // True, if the user is the owner of the call and can end the call, change volume level of other users, or ban users there; for group calls that aren't bound to a chat + IsOwned bool `json:"is_owned"` + // True, if the current user can manage the group call; for video chats only CanBeManaged bool `json:"can_be_managed"` // Number of participants in the group call ParticipantCount int32 `json:"participant_count"` - // True, if group call participants, which are muted, aren't returned in participant list + // True, if group call participants, which are muted, aren't returned in participant list; for video chats only HasHiddenListeners bool `json:"has_hidden_listeners"` // True, if all group call participants are loaded LoadedAllParticipants bool `json:"loaded_all_participants"` @@ -35211,9 +35368,9 @@ type GroupCall struct { IsMyVideoPaused bool `json:"is_my_video_paused"` // True, if the current user can broadcast video or share screen CanEnableVideo bool `json:"can_enable_video"` - // True, if only group call administrators can unmute new participants + // True, if only group call administrators can unmute new participants; for video chats only MuteNewParticipants bool `json:"mute_new_participants"` - // True, if the current user can enable or disable mute_new_participants setting + // True, if the current user can enable or disable mute_new_participants setting; for video chats only CanToggleMuteNewParticipants bool `json:"can_toggle_mute_new_participants"` // Duration of the ongoing group call recording, in seconds; 0 if none. An updateGroupCall update is not triggered when value of this field changes, but the same recording goes on RecordDuration int32 `json:"record_duration"` @@ -35399,6 +35556,285 @@ func (groupCallParticipant *GroupCallParticipant) UnmarshalJSON(data []byte) err return nil } +// Contains identifiers of group call participants +type GroupCallParticipants struct { + meta + // Total number of group call participants + TotalCount int32 `json:"total_count"` + // Identifiers of the participants + ParticipantIds []MessageSender `json:"participant_ids"` +} + +func (entity *GroupCallParticipants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallParticipants + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallParticipants) GetClass() string { + return ClassGroupCallParticipants +} + +func (*GroupCallParticipants) GetType() string { + return TypeGroupCallParticipants +} + +func (groupCallParticipants *GroupCallParticipants) UnmarshalJSON(data []byte) error { + var tmp struct { + TotalCount int32 `json:"total_count"` + ParticipantIds []json.RawMessage `json:"participant_ids"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + groupCallParticipants.TotalCount = tmp.TotalCount + + fieldParticipantIds, _ := UnmarshalListOfMessageSender(tmp.ParticipantIds) + groupCallParticipants.ParticipantIds = fieldParticipantIds + + return nil +} + +// Contains information about a just created or just joined group call +type GroupCallInfo struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // Join response payload for tgcalls; empty if the call isn't joined + JoinPayload string `json:"join_payload"` +} + +func (entity *GroupCallInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallInfo + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallInfo) GetClass() string { + return ClassGroupCallInfo +} + +func (*GroupCallInfo) GetType() string { + return TypeGroupCallInfo +} + +// The user can't be invited due to their privacy settings +type InviteGroupCallParticipantResultUserPrivacyRestricted struct{ + meta +} + +func (entity *InviteGroupCallParticipantResultUserPrivacyRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultUserPrivacyRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultUserPrivacyRestricted) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultUserPrivacyRestricted) GetType() string { + return TypeInviteGroupCallParticipantResultUserPrivacyRestricted +} + +func (*InviteGroupCallParticipantResultUserPrivacyRestricted) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultUserPrivacyRestricted +} + +// The user can't be invited because they are already a participant of the call +type InviteGroupCallParticipantResultUserAlreadyParticipant struct{ + meta +} + +func (entity *InviteGroupCallParticipantResultUserAlreadyParticipant) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultUserAlreadyParticipant + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultUserAlreadyParticipant) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultUserAlreadyParticipant) GetType() string { + return TypeInviteGroupCallParticipantResultUserAlreadyParticipant +} + +func (*InviteGroupCallParticipantResultUserAlreadyParticipant) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultUserAlreadyParticipant +} + +// The user can't be invited because they were banned by the owner of the call and can be invited back only by the owner of the group call +type InviteGroupCallParticipantResultUserWasBanned struct{ + meta +} + +func (entity *InviteGroupCallParticipantResultUserWasBanned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultUserWasBanned + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultUserWasBanned) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultUserWasBanned) GetType() string { + return TypeInviteGroupCallParticipantResultUserWasBanned +} + +func (*InviteGroupCallParticipantResultUserWasBanned) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultUserWasBanned +} + +// The user was invited and a service message of the type messageGroupCall was sent which can be used in declineGroupCallInvitation to cancel the invitation +type InviteGroupCallParticipantResultSuccess struct { + meta + // Identifier of the chat with the invitation message + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +func (entity *InviteGroupCallParticipantResultSuccess) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultSuccess + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultSuccess) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultSuccess) GetType() string { + return TypeInviteGroupCallParticipantResultSuccess +} + +func (*InviteGroupCallParticipantResultSuccess) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultSuccess +} + +// The main data channel for audio and video data +type GroupCallDataChannelMain struct{ + meta +} + +func (entity *GroupCallDataChannelMain) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallDataChannelMain + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallDataChannelMain) GetClass() string { + return ClassGroupCallDataChannel +} + +func (*GroupCallDataChannelMain) GetType() string { + return TypeGroupCallDataChannelMain +} + +func (*GroupCallDataChannelMain) GroupCallDataChannelType() string { + return TypeGroupCallDataChannelMain +} + +// The data channel for screen sharing +type GroupCallDataChannelScreenSharing struct{ + meta +} + +func (entity *GroupCallDataChannelScreenSharing) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallDataChannelScreenSharing + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallDataChannelScreenSharing) GetClass() string { + return ClassGroupCallDataChannel +} + +func (*GroupCallDataChannelScreenSharing) GetType() string { + return TypeGroupCallDataChannelScreenSharing +} + +func (*GroupCallDataChannelScreenSharing) GroupCallDataChannelType() string { + return TypeGroupCallDataChannelScreenSharing +} + +// The group call is accessible through a link +type InputGroupCallLink struct { + meta + // The link for the group call + Link string `json:"link"` +} + +func (entity *InputGroupCallLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputGroupCallLink + + return json.Marshal((*stub)(entity)) +} + +func (*InputGroupCallLink) GetClass() string { + return ClassInputGroupCall +} + +func (*InputGroupCallLink) GetType() string { + return TypeInputGroupCallLink +} + +func (*InputGroupCallLink) InputGroupCallType() string { + return TypeInputGroupCallLink +} + +// The group call is accessible through a message of the type messageGroupCall +type InputGroupCallMessage struct { + meta + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message of the type messageGroupCall + MessageId int64 `json:"message_id"` +} + +func (entity *InputGroupCallMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputGroupCallMessage + + return json.Marshal((*stub)(entity)) +} + +func (*InputGroupCallMessage) GetClass() string { + return ClassInputGroupCall +} + +func (*InputGroupCallMessage) GetType() string { + return TypeInputGroupCallMessage +} + +func (*InputGroupCallMessage) InputGroupCallType() string { + return TypeInputGroupCallMessage +} + // The user heard their own voice type CallProblemEcho struct{ meta @@ -35637,8 +36073,6 @@ type Call struct { IsVideo bool `json:"is_video"` // Call state State CallState `json:"state"` - // Identifier of the group call associated with the call; 0 if the group call isn't created yet. The group call can be received through the method getGroupCall - GroupCallId int32 `json:"group_call_id"` } func (entity *Call) MarshalJSON() ([]byte, error) { @@ -35664,7 +36098,6 @@ func (call *Call) UnmarshalJSON(data []byte) error { IsOutgoing bool `json:"is_outgoing"` IsVideo bool `json:"is_video"` State json.RawMessage `json:"state"` - GroupCallId int32 `json:"group_call_id"` } err := json.Unmarshal(data, &tmp) @@ -35676,7 +36109,6 @@ func (call *Call) UnmarshalJSON(data []byte) error { call.UserId = tmp.UserId call.IsOutgoing = tmp.IsOutgoing call.IsVideo = tmp.IsVideo - call.GroupCallId = tmp.GroupCallId fieldState, _ := UnmarshalCallState(tmp.State) call.State = fieldState @@ -35753,7 +36185,7 @@ type PhoneNumberAuthenticationSettings struct { AllowSmsRetrieverApi bool `json:"allow_sms_retriever_api"` // For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication FirebaseAuthenticationSettings FirebaseAuthenticationSettings `json:"firebase_authentication_settings"` - // List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions + // List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions; for setAuthenticationPhoneNumber only AuthenticationTokens []string `json:"authentication_tokens"` } @@ -40659,57 +41091,57 @@ func (*PremiumLimitTypeActiveStoryCount) PremiumLimitTypeType() string { return TypePremiumLimitTypeActiveStoryCount } -// The maximum number of stories sent per week -type PremiumLimitTypeWeeklySentStoryCount struct{ +// The maximum number of stories posted per week +type PremiumLimitTypeWeeklyPostedStoryCount struct{ meta } -func (entity *PremiumLimitTypeWeeklySentStoryCount) MarshalJSON() ([]byte, error) { +func (entity *PremiumLimitTypeWeeklyPostedStoryCount) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumLimitTypeWeeklySentStoryCount + type stub PremiumLimitTypeWeeklyPostedStoryCount return json.Marshal((*stub)(entity)) } -func (*PremiumLimitTypeWeeklySentStoryCount) GetClass() string { +func (*PremiumLimitTypeWeeklyPostedStoryCount) GetClass() string { return ClassPremiumLimitType } -func (*PremiumLimitTypeWeeklySentStoryCount) GetType() string { - return TypePremiumLimitTypeWeeklySentStoryCount +func (*PremiumLimitTypeWeeklyPostedStoryCount) GetType() string { + return TypePremiumLimitTypeWeeklyPostedStoryCount } -func (*PremiumLimitTypeWeeklySentStoryCount) PremiumLimitTypeType() string { - return TypePremiumLimitTypeWeeklySentStoryCount +func (*PremiumLimitTypeWeeklyPostedStoryCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypeWeeklyPostedStoryCount } -// The maximum number of stories sent per month -type PremiumLimitTypeMonthlySentStoryCount struct{ +// The maximum number of stories posted per month +type PremiumLimitTypeMonthlyPostedStoryCount struct{ meta } -func (entity *PremiumLimitTypeMonthlySentStoryCount) MarshalJSON() ([]byte, error) { +func (entity *PremiumLimitTypeMonthlyPostedStoryCount) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumLimitTypeMonthlySentStoryCount + type stub PremiumLimitTypeMonthlyPostedStoryCount return json.Marshal((*stub)(entity)) } -func (*PremiumLimitTypeMonthlySentStoryCount) GetClass() string { +func (*PremiumLimitTypeMonthlyPostedStoryCount) GetClass() string { return ClassPremiumLimitType } -func (*PremiumLimitTypeMonthlySentStoryCount) GetType() string { - return TypePremiumLimitTypeMonthlySentStoryCount +func (*PremiumLimitTypeMonthlyPostedStoryCount) GetType() string { + return TypePremiumLimitTypeMonthlyPostedStoryCount } -func (*PremiumLimitTypeMonthlySentStoryCount) PremiumLimitTypeType() string { - return TypePremiumLimitTypeMonthlySentStoryCount +func (*PremiumLimitTypeMonthlyPostedStoryCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypeMonthlyPostedStoryCount } -// The maximum length of captions of sent stories +// The maximum length of captions of posted stories type PremiumLimitTypeStoryCaptionLength struct{ meta } @@ -43629,157 +44061,157 @@ func (*Hashtags) GetType() string { } // A story can be sent -type CanSendStoryResultOk struct{ +type CanPostStoryResultOk struct{ meta } -func (entity *CanSendStoryResultOk) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultOk) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultOk + type stub CanPostStoryResultOk return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultOk) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultOk) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultOk) GetType() string { - return TypeCanSendStoryResultOk +func (*CanPostStoryResultOk) GetType() string { + return TypeCanPostStoryResultOk } -func (*CanSendStoryResultOk) CanSendStoryResultType() string { - return TypeCanSendStoryResultOk +func (*CanPostStoryResultOk) CanPostStoryResultType() string { + return TypeCanPostStoryResultOk } // The user must subscribe to Telegram Premium to be able to post stories -type CanSendStoryResultPremiumNeeded struct{ +type CanPostStoryResultPremiumNeeded struct{ meta } -func (entity *CanSendStoryResultPremiumNeeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultPremiumNeeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultPremiumNeeded + type stub CanPostStoryResultPremiumNeeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultPremiumNeeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultPremiumNeeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultPremiumNeeded) GetType() string { - return TypeCanSendStoryResultPremiumNeeded +func (*CanPostStoryResultPremiumNeeded) GetType() string { + return TypeCanPostStoryResultPremiumNeeded } -func (*CanSendStoryResultPremiumNeeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultPremiumNeeded +func (*CanPostStoryResultPremiumNeeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultPremiumNeeded } // The chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat -type CanSendStoryResultBoostNeeded struct{ +type CanPostStoryResultBoostNeeded struct{ meta } -func (entity *CanSendStoryResultBoostNeeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultBoostNeeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultBoostNeeded + type stub CanPostStoryResultBoostNeeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultBoostNeeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultBoostNeeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultBoostNeeded) GetType() string { - return TypeCanSendStoryResultBoostNeeded +func (*CanPostStoryResultBoostNeeded) GetType() string { + return TypeCanPostStoryResultBoostNeeded } -func (*CanSendStoryResultBoostNeeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultBoostNeeded +func (*CanPostStoryResultBoostNeeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultBoostNeeded } // The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire -type CanSendStoryResultActiveStoryLimitExceeded struct{ +type CanPostStoryResultActiveStoryLimitExceeded struct{ meta } -func (entity *CanSendStoryResultActiveStoryLimitExceeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultActiveStoryLimitExceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultActiveStoryLimitExceeded + type stub CanPostStoryResultActiveStoryLimitExceeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultActiveStoryLimitExceeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultActiveStoryLimitExceeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultActiveStoryLimitExceeded) GetType() string { - return TypeCanSendStoryResultActiveStoryLimitExceeded +func (*CanPostStoryResultActiveStoryLimitExceeded) GetType() string { + return TypeCanPostStoryResultActiveStoryLimitExceeded } -func (*CanSendStoryResultActiveStoryLimitExceeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultActiveStoryLimitExceeded +func (*CanPostStoryResultActiveStoryLimitExceeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultActiveStoryLimitExceeded } // The weekly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time -type CanSendStoryResultWeeklyLimitExceeded struct { +type CanPostStoryResultWeeklyLimitExceeded struct { meta - // Time left before the user can send the next story + // Time left before the user can post the next story RetryAfter int32 `json:"retry_after"` } -func (entity *CanSendStoryResultWeeklyLimitExceeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultWeeklyLimitExceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultWeeklyLimitExceeded + type stub CanPostStoryResultWeeklyLimitExceeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultWeeklyLimitExceeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultWeeklyLimitExceeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultWeeklyLimitExceeded) GetType() string { - return TypeCanSendStoryResultWeeklyLimitExceeded +func (*CanPostStoryResultWeeklyLimitExceeded) GetType() string { + return TypeCanPostStoryResultWeeklyLimitExceeded } -func (*CanSendStoryResultWeeklyLimitExceeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultWeeklyLimitExceeded +func (*CanPostStoryResultWeeklyLimitExceeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultWeeklyLimitExceeded } // The monthly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time -type CanSendStoryResultMonthlyLimitExceeded struct { +type CanPostStoryResultMonthlyLimitExceeded struct { meta - // Time left before the user can send the next story + // Time left before the user can post the next story RetryAfter int32 `json:"retry_after"` } -func (entity *CanSendStoryResultMonthlyLimitExceeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultMonthlyLimitExceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultMonthlyLimitExceeded + type stub CanPostStoryResultMonthlyLimitExceeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultMonthlyLimitExceeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultMonthlyLimitExceeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultMonthlyLimitExceeded) GetType() string { - return TypeCanSendStoryResultMonthlyLimitExceeded +func (*CanPostStoryResultMonthlyLimitExceeded) GetType() string { + return TypeCanPostStoryResultMonthlyLimitExceeded } -func (*CanSendStoryResultMonthlyLimitExceeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultMonthlyLimitExceeded +func (*CanPostStoryResultMonthlyLimitExceeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultMonthlyLimitExceeded } // The session can be used @@ -48738,6 +49170,33 @@ func (*InternalLinkTypeGame) InternalLinkTypeType() string { return TypeInternalLinkTypeGame } +// The link is a link to a group call that isn't bound to a chat. Call joinGroupCall with the given invite_link +type InternalLinkTypeGroupCall struct { + meta + // Internal representation of the invite link + InviteLink string `json:"invite_link"` +} + +func (entity *InternalLinkTypeGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeGroupCall) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeGroupCall) GetType() string { + return TypeInternalLinkTypeGroupCall +} + +func (*InternalLinkTypeGroupCall) InternalLinkTypeType() string { + return TypeInternalLinkTypeGroupCall +} + // The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. If Instant View is found, then show it, otherwise, open the fallback URL in an external browser type InternalLinkTypeInstantView struct { meta @@ -49311,11 +49770,11 @@ func (*InternalLinkTypeStickerSet) InternalLinkTypeType() string { return TypeInternalLinkTypeStickerSet } -// The link is a link to a story. Call searchPublicChat with the given sender username, then call getStory with the received chat identifier and the given story identifier, then show the story if received +// The link is a link to a story. Call searchPublicChat with the given poster username, then call getStory with the received chat identifier and the given story identifier, then show the story if received type InternalLinkTypeStory struct { meta - // Username of the sender of the story - StorySenderUsername string `json:"story_sender_username"` + // Username of the poster of the story + StoryPosterUsername string `json:"story_poster_username"` // Story identifier StoryId int32 `json:"story_id"` } @@ -49529,7 +49988,7 @@ func (*InternalLinkTypeUserToken) InternalLinkTypeType() string { return TypeInternalLinkTypeUserToken } -// The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinGroupCall with the given invite hash to process the link +// The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinVideoChat with the given invite hash to process the link type InternalLinkTypeVideoChat struct { meta // Username of the chat with the video chat @@ -49774,29 +50233,6 @@ func (*BlockListStories) BlockListType() string { return TypeBlockListStories } -// Contains a part of a file -type FilePart struct { - meta - // File bytes - Data []byte `json:"data"` -} - -func (entity *FilePart) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FilePart - - return json.Marshal((*stub)(entity)) -} - -func (*FilePart) GetClass() string { - return ClassFilePart -} - -func (*FilePart) GetType() string { - return TypeFilePart -} - // The data is not a file type FileTypeNone struct{ meta @@ -52012,6 +52448,29 @@ func (*Text) GetType() string { return TypeText } +// Contains some binary data +type Data struct { + meta + // Data + Data []byte `json:"data"` +} + +func (entity *Data) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Data + + return json.Marshal((*stub)(entity)) +} + +func (*Data) GetClass() string { + return ClassData +} + +func (*Data) GetType() string { + return TypeData +} + // Contains a value representing a number of seconds type Seconds struct { meta @@ -52548,7 +53007,7 @@ func (*ChatStatisticsObjectTypeMessage) ChatStatisticsObjectTypeType() string { return TypeChatStatisticsObjectTypeMessage } -// Describes a story sent by the chat +// Describes a story posted on behalf of the chat type ChatStatisticsObjectTypeStory struct { meta // Story identifier @@ -52575,7 +53034,7 @@ func (*ChatStatisticsObjectTypeStory) ChatStatisticsObjectTypeType() string { return TypeChatStatisticsObjectTypeStory } -// Contains statistics about interactions with a message sent in the chat or a story sent by the chat +// Contains statistics about interactions with a message sent in the chat or a story posted on behalf of the chat type ChatStatisticsInteractionInfo struct { meta // Type of the object @@ -52839,11 +53298,11 @@ type ChatStatisticsChannel struct { MeanMessageShareCount *StatisticalValue `json:"mean_message_share_count"` // Mean number of times reactions were added to the recently sent messages MeanMessageReactionCount *StatisticalValue `json:"mean_message_reaction_count"` - // Mean number of times the recently sent stories were viewed + // Mean number of times the recently posted stories were viewed MeanStoryViewCount *StatisticalValue `json:"mean_story_view_count"` - // Mean number of times the recently sent stories were shared + // Mean number of times the recently posted stories were shared MeanStoryShareCount *StatisticalValue `json:"mean_story_share_count"` - // Mean number of times reactions were added to the recently sent stories + // Mean number of times reactions were added to the recently posted stories MeanStoryReactionCount *StatisticalValue `json:"mean_story_reaction_count"` // A percentage of users with enabled notifications for the chat; 0-100 EnabledNotificationsPercentage float64 `json:"enabled_notifications_percentage"` @@ -52871,7 +53330,7 @@ type ChatStatisticsChannel struct { StoryReactionGraph StatisticalGraph `json:"story_reaction_graph"` // A graph containing number of views of associated with the chat instant views InstantViewInteractionGraph StatisticalGraph `json:"instant_view_interaction_graph"` - // Detailed statistics about number of views and shares of recently sent messages and stories + // Detailed statistics about number of views and shares of recently sent messages and posted stories RecentInteractions []*ChatStatisticsInteractionInfo `json:"recent_interactions"` } @@ -55687,6 +56146,8 @@ type UpdateForumTopic struct { MessageThreadId int64 `json:"message_thread_id"` // True, if the topic is pinned in the topic list IsPinned bool `json:"is_pinned"` + // Identifier of the last read incoming message + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` // Identifier of the last read outgoing message LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` // Notification settings for the topic @@ -56628,7 +57089,7 @@ func (*UpdateCall) UpdateType() string { // Information about a group call was updated type UpdateGroupCall struct { meta - // New data about a group call + // New data about the group call GroupCall *GroupCall `json:"group_call"` } @@ -56655,9 +57116,9 @@ func (*UpdateGroupCall) UpdateType() string { // Information about a group call participant was changed. The updates are sent only after the group call is received through getGroupCall and only if the call is joined or being joined type UpdateGroupCallParticipant struct { meta - // Identifier of group call + // Identifier of the group call GroupCallId int32 `json:"group_call_id"` - // New data about a participant + // New data about the participant Participant *GroupCallParticipant `json:"participant"` } @@ -56681,6 +57142,66 @@ func (*UpdateGroupCallParticipant) UpdateType() string { return TypeUpdateGroupCallParticipant } +// The list of group call participants that can send and receive encrypted call data has changed; for group calls not bound to a chat only +type UpdateGroupCallParticipants struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. The participants must be shown in the list of group call participants even there is no information about them + ParticipantUserIds []JsonInt64 `json:"participant_user_ids"` +} + +func (entity *UpdateGroupCallParticipants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateGroupCallParticipants + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateGroupCallParticipants) GetClass() string { + return ClassUpdate +} + +func (*UpdateGroupCallParticipants) GetType() string { + return TypeUpdateGroupCallParticipants +} + +func (*UpdateGroupCallParticipants) UpdateType() string { + return TypeUpdateGroupCallParticipants +} + +// The verification state of an encrypted group call has changed; for group calls not bound to a chat only +type UpdateGroupCallVerificationState struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // The call state generation to which the emoji corresponds. If generation is different for two users, then their emoji may be also different + Generation int32 `json:"generation"` + // Group call state fingerprint represented as 4 emoji; may be empty if the state isn't verified yet + Emojis []string `json:"emojis"` +} + +func (entity *UpdateGroupCallVerificationState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateGroupCallVerificationState + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateGroupCallVerificationState) GetClass() string { + return ClassUpdate +} + +func (*UpdateGroupCallVerificationState) GetType() string { + return TypeUpdateGroupCallVerificationState +} + +func (*UpdateGroupCallVerificationState) UpdateType() string { + return TypeUpdateGroupCallVerificationState +} + // New call signaling data arrived type UpdateNewCallSignalingData struct { meta @@ -56905,7 +57426,7 @@ func (*UpdateStory) UpdateType() string { type UpdateStoryDeleted struct { meta // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` } @@ -56930,67 +57451,67 @@ func (*UpdateStoryDeleted) UpdateType() string { return TypeUpdateStoryDeleted } -// A story has been successfully sent -type UpdateStorySendSucceeded struct { +// A story has been successfully posted +type UpdateStoryPostSucceeded struct { meta - // The sent story + // The posted story Story *Story `json:"story"` // The previous temporary story identifier OldStoryId int32 `json:"old_story_id"` } -func (entity *UpdateStorySendSucceeded) MarshalJSON() ([]byte, error) { +func (entity *UpdateStoryPostSucceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateStorySendSucceeded + type stub UpdateStoryPostSucceeded return json.Marshal((*stub)(entity)) } -func (*UpdateStorySendSucceeded) GetClass() string { +func (*UpdateStoryPostSucceeded) GetClass() string { return ClassUpdate } -func (*UpdateStorySendSucceeded) GetType() string { - return TypeUpdateStorySendSucceeded +func (*UpdateStoryPostSucceeded) GetType() string { + return TypeUpdateStoryPostSucceeded } -func (*UpdateStorySendSucceeded) UpdateType() string { - return TypeUpdateStorySendSucceeded +func (*UpdateStoryPostSucceeded) UpdateType() string { + return TypeUpdateStoryPostSucceeded } -// A story failed to send. If the story sending is canceled, then updateStoryDeleted will be received instead of this update -type UpdateStorySendFailed struct { +// A story failed to post. If the story posting is canceled, then updateStoryDeleted will be received instead of this update +type UpdateStoryPostFailed struct { meta - // The failed to send story + // The failed to post story Story *Story `json:"story"` - // The cause of the story sending failure + // The cause of the story posting failure Error *Error `json:"error"` // Type of the error; may be null if unknown - ErrorType CanSendStoryResult `json:"error_type"` + ErrorType CanPostStoryResult `json:"error_type"` } -func (entity *UpdateStorySendFailed) MarshalJSON() ([]byte, error) { +func (entity *UpdateStoryPostFailed) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateStorySendFailed + type stub UpdateStoryPostFailed return json.Marshal((*stub)(entity)) } -func (*UpdateStorySendFailed) GetClass() string { +func (*UpdateStoryPostFailed) GetClass() string { return ClassUpdate } -func (*UpdateStorySendFailed) GetType() string { - return TypeUpdateStorySendFailed +func (*UpdateStoryPostFailed) GetType() string { + return TypeUpdateStoryPostFailed } -func (*UpdateStorySendFailed) UpdateType() string { - return TypeUpdateStorySendFailed +func (*UpdateStoryPostFailed) UpdateType() string { + return TypeUpdateStoryPostFailed } -func (updateStorySendFailed *UpdateStorySendFailed) UnmarshalJSON(data []byte) error { +func (updateStoryPostFailed *UpdateStoryPostFailed) UnmarshalJSON(data []byte) error { var tmp struct { Story *Story `json:"story"` Error *Error `json:"error"` @@ -57002,11 +57523,11 @@ func (updateStorySendFailed *UpdateStorySendFailed) UnmarshalJSON(data []byte) e return err } - updateStorySendFailed.Story = tmp.Story - updateStorySendFailed.Error = tmp.Error + updateStoryPostFailed.Story = tmp.Story + updateStoryPostFailed.Error = tmp.Error - fieldErrorType, _ := UnmarshalCanSendStoryResult(tmp.ErrorType) - updateStorySendFailed.ErrorType = fieldErrorType + fieldErrorType, _ := UnmarshalCanPostStoryResult(tmp.ErrorType) + updateStoryPostFailed.ErrorType = fieldErrorType return nil } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 31bc0c7..dd0a41a 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -2666,6 +2666,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeExternalVideo: return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeGroupCall: + return UnmarshalLinkPreviewTypeGroupCall(data) + case TypeLinkPreviewTypeInvoice: return UnmarshalLinkPreviewTypeInvoice(data) @@ -3390,6 +3393,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageCall: return UnmarshalMessageCall(data) + case TypeMessageGroupCall: + return UnmarshalMessageGroupCall(data) + case TypeMessageVideoChatScheduled: return UnmarshalMessageVideoChatScheduled(data) @@ -4570,8 +4576,8 @@ func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) case TypeCallDiscardReasonHungUp: return UnmarshalCallDiscardReasonHungUp(data) - case TypeCallDiscardReasonAllowGroupCall: - return UnmarshalCallDiscardReasonAllowGroupCall(data) + case TypeCallDiscardReasonUpgradeToGroupCall: + return UnmarshalCallDiscardReasonUpgradeToGroupCall(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) @@ -4709,6 +4715,114 @@ func UnmarshalListOfGroupCallVideoQuality(dataList []json.RawMessage) ([]GroupCa return list, nil } +func UnmarshalInviteGroupCallParticipantResult(data json.RawMessage) (InviteGroupCallParticipantResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInviteGroupCallParticipantResultUserPrivacyRestricted: + return UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(data) + + case TypeInviteGroupCallParticipantResultUserAlreadyParticipant: + return UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(data) + + case TypeInviteGroupCallParticipantResultUserWasBanned: + return UnmarshalInviteGroupCallParticipantResultUserWasBanned(data) + + case TypeInviteGroupCallParticipantResultSuccess: + return UnmarshalInviteGroupCallParticipantResultSuccess(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInviteGroupCallParticipantResult(dataList []json.RawMessage) ([]InviteGroupCallParticipantResult, error) { + list := []InviteGroupCallParticipantResult{} + + for _, data := range dataList { + entity, err := UnmarshalInviteGroupCallParticipantResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGroupCallDataChannel(data json.RawMessage) (GroupCallDataChannel, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGroupCallDataChannelMain: + return UnmarshalGroupCallDataChannelMain(data) + + case TypeGroupCallDataChannelScreenSharing: + return UnmarshalGroupCallDataChannelScreenSharing(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGroupCallDataChannel(dataList []json.RawMessage) ([]GroupCallDataChannel, error) { + list := []GroupCallDataChannel{} + + for _, data := range dataList { + entity, err := UnmarshalGroupCallDataChannel(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputGroupCall(data json.RawMessage) (InputGroupCall, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputGroupCallLink: + return UnmarshalInputGroupCallLink(data) + + case TypeInputGroupCallMessage: + return UnmarshalInputGroupCallMessage(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputGroupCall(dataList []json.RawMessage) ([]InputGroupCall, error) { + list := []InputGroupCall{} + + for _, data := range dataList { + entity, err := UnmarshalInputGroupCall(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCallProblem(data json.RawMessage) (CallProblem, error) { var meta meta @@ -5448,11 +5562,11 @@ func UnmarshalPremiumLimitType(data json.RawMessage) (PremiumLimitType, error) { case TypePremiumLimitTypeActiveStoryCount: return UnmarshalPremiumLimitTypeActiveStoryCount(data) - case TypePremiumLimitTypeWeeklySentStoryCount: - return UnmarshalPremiumLimitTypeWeeklySentStoryCount(data) + case TypePremiumLimitTypeWeeklyPostedStoryCount: + return UnmarshalPremiumLimitTypeWeeklyPostedStoryCount(data) - case TypePremiumLimitTypeMonthlySentStoryCount: - return UnmarshalPremiumLimitTypeMonthlySentStoryCount(data) + case TypePremiumLimitTypeMonthlyPostedStoryCount: + return UnmarshalPremiumLimitTypeMonthlyPostedStoryCount(data) case TypePremiumLimitTypeStoryCaptionLength: return UnmarshalPremiumLimitTypeStoryCaptionLength(data) @@ -6048,7 +6162,7 @@ func UnmarshalListOfInputBackground(dataList []json.RawMessage) ([]InputBackgrou return list, nil } -func UnmarshalCanSendStoryResult(data json.RawMessage) (CanSendStoryResult, error) { +func UnmarshalCanPostStoryResult(data json.RawMessage) (CanPostStoryResult, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -6057,34 +6171,34 @@ func UnmarshalCanSendStoryResult(data json.RawMessage) (CanSendStoryResult, erro } switch meta.Type { - case TypeCanSendStoryResultOk: - return UnmarshalCanSendStoryResultOk(data) + case TypeCanPostStoryResultOk: + return UnmarshalCanPostStoryResultOk(data) - case TypeCanSendStoryResultPremiumNeeded: - return UnmarshalCanSendStoryResultPremiumNeeded(data) + case TypeCanPostStoryResultPremiumNeeded: + return UnmarshalCanPostStoryResultPremiumNeeded(data) - case TypeCanSendStoryResultBoostNeeded: - return UnmarshalCanSendStoryResultBoostNeeded(data) + case TypeCanPostStoryResultBoostNeeded: + return UnmarshalCanPostStoryResultBoostNeeded(data) - case TypeCanSendStoryResultActiveStoryLimitExceeded: - return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data) + case TypeCanPostStoryResultActiveStoryLimitExceeded: + return UnmarshalCanPostStoryResultActiveStoryLimitExceeded(data) - case TypeCanSendStoryResultWeeklyLimitExceeded: - return UnmarshalCanSendStoryResultWeeklyLimitExceeded(data) + case TypeCanPostStoryResultWeeklyLimitExceeded: + return UnmarshalCanPostStoryResultWeeklyLimitExceeded(data) - case TypeCanSendStoryResultMonthlyLimitExceeded: - return UnmarshalCanSendStoryResultMonthlyLimitExceeded(data) + case TypeCanPostStoryResultMonthlyLimitExceeded: + return UnmarshalCanPostStoryResultMonthlyLimitExceeded(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfCanSendStoryResult(dataList []json.RawMessage) ([]CanSendStoryResult, error) { - list := []CanSendStoryResult{} +func UnmarshalListOfCanPostStoryResult(dataList []json.RawMessage) ([]CanPostStoryResult, error) { + list := []CanPostStoryResult{} for _, data := range dataList { - entity, err := UnmarshalCanSendStoryResult(data) + entity, err := UnmarshalCanPostStoryResult(data) if err != nil { return nil, err } @@ -7093,6 +7207,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGroupCall: + return UnmarshalInternalLinkTypeGroupCall(data) + case TypeInternalLinkTypeInstantView: return UnmarshalInternalLinkTypeInstantView(data) @@ -8292,6 +8409,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateGroupCallParticipant: return UnmarshalUpdateGroupCallParticipant(data) + case TypeUpdateGroupCallParticipants: + return UnmarshalUpdateGroupCallParticipants(data) + + case TypeUpdateGroupCallVerificationState: + return UnmarshalUpdateGroupCallVerificationState(data) + case TypeUpdateNewCallSignalingData: return UnmarshalUpdateNewCallSignalingData(data) @@ -8310,11 +8433,11 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateStoryDeleted: return UnmarshalUpdateStoryDeleted(data) - case TypeUpdateStorySendSucceeded: - return UnmarshalUpdateStorySendSucceeded(data) + case TypeUpdateStoryPostSucceeded: + return UnmarshalUpdateStoryPostSucceeded(data) - case TypeUpdateStorySendFailed: - return UnmarshalUpdateStorySendFailed(data) + case TypeUpdateStoryPostFailed: + return UnmarshalUpdateStoryPostFailed(data) case TypeUpdateChatActiveStories: return UnmarshalUpdateChatActiveStories(data) @@ -12896,6 +13019,14 @@ func UnmarshalLinkPreviewTypeExternalVideo(data json.RawMessage) (*LinkPreviewTy return &resp, err } +func UnmarshalLinkPreviewTypeGroupCall(data json.RawMessage) (*LinkPreviewTypeGroupCall, error) { + var resp LinkPreviewTypeGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeInvoice(data json.RawMessage) (*LinkPreviewTypeInvoice, error) { var resp LinkPreviewTypeInvoice @@ -14144,6 +14275,14 @@ func UnmarshalMessageCall(data json.RawMessage) (*MessageCall, error) { return &resp, err } +func UnmarshalMessageGroupCall(data json.RawMessage) (*MessageGroupCall, error) { + var resp MessageGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageVideoChatScheduled(data json.RawMessage) (*MessageVideoChatScheduled, error) { var resp MessageVideoChatScheduled @@ -16016,8 +16155,8 @@ func UnmarshalCallDiscardReasonHungUp(data json.RawMessage) (*CallDiscardReasonH return &resp, err } -func UnmarshalCallDiscardReasonAllowGroupCall(data json.RawMessage) (*CallDiscardReasonAllowGroupCall, error) { - var resp CallDiscardReasonAllowGroupCall +func UnmarshalCallDiscardReasonUpgradeToGroupCall(data json.RawMessage) (*CallDiscardReasonUpgradeToGroupCall, error) { + var resp CallDiscardReasonUpgradeToGroupCall err := json.Unmarshal(data, &resp) @@ -16120,6 +16259,14 @@ func UnmarshalCallStateError(data json.RawMessage) (*CallStateError, error) { return &resp, err } +func UnmarshalGroupCallJoinParameters(data json.RawMessage) (*GroupCallJoinParameters, error) { + var resp GroupCallJoinParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalGroupCallVideoQualityThumbnail(data json.RawMessage) (*GroupCallVideoQualityThumbnail, error) { var resp GroupCallVideoQualityThumbnail @@ -16144,16 +16291,16 @@ func UnmarshalGroupCallVideoQualityFull(data json.RawMessage) (*GroupCallVideoQu return &resp, err } -func UnmarshalGroupCallStream(data json.RawMessage) (*GroupCallStream, error) { - var resp GroupCallStream +func UnmarshalVideoChatStream(data json.RawMessage) (*VideoChatStream, error) { + var resp VideoChatStream err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalGroupCallStreams(data json.RawMessage) (*GroupCallStreams, error) { - var resp GroupCallStreams +func UnmarshalVideoChatStreams(data json.RawMessage) (*VideoChatStreams, error) { + var resp VideoChatStreams err := json.Unmarshal(data, &resp) @@ -16208,6 +16355,86 @@ func UnmarshalGroupCallParticipant(data json.RawMessage) (*GroupCallParticipant, return &resp, err } +func UnmarshalGroupCallParticipants(data json.RawMessage) (*GroupCallParticipants, error) { + var resp GroupCallParticipants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallInfo(data json.RawMessage) (*GroupCallInfo, error) { + var resp GroupCallInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(data json.RawMessage) (*InviteGroupCallParticipantResultUserPrivacyRestricted, error) { + var resp InviteGroupCallParticipantResultUserPrivacyRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(data json.RawMessage) (*InviteGroupCallParticipantResultUserAlreadyParticipant, error) { + var resp InviteGroupCallParticipantResultUserAlreadyParticipant + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultUserWasBanned(data json.RawMessage) (*InviteGroupCallParticipantResultUserWasBanned, error) { + var resp InviteGroupCallParticipantResultUserWasBanned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultSuccess(data json.RawMessage) (*InviteGroupCallParticipantResultSuccess, error) { + var resp InviteGroupCallParticipantResultSuccess + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallDataChannelMain(data json.RawMessage) (*GroupCallDataChannelMain, error) { + var resp GroupCallDataChannelMain + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallDataChannelScreenSharing(data json.RawMessage) (*GroupCallDataChannelScreenSharing, error) { + var resp GroupCallDataChannelScreenSharing + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputGroupCallLink(data json.RawMessage) (*InputGroupCallLink, error) { + var resp InputGroupCallLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputGroupCallMessage(data json.RawMessage) (*InputGroupCallMessage, error) { + var resp InputGroupCallMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallProblemEcho(data json.RawMessage) (*CallProblemEcho, error) { var resp CallProblemEcho @@ -17432,16 +17659,16 @@ func UnmarshalPremiumLimitTypeActiveStoryCount(data json.RawMessage) (*PremiumLi return &resp, err } -func UnmarshalPremiumLimitTypeWeeklySentStoryCount(data json.RawMessage) (*PremiumLimitTypeWeeklySentStoryCount, error) { - var resp PremiumLimitTypeWeeklySentStoryCount +func UnmarshalPremiumLimitTypeWeeklyPostedStoryCount(data json.RawMessage) (*PremiumLimitTypeWeeklyPostedStoryCount, error) { + var resp PremiumLimitTypeWeeklyPostedStoryCount err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumLimitTypeMonthlySentStoryCount(data json.RawMessage) (*PremiumLimitTypeMonthlySentStoryCount, error) { - var resp PremiumLimitTypeMonthlySentStoryCount +func UnmarshalPremiumLimitTypeMonthlyPostedStoryCount(data json.RawMessage) (*PremiumLimitTypeMonthlyPostedStoryCount, error) { + var resp PremiumLimitTypeMonthlyPostedStoryCount err := json.Unmarshal(data, &resp) @@ -18248,48 +18475,48 @@ func UnmarshalHashtags(data json.RawMessage) (*Hashtags, error) { return &resp, err } -func UnmarshalCanSendStoryResultOk(data json.RawMessage) (*CanSendStoryResultOk, error) { - var resp CanSendStoryResultOk +func UnmarshalCanPostStoryResultOk(data json.RawMessage) (*CanPostStoryResultOk, error) { + var resp CanPostStoryResultOk err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultPremiumNeeded(data json.RawMessage) (*CanSendStoryResultPremiumNeeded, error) { - var resp CanSendStoryResultPremiumNeeded +func UnmarshalCanPostStoryResultPremiumNeeded(data json.RawMessage) (*CanPostStoryResultPremiumNeeded, error) { + var resp CanPostStoryResultPremiumNeeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultBoostNeeded(data json.RawMessage) (*CanSendStoryResultBoostNeeded, error) { - var resp CanSendStoryResultBoostNeeded +func UnmarshalCanPostStoryResultBoostNeeded(data json.RawMessage) (*CanPostStoryResultBoostNeeded, error) { + var resp CanPostStoryResultBoostNeeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data json.RawMessage) (*CanSendStoryResultActiveStoryLimitExceeded, error) { - var resp CanSendStoryResultActiveStoryLimitExceeded +func UnmarshalCanPostStoryResultActiveStoryLimitExceeded(data json.RawMessage) (*CanPostStoryResultActiveStoryLimitExceeded, error) { + var resp CanPostStoryResultActiveStoryLimitExceeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultWeeklyLimitExceeded(data json.RawMessage) (*CanSendStoryResultWeeklyLimitExceeded, error) { - var resp CanSendStoryResultWeeklyLimitExceeded +func UnmarshalCanPostStoryResultWeeklyLimitExceeded(data json.RawMessage) (*CanPostStoryResultWeeklyLimitExceeded, error) { + var resp CanPostStoryResultWeeklyLimitExceeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultMonthlyLimitExceeded(data json.RawMessage) (*CanSendStoryResultMonthlyLimitExceeded, error) { - var resp CanSendStoryResultMonthlyLimitExceeded +func UnmarshalCanPostStoryResultMonthlyLimitExceeded(data json.RawMessage) (*CanPostStoryResultMonthlyLimitExceeded, error) { + var resp CanPostStoryResultMonthlyLimitExceeded err := json.Unmarshal(data, &resp) @@ -19712,6 +19939,14 @@ func UnmarshalInternalLinkTypeGame(data json.RawMessage) (*InternalLinkTypeGame, return &resp, err } +func UnmarshalInternalLinkTypeGroupCall(data json.RawMessage) (*InternalLinkTypeGroupCall, error) { + var resp InternalLinkTypeGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeInstantView(data json.RawMessage) (*InternalLinkTypeInstantView, error) { var resp InternalLinkTypeInstantView @@ -19992,14 +20227,6 @@ func UnmarshalBlockListStories(data json.RawMessage) (*BlockListStories, error) return &resp, err } -func UnmarshalFilePart(data json.RawMessage) (*FilePart, error) { - var resp FilePart - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalFileTypeNone(data json.RawMessage) (*FileTypeNone, error) { var resp FileTypeNone @@ -20656,6 +20883,14 @@ func UnmarshalText(data json.RawMessage) (*Text, error) { return &resp, err } +func UnmarshalData(data json.RawMessage) (*Data, error) { + var resp Data + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSeconds(data json.RawMessage) (*Seconds, error) { var resp Seconds @@ -21768,6 +22003,22 @@ func UnmarshalUpdateGroupCallParticipant(data json.RawMessage) (*UpdateGroupCall return &resp, err } +func UnmarshalUpdateGroupCallParticipants(data json.RawMessage) (*UpdateGroupCallParticipants, error) { + var resp UpdateGroupCallParticipants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateGroupCallVerificationState(data json.RawMessage) (*UpdateGroupCallVerificationState, error) { + var resp UpdateGroupCallVerificationState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewCallSignalingData(data json.RawMessage) (*UpdateNewCallSignalingData, error) { var resp UpdateNewCallSignalingData @@ -21816,16 +22067,16 @@ func UnmarshalUpdateStoryDeleted(data json.RawMessage) (*UpdateStoryDeleted, err return &resp, err } -func UnmarshalUpdateStorySendSucceeded(data json.RawMessage) (*UpdateStorySendSucceeded, error) { - var resp UpdateStorySendSucceeded +func UnmarshalUpdateStoryPostSucceeded(data json.RawMessage) (*UpdateStoryPostSucceeded, error) { + var resp UpdateStoryPostSucceeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUpdateStorySendFailed(data json.RawMessage) (*UpdateStorySendFailed, error) { - var resp UpdateStorySendFailed +func UnmarshalUpdateStoryPostFailed(data json.RawMessage) (*UpdateStoryPostFailed, error) { + var resp UpdateStoryPostFailed err := json.Unmarshal(data, &resp) @@ -24062,6 +24313,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeExternalVideo: return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeGroupCall: + return UnmarshalLinkPreviewTypeGroupCall(data) + case TypeLinkPreviewTypeInvoice: return UnmarshalLinkPreviewTypeInvoice(data) @@ -24530,6 +24784,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageCall: return UnmarshalMessageCall(data) + case TypeMessageGroupCall: + return UnmarshalMessageGroupCall(data) + case TypeMessageVideoChatScheduled: return UnmarshalMessageVideoChatScheduled(data) @@ -25232,8 +25489,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCallDiscardReasonHungUp: return UnmarshalCallDiscardReasonHungUp(data) - case TypeCallDiscardReasonAllowGroupCall: - return UnmarshalCallDiscardReasonAllowGroupCall(data) + case TypeCallDiscardReasonUpgradeToGroupCall: + return UnmarshalCallDiscardReasonUpgradeToGroupCall(data) case TypeCallProtocol: return UnmarshalCallProtocol(data) @@ -25271,6 +25528,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCallStateError: return UnmarshalCallStateError(data) + case TypeGroupCallJoinParameters: + return UnmarshalGroupCallJoinParameters(data) + case TypeGroupCallVideoQualityThumbnail: return UnmarshalGroupCallVideoQualityThumbnail(data) @@ -25280,11 +25540,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGroupCallVideoQualityFull: return UnmarshalGroupCallVideoQualityFull(data) - case TypeGroupCallStream: - return UnmarshalGroupCallStream(data) + case TypeVideoChatStream: + return UnmarshalVideoChatStream(data) - case TypeGroupCallStreams: - return UnmarshalGroupCallStreams(data) + case TypeVideoChatStreams: + return UnmarshalVideoChatStreams(data) case TypeRtmpUrl: return UnmarshalRtmpUrl(data) @@ -25304,6 +25564,36 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGroupCallParticipant: return UnmarshalGroupCallParticipant(data) + case TypeGroupCallParticipants: + return UnmarshalGroupCallParticipants(data) + + case TypeGroupCallInfo: + return UnmarshalGroupCallInfo(data) + + case TypeInviteGroupCallParticipantResultUserPrivacyRestricted: + return UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(data) + + case TypeInviteGroupCallParticipantResultUserAlreadyParticipant: + return UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(data) + + case TypeInviteGroupCallParticipantResultUserWasBanned: + return UnmarshalInviteGroupCallParticipantResultUserWasBanned(data) + + case TypeInviteGroupCallParticipantResultSuccess: + return UnmarshalInviteGroupCallParticipantResultSuccess(data) + + case TypeGroupCallDataChannelMain: + return UnmarshalGroupCallDataChannelMain(data) + + case TypeGroupCallDataChannelScreenSharing: + return UnmarshalGroupCallDataChannelScreenSharing(data) + + case TypeInputGroupCallLink: + return UnmarshalInputGroupCallLink(data) + + case TypeInputGroupCallMessage: + return UnmarshalInputGroupCallMessage(data) + case TypeCallProblemEcho: return UnmarshalCallProblemEcho(data) @@ -25763,11 +26053,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumLimitTypeActiveStoryCount: return UnmarshalPremiumLimitTypeActiveStoryCount(data) - case TypePremiumLimitTypeWeeklySentStoryCount: - return UnmarshalPremiumLimitTypeWeeklySentStoryCount(data) + case TypePremiumLimitTypeWeeklyPostedStoryCount: + return UnmarshalPremiumLimitTypeWeeklyPostedStoryCount(data) - case TypePremiumLimitTypeMonthlySentStoryCount: - return UnmarshalPremiumLimitTypeMonthlySentStoryCount(data) + case TypePremiumLimitTypeMonthlyPostedStoryCount: + return UnmarshalPremiumLimitTypeMonthlyPostedStoryCount(data) case TypePremiumLimitTypeStoryCaptionLength: return UnmarshalPremiumLimitTypeStoryCaptionLength(data) @@ -26069,23 +26359,23 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeHashtags: return UnmarshalHashtags(data) - case TypeCanSendStoryResultOk: - return UnmarshalCanSendStoryResultOk(data) + case TypeCanPostStoryResultOk: + return UnmarshalCanPostStoryResultOk(data) - case TypeCanSendStoryResultPremiumNeeded: - return UnmarshalCanSendStoryResultPremiumNeeded(data) + case TypeCanPostStoryResultPremiumNeeded: + return UnmarshalCanPostStoryResultPremiumNeeded(data) - case TypeCanSendStoryResultBoostNeeded: - return UnmarshalCanSendStoryResultBoostNeeded(data) + case TypeCanPostStoryResultBoostNeeded: + return UnmarshalCanPostStoryResultBoostNeeded(data) - case TypeCanSendStoryResultActiveStoryLimitExceeded: - return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data) + case TypeCanPostStoryResultActiveStoryLimitExceeded: + return UnmarshalCanPostStoryResultActiveStoryLimitExceeded(data) - case TypeCanSendStoryResultWeeklyLimitExceeded: - return UnmarshalCanSendStoryResultWeeklyLimitExceeded(data) + case TypeCanPostStoryResultWeeklyLimitExceeded: + return UnmarshalCanPostStoryResultWeeklyLimitExceeded(data) - case TypeCanSendStoryResultMonthlyLimitExceeded: - return UnmarshalCanSendStoryResultMonthlyLimitExceeded(data) + case TypeCanPostStoryResultMonthlyLimitExceeded: + return UnmarshalCanPostStoryResultMonthlyLimitExceeded(data) case TypeCanTransferOwnershipResultOk: return UnmarshalCanTransferOwnershipResultOk(data) @@ -26618,6 +26908,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGroupCall: + return UnmarshalInternalLinkTypeGroupCall(data) + case TypeInternalLinkTypeInstantView: return UnmarshalInternalLinkTypeInstantView(data) @@ -26723,9 +27016,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBlockListStories: return UnmarshalBlockListStories(data) - case TypeFilePart: - return UnmarshalFilePart(data) - case TypeFileTypeNone: return UnmarshalFileTypeNone(data) @@ -26972,6 +27262,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeText: return UnmarshalText(data) + case TypeData: + return UnmarshalData(data) + case TypeSeconds: return UnmarshalSeconds(data) @@ -27389,6 +27682,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateGroupCallParticipant: return UnmarshalUpdateGroupCallParticipant(data) + case TypeUpdateGroupCallParticipants: + return UnmarshalUpdateGroupCallParticipants(data) + + case TypeUpdateGroupCallVerificationState: + return UnmarshalUpdateGroupCallVerificationState(data) + case TypeUpdateNewCallSignalingData: return UnmarshalUpdateNewCallSignalingData(data) @@ -27407,11 +27706,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateStoryDeleted: return UnmarshalUpdateStoryDeleted(data) - case TypeUpdateStorySendSucceeded: - return UnmarshalUpdateStorySendSucceeded(data) + case TypeUpdateStoryPostSucceeded: + return UnmarshalUpdateStoryPostSucceeded(data) - case TypeUpdateStorySendFailed: - return UnmarshalUpdateStorySendFailed(data) + case TypeUpdateStoryPostFailed: + return UnmarshalUpdateStoryPostFailed(data) case TypeUpdateChatActiveStories: return UnmarshalUpdateChatActiveStories(data) diff --git a/data/td_api.tl b/data/td_api.tl index 9247a4e..eb49cac 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -699,7 +699,7 @@ businessGreetingMessageSettings shortcut_id:int32 recipients:businessRecipients //@can_change_gift_settings True, if the bot can change gift receiving settings of the business account //@can_transfer_and_upgrade_gifts True, if the bot can transfer and upgrade gifts received by the business account //@can_transfer_stars True, if the bot can transfer Telegram Stars received by the business account to account of the bot, or use them to upgrade and transfer gifts -//@can_manage_stories True, if the bot can send, edit and delete stories +//@can_manage_stories True, if the bot can post, edit and delete stories businessBotRights can_reply:Bool can_read_messages:Bool can_delete_sent_messages:Bool can_delete_all_messages:Bool can_edit_name:Bool can_edit_bio:Bool can_edit_profile_photo:Bool can_edit_username:Bool can_view_gifts_and_stars:Bool can_sell_gifts:Bool can_change_gift_settings:Bool can_transfer_and_upgrade_gifts:Bool can_transfer_stars:Bool can_manage_stories:Bool = BusinessBotRights; //@description Describes a bot connected to a business account @@ -1775,7 +1775,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@date Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member //@status Status of the current user in the supergroup or channel; custom title will always be empty //@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through -//-getChatSimilarChats, getChatsToSendStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, +//-getChatSimilarChats, getChatsToPostStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, //-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, //-or for chats with messages or stories from publicForwards and foundStories //@boost_level Approximate boost level for the chat @@ -2079,8 +2079,8 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //-messageVideoNote, or messageVoiceNote messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; -//@description Describes a story replied by a given message @story_sender_chat_id The identifier of the sender of the story @story_id The identifier of the story -messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; +//@description Describes a story replied by a given message @story_poster_chat_id The identifier of the poster of the story @story_id The identifier of the story +messageReplyToStory story_poster_chat_id:int53 story_id:int32 = MessageReplyTo; //@class InputMessageReplyTo @description Contains information about the message or the story to be replied @@ -2097,9 +2097,9 @@ inputMessageReplyToMessage message_id:int53 quote:inputTextQuote = InputMessageR inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; //@description Describes a story to be replied -//@story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat and channel stories can't be replied +//@story_poster_chat_id The identifier of the poster of the story. Currently, stories can be replied only in the chat that posted the story; channel stories can't be replied //@story_id The identifier of the story -inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessageReplyTo; +inputMessageReplyToStory story_poster_chat_id:int53 story_id:int32 = InputMessageReplyTo; //@description Describes a fact-check added to the message by an independent checker @@ -2310,13 +2310,13 @@ notificationSettingsScopeChannelChats = NotificationSettingsScope; //@mute_stories True, if story notifications are disabled for the chat //@use_default_story_sound If true, the value for the relevant type of chat is used instead of story_sound_id //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled -//@use_default_show_story_sender If true, the value for the relevant type of chat is used instead of show_story_sender -//@show_story_sender True, if the sender of stories must be displayed in notifications +//@use_default_show_story_poster If true, the value for the relevant type of chat is used instead of show_story_poster +//@show_story_poster True, if the chat that posted a story must be displayed in notifications //@use_default_disable_pinned_message_notifications If true, the value for the relevant type of chat or the forum chat is used instead of disable_pinned_message_notifications //@disable_pinned_message_notifications If true, notifications for incoming pinned messages will be created as for an ordinary unread message //@use_default_disable_mention_notifications If true, the value for the relevant type of chat or the forum chat is used instead of disable_mention_notifications //@disable_mention_notifications If true, notifications for messages with mentions will be created as for an ordinary unread message -chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound_id:int64 use_default_show_preview:Bool show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool use_default_story_sound:Bool story_sound_id:int64 use_default_show_story_sender:Bool show_story_sender:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; +chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound_id:int64 use_default_show_preview:Bool show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool use_default_story_sound:Bool story_sound_id:int64 use_default_show_story_poster:Bool show_story_poster:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; //@description Contains information about notification settings for several chats //@mute_for Time left before notifications will be unmuted, in seconds @@ -2325,10 +2325,10 @@ chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_so //@use_default_mute_stories If true, story notifications are received only for the first 5 chats from topChatCategoryUsers regardless of the value of mute_stories //@mute_stories True, if story notifications are disabled //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled -//@show_story_sender True, if the sender of stories must be displayed in notifications +//@show_story_poster True, if the chat that posted a story must be displayed in notifications //@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message //@disable_mention_notifications True, if notifications for messages with mentions will be created as for an ordinary unread message -scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool story_sound_id:int64 show_story_sender:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings; +scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool story_sound_id:int64 show_story_poster:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings; //@class ReactionNotificationSource @description Describes sources of reactions for which notifications will be shown @@ -2498,7 +2498,7 @@ savedMessagesTags tags:vector = SavedMessagesTags; businessBotManageBar bot_user_id:int53 manage_url:string is_bot_paused:Bool can_bot_reply:Bool = BusinessBotManageBar; -//@description Describes a video chat +//@description Describes a video chat, i.e. a group call bound to a chat //@group_call_id Group call identifier of an active video chat; 0 if none. Full information about the video chat can be received through the method getGroupCall //@has_participants True, if the video chat has participants //@default_participant_id Default group call participant identifier to join the video chat; may be null @@ -3233,6 +3233,9 @@ linkPreviewTypeExternalAudio url:string mime_type:string duration:int32 = LinkPr //@duration Duration of the video, in seconds; 0 if unknown linkPreviewTypeExternalVideo url:string mime_type:string width:int32 height:int32 duration:int32 = LinkPreviewType; +//@description The link is a link to a group call that isn't bound to a chat +linkPreviewTypeGroupCall = LinkPreviewType; + //@description The link is a link to an invoice linkPreviewTypeInvoice = LinkPreviewType; @@ -3254,8 +3257,8 @@ linkPreviewTypeSticker sticker:sticker = LinkPreviewType; //@description The link is a link to a sticker set @stickers Up to 4 stickers from the sticker set linkPreviewTypeStickerSet stickers:vector = LinkPreviewType; -//@description The link is a link to a story. Link preview description is unavailable @story_sender_chat_id The identifier of the chat that posted the story @story_id Story identifier -linkPreviewTypeStory story_sender_chat_id:int53 story_id:int32 = LinkPreviewType; +//@description The link is a link to a story. Link preview description is unavailable @story_poster_chat_id The identifier of the chat that posted the story @story_id Story identifier +linkPreviewTypeStory story_poster_chat_id:int53 story_id:int32 = LinkPreviewType; //@description The link is a link to boost a supergroup chat @photo Photo of the chat; may be null linkPreviewTypeSupergroupBoost photo:chatPhoto = LinkPreviewType; @@ -3934,10 +3937,10 @@ messageGame game:game = MessageContent; messagePoll poll:poll = MessageContent; //@description A message with a forwarded story -//@story_sender_chat_id Identifier of the chat that posted the story +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Story identifier //@via_mention True, if the story was automatically forwarded because of a mention of the user -messageStory story_sender_chat_id:int53 story_id:int32 via_mention:Bool = MessageContent; +messageStory story_poster_chat_id:int53 story_id:int32 via_mention:Bool = MessageContent; //@description A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice //@product_info Information about the product @@ -3954,6 +3957,16 @@ 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 message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, +//-and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. +//-If the call become active or missed, then the call screen must be hidden +//@is_active True, if the call is active, i.e. the called user joined the call +//@was_missed True, if the called user missed or declined the call +//@is_video True, if the call is a video call +//@duration Call duration, in seconds; for left calls only +//@other_participant_ids Identifiers of some other call participants +messageGroupCall is_active:Bool was_missed:Bool is_video:Bool duration:int32 other_participant_ids:vector = 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 expected to be started by an administrator messageVideoChatScheduled group_call_id:int32 start_date:int32 = MessageContent; @@ -4512,10 +4525,10 @@ inputMessageInvoice invoice:invoice title:string description:string photo_url:st //@is_closed True, if the poll needs to be sent already closed; for bots only inputMessagePoll question:formattedText options:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent; -//@description A message with a forwarded story. Stories can't be sent to secret chats. A story can be forwarded only if story.can_be_forwarded -//@story_sender_chat_id Identifier of the chat that posted the story +//@description A message with a forwarded story. Stories can't be forwarded to secret chats. A story can be forwarded only if story.can_be_forwarded +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Story identifier -inputMessageStory story_sender_chat_id:int53 story_id:int32 = InputMessageContent; +inputMessageStory story_poster_chat_id:int53 story_id:int32 = InputMessageContent; //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from @@ -4890,7 +4903,7 @@ inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryAr inputStoryAreas areas:vector = InputStoryAreas; -//@description Describes a video file sent in a story +//@description Describes a video file posted as a story //@duration Duration of the video, in seconds //@width Video width //@height Video height @@ -4916,7 +4929,7 @@ storyContentVideo video:storyVideo alternative_video:storyVideo = StoryContent; storyContentUnsupported = StoryContent; -//@class InputStoryContent @description The content of a story to send +//@class InputStoryContent @description The content of a story to post //@description A photo story //@photo Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 @@ -4943,11 +4956,11 @@ storyListArchive = StoryList; //@class StoryOrigin @description Contains information about the origin of a story that was reposted -//@description The original story was a public story with known sender @chat_id Identifier of the chat that posted original story @story_id Story identifier of the original story +//@description The original story was a public story that was posted by a known chat @chat_id Identifier of the chat that posted original story @story_id Story identifier of the original story storyOriginPublicStory chat_id:int53 story_id:int32 = StoryOrigin; -//@description The original story was sent by an unknown user @sender_name Name of the story sender -storyOriginHiddenUser sender_name:string = StoryOrigin; +//@description The original story was posted by an unknown user @poster_name Name of the user or the chat that posted the story +storyOriginHiddenUser poster_name:string = StoryOrigin; //@description Contains information about original story that was reposted @@ -4963,19 +4976,19 @@ storyRepostInfo origin:StoryOrigin is_content_modified:Bool = StoryRepostInfo; storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 recent_viewer_user_ids:vector = StoryInteractionInfo; //@description Represents a story -//@id Unique story identifier among stories of the given sender -//@sender_chat_id Identifier of the chat that posted the story -//@sender_id Identifier of the sender of the story; may be null if the story is posted on behalf of the sender_chat_id +//@id Unique story identifier among stories posted by the given chat +//@poster_chat_id Identifier of the chat that posted the story +//@poster_id Identifier of the user or chat that posted the story; may be null if the story is posted on behalf of the poster_chat_id //@date Point in time (Unix timestamp) when the story was published -//@is_being_sent True, if the story is being sent by the current user +//@is_being_posted True, if the story is being posted by the current user //@is_being_edited True, if the story is being edited by the current user //@is_edited True, if the story was edited -//@is_posted_to_chat_page True, if the story is saved in the sender's profile and will be available there after expiration +//@is_posted_to_chat_page True, if the story is saved in the profile of the chat that posted it and will be available there after expiration //@is_visible_only_for_self True, if the story is visible only for the current user //@can_be_deleted True, if the story can be deleted //@can_be_edited True, if the story can be edited //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden -//@can_be_replied True, if the story can be replied in the chat with the story sender +//@can_be_replied True, if the story can be replied in the chat with the user that posted the story //@can_toggle_is_posted_to_chat_page True, if the story's is_posted_to_chat_page value can be changed //@can_get_statistics True, if the story statistics are available through getStoryStatistics //@can_get_interactions True, if interactions with the story can be received through getStoryInteractions @@ -4987,7 +5000,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story id:int32 sender_chat_id:int53 sender_id:MessageSender date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +story id:int32 poster_chat_id:int53 poster_id:MessageSender date:int32 is_being_posted:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; //@description Represents a list of stories //@total_count Approximate total number of stories found @@ -4998,13 +5011,13 @@ stories total_count:int32 stories:vector pinned_story_ids:vector = //@description Contains a list of stories found by a search @total_count Approximate total number of stories found @stories List of stories @next_offset The offset for the next request. If empty, then there are no more results foundStories total_count:int32 stories:vector next_offset:string = FoundStories; -//@description Contains identifier of a story along with identifier of its sender -//@sender_chat_id Identifier of the chat that posted the story -//@story_id Unique story identifier among stories of the given sender -storyFullId sender_chat_id:int53 story_id:int32 = StoryFullId; +//@description Contains identifier of a story along with identifier of the chat that posted it +//@poster_chat_id Identifier of the chat that posted the story +//@story_id Unique story identifier among stories of the chat +storyFullId poster_chat_id:int53 story_id:int32 = StoryFullId; //@description Contains basic information about a story -//@story_id Unique story identifier among stories of the given sender +//@story_id Unique story identifier among stories of the chat //@date Point in time (Unix timestamp) when the story was published //@is_for_close_friends True, if the story is available only to close friends storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; @@ -5012,7 +5025,7 @@ storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; //@description Describes active stories posted by a chat //@chat_id Identifier of the chat that posted the stories //@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list -//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order +//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order //@max_read_story_id Identifier of the last read active story //@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; @@ -5222,9 +5235,8 @@ callDiscardReasonDisconnected = CallDiscardReason; //@description The call was ended because one of the parties hung up callDiscardReasonHungUp = CallDiscardReason; -//@description The call was ended because it has been used successfully to transfer private encryption key for the associated group call -//@encrypted_group_call_key Encrypted using the call private key encryption key for the associated group call -callDiscardReasonAllowGroupCall encrypted_group_call_key:bytes = CallDiscardReason; +//@description The call was ended because it has been upgraded to a group call @invite_link Invite link for the group call +callDiscardReasonUpgradeToGroupCall invite_link:string = CallDiscardReason; //@description Specifies the supported call protocols @@ -5280,8 +5292,9 @@ callStateExchangingKeys = CallState; //@encryption_key Call encryption key //@emojis Encryption key fingerprint represented as 4 emoji //@allow_p2p True, if peer-to-peer connection is allowed by users privacy settings +//@is_group_call_supported True, if the other party supports upgrading of the call to a group call //@custom_parameters Custom JSON-encoded call parameters to be passed to tgcalls -callStateReady protocol:callProtocol servers:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool custom_parameters:string = CallState; +callStateReady protocol:callProtocol servers:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool is_group_call_supported:Bool custom_parameters:string = CallState; //@description The call is hanging up after discardCall has been called callStateHangingUp = CallState; @@ -5297,6 +5310,14 @@ callStateDiscarded reason:CallDiscardReason need_rating:Bool need_debug_informat callStateError error:error = CallState; +//@description Describes parameters used to join a group call +//@audio_source_id Audio channel synchronization source identifier; received from tgcalls +//@payload Group call join payload; received from tgcalls +//@is_muted Pass true to join the call with muted microphone +//@is_my_video_enabled Pass true if the user's video is enabled +groupCallJoinParameters audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool = GroupCallJoinParameters; + + //@class GroupCallVideoQuality @description Describes the quality of a group call video //@description The worst available video quality @@ -5309,14 +5330,14 @@ groupCallVideoQualityMedium = GroupCallVideoQuality; groupCallVideoQualityFull = GroupCallVideoQuality; -//@description Describes an available stream in a group call +//@description Describes an available stream in a video chat //@channel_id Identifier of an audio/video channel //@scale Scale of segment durations in the stream. The duration is 1000/(2**scale) milliseconds //@time_offset Point in time when the stream currently ends; Unix timestamp in milliseconds -groupCallStream channel_id:int32 scale:int32 time_offset:int53 = GroupCallStream; +videoChatStream channel_id:int32 scale:int32 time_offset:int53 = VideoChatStream; -//@description Represents a list of group call streams @streams A list of group call streams -groupCallStreams streams:vector = GroupCallStreams; +//@description Represents a list of video chat streams @streams A list of video chat streams +videoChatStreams streams:vector = VideoChatStreams; //@description Represents an RTMP URL @url The URL @stream_key Stream key rtmpUrl url:string stream_key:string = RtmpUrl; @@ -5327,28 +5348,30 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@description Describes a group call //@id Group call identifier -//@from_call_id Identifier of one-to-one call from which the group call was created; 0 if unknown -//@title Group call title -//@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 +//@title Group call title; for video chats only +//@invite_link Invite link for the group call; for group calls that aren't bound to a chat. For video chats call getVideoChatInviteLink to get the link +//@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; for video chats only +//@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call starts; for video chats only //@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 +//@is_video_chat True, if the call is bound to a chat +//@is_rtmp_stream True, if the call is an RTMP stream instead of an ordinary video chat; for video chats only //@is_joined True, if the call is joined //@need_rejoin True, if user was kicked from the call because of network loss and the call needs to be rejoined -//@can_be_managed True, if the current user can manage the group call +//@is_owned True, if the user is the owner of the call and can end the call, change volume level of other users, or ban users there; for group calls that aren't bound to a chat +//@can_be_managed True, if the current user can manage the group call; for video chats only //@participant_count Number of participants in the group call -//@has_hidden_listeners True, if group call participants, which are muted, aren't returned in participant list +//@has_hidden_listeners True, if group call participants, which are muted, aren't returned in participant list; for video chats only //@loaded_all_participants True, if all group call participants are loaded //@recent_speakers At most 3 recently speaking users in the group call //@is_my_video_enabled True, if the current user's video is enabled //@is_my_video_paused True, if the current user's video is paused //@can_enable_video True, if the current user can broadcast video or share screen -//@mute_new_participants True, if only group call administrators can unmute new participants -//@can_toggle_mute_new_participants True, if the current user can enable or disable mute_new_participants setting +//@mute_new_participants True, if only group call administrators can unmute new participants; for video chats only +//@can_toggle_mute_new_participants True, if the current user can enable or disable mute_new_participants setting; for video chats only //@record_duration Duration of the ongoing group call recording, in seconds; 0 if none. An updateGroupCall update is not triggered when value of this field changes, but the same recording goes on //@is_video_recorded True, if a video file is being recorded for the call //@duration Call duration, in seconds; for ended calls only -groupCall id:int32 from_call_id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; +groupCall id:int32 title:string invite_link:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_video_chat:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool is_owned:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; //@description Describes a group of video synchronization source identifiers @semantics The semantics of sources, one of "SIM" or "FID" @source_ids The list of synchronization source identifiers groupCallVideoSourceGroup semantics:string source_ids:vector = GroupCallVideoSourceGroup; @@ -5380,6 +5403,49 @@ groupCallParticipantVideoInfo source_groups:vector en //@order User's order in the group call participant list. Orders must be compared lexicographically. The bigger is order, the higher is user in the list. If order is empty, the user must be removed from the participant list groupCallParticipant participant_id:MessageSender audio_source_id:int32 screen_sharing_audio_source_id:int32 video_info:groupCallParticipantVideoInfo screen_sharing_video_info:groupCallParticipantVideoInfo bio:string is_current_user:Bool is_speaking:Bool is_hand_raised:Bool can_be_muted_for_all_users:Bool can_be_unmuted_for_all_users:Bool can_be_muted_for_current_user:Bool can_be_unmuted_for_current_user:Bool is_muted_for_all_users:Bool is_muted_for_current_user:Bool can_unmute_self:Bool volume_level:int32 order:string = GroupCallParticipant; +//@description Contains identifiers of group call participants @total_count Total number of group call participants @participant_ids Identifiers of the participants +groupCallParticipants total_count:int32 participant_ids:vector = GroupCallParticipants; + +//@description Contains information about a just created or just joined group call @group_call_id Identifier of the group call @join_payload Join response payload for tgcalls; empty if the call isn't joined +groupCallInfo group_call_id:int32 join_payload:string = GroupCallInfo; + + +//@class InviteGroupCallParticipantResult @description Describes result of group call participant invitation + +//@description The user can't be invited due to their privacy settings +inviteGroupCallParticipantResultUserPrivacyRestricted = InviteGroupCallParticipantResult; + +//@description The user can't be invited because they are already a participant of the call +inviteGroupCallParticipantResultUserAlreadyParticipant = InviteGroupCallParticipantResult; + +//@description The user can't be invited because they were banned by the owner of the call and can be invited back only by the owner of the group call +inviteGroupCallParticipantResultUserWasBanned = InviteGroupCallParticipantResult; + +//@description The user was invited and a service message of the type messageGroupCall was sent which can be used in declineGroupCallInvitation to cancel the invitation +//@chat_id Identifier of the chat with the invitation message +//@message_id Identifier of the message +inviteGroupCallParticipantResultSuccess chat_id:int53 message_id:int53 = InviteGroupCallParticipantResult; + + +//@class GroupCallDataChannel @description Describes data channel for a group call + +//@description The main data channel for audio and video data +groupCallDataChannelMain = GroupCallDataChannel; + +//@description The data channel for screen sharing +groupCallDataChannelScreenSharing = GroupCallDataChannel; + + +//@class InputGroupCall @description Describes a non-joined group call that isn't bound to a chat + +//@description The group call is accessible through a link @link The link for the group call +inputGroupCallLink link:string = InputGroupCall; + +//@description The group call is accessible through a message of the type messageGroupCall +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message of the type messageGroupCall +inputGroupCallMessage chat_id:int53 message_id:int53 = InputGroupCall; + //@class CallProblem @description Describes the exact type of problem with a call @@ -5417,8 +5483,7 @@ callProblemPixelatedVideo = CallProblem; //@is_outgoing True, if the call is outgoing //@is_video True, if the call is a video call //@state Call state -//@group_call_id Identifier of the group call associated with the call; 0 if the group call isn't created yet. The group call can be received through the method getGroupCall -call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState group_call_id:int32 = Call; +call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState = Call; //@class FirebaseAuthenticationSettings @description Contains settings for Firebase Authentication in the official applications @@ -5437,7 +5502,7 @@ firebaseAuthenticationSettingsIos device_token:string is_app_sandbox:Bool = Fire //@has_unknown_phone_number Pass true if there is a SIM card in the current device, but it is not possible to check whether phone number matches //@allow_sms_retriever_api For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details //@firebase_authentication_settings For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication -//@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions +//@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions; for setAuthenticationPhoneNumber only phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool has_unknown_phone_number:Bool allow_sms_retriever_api:Bool firebase_authentication_settings:FirebaseAuthenticationSettings authentication_tokens:vector = PhoneNumberAuthenticationSettings; @@ -6160,13 +6225,13 @@ premiumLimitTypeShareableChatFolderCount = PremiumLimitType; //@description The maximum number of active stories premiumLimitTypeActiveStoryCount = PremiumLimitType; -//@description The maximum number of stories sent per week -premiumLimitTypeWeeklySentStoryCount = PremiumLimitType; +//@description The maximum number of stories posted per week +premiumLimitTypeWeeklyPostedStoryCount = PremiumLimitType; -//@description The maximum number of stories sent per month -premiumLimitTypeMonthlySentStoryCount = PremiumLimitType; +//@description The maximum number of stories posted per month +premiumLimitTypeMonthlyPostedStoryCount = PremiumLimitType; -//@description The maximum length of captions of sent stories +//@description The maximum length of captions of posted stories premiumLimitTypeStoryCaptionLength = PremiumLimitType; //@description The maximum number of suggested reaction areas on a story @@ -6588,25 +6653,25 @@ timeZones time_zones:vector = TimeZones; hashtags hashtags:vector = Hashtags; -//@class CanSendStoryResult @description Represents result of checking whether the current user can send a story in the specific chat +//@class CanPostStoryResult @description Represents result of checking whether the current user can post a story on behalf of the specific chat //@description A story can be sent -canSendStoryResultOk = CanSendStoryResult; +canPostStoryResultOk = CanPostStoryResult; //@description The user must subscribe to Telegram Premium to be able to post stories -canSendStoryResultPremiumNeeded = CanSendStoryResult; +canPostStoryResultPremiumNeeded = CanPostStoryResult; //@description The chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat -canSendStoryResultBoostNeeded = CanSendStoryResult; +canPostStoryResultBoostNeeded = CanPostStoryResult; //@description The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire -canSendStoryResultActiveStoryLimitExceeded = CanSendStoryResult; +canPostStoryResultActiveStoryLimitExceeded = CanPostStoryResult; -//@description The weekly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time @retry_after Time left before the user can send the next story -canSendStoryResultWeeklyLimitExceeded retry_after:int32 = CanSendStoryResult; +//@description The weekly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time @retry_after Time left before the user can post the next story +canPostStoryResultWeeklyLimitExceeded retry_after:int32 = CanPostStoryResult; -//@description The monthly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time @retry_after Time left before the user can send the next story -canSendStoryResultMonthlyLimitExceeded retry_after:int32 = CanSendStoryResult; +//@description The monthly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time @retry_after Time left before the user can post the next story +canPostStoryResultMonthlyLimitExceeded retry_after:int32 = CanPostStoryResult; //@class CanTransferOwnershipResult @description Represents result of checking whether the current session can be used to transfer a chat ownership to another user @@ -7333,6 +7398,9 @@ internalLinkTypeEditProfileSettings = InternalLinkType; //@game_short_name Short name of the game internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkType; +//@description The link is a link to a group call that isn't bound to a chat. Call joinGroupCall with the given invite_link @invite_link Internal representation of the invite link +internalLinkTypeGroupCall invite_link:string = InternalLinkType; + //@description The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. //-If Instant View is found, then show it, otherwise, open the fallback URL in an external browser //@url URL to be passed to getWebPageInstantView @@ -7431,10 +7499,10 @@ internalLinkTypeSettings = InternalLinkType; //@expect_custom_emoji True, if the sticker set is expected to contain custom emoji internalLinkTypeStickerSet sticker_set_name:string expect_custom_emoji:Bool = InternalLinkType; -//@description The link is a link to a story. Call searchPublicChat with the given sender username, then call getStory with the received chat identifier and the given story identifier, then show the story if received -//@story_sender_username Username of the sender of the story +//@description The link is a link to a story. Call searchPublicChat with the given poster username, then call getStory with the received chat identifier and the given story identifier, then show the story if received +//@story_poster_username Username of the poster of the story //@story_id Story identifier -internalLinkTypeStory story_sender_username:string story_id:int32 = InternalLinkType; +internalLinkTypeStory story_poster_username:string story_id:int32 = InternalLinkType; //@description The link is a link to a cloud theme. TDLib has no theme support yet @theme_name Name of the theme internalLinkTypeTheme theme_name:string = InternalLinkType; @@ -7463,7 +7531,7 @@ internalLinkTypeUserPhoneNumber phone_number:string draft_text:string open_profi //@token The token internalLinkTypeUserToken token:string = InternalLinkType; -//@description The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinGroupCall with the given invite hash to process the link +//@description The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinVideoChat with the given invite hash to process the link //@chat_username Username of the chat with the video chat //@invite_hash If non-empty, invite hash to be used to join the video chat without being muted by administrators //@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group @@ -7512,10 +7580,6 @@ blockListMain = BlockList; blockListStories = BlockList; -//@description Contains a part of a file @data File bytes -filePart data:bytes = FilePart; - - //@class FileType @description Represents the type of file //@description The data is not a file @@ -7837,6 +7901,9 @@ count count:int32 = Count; //@description Contains some text @text Text text text:string = Text; +//@description Contains some binary data @data Data +data data:bytes = Data; + //@description Contains a value representing a number of seconds @seconds Number of seconds seconds seconds:double = Seconds; @@ -7921,11 +7988,11 @@ statisticalGraphError error_message:string = StatisticalGraph; //@description Describes a message sent in the chat @message_id Message identifier chatStatisticsObjectTypeMessage message_id:int53 = ChatStatisticsObjectType; -//@description Describes a story sent by the chat @story_id Story identifier +//@description Describes a story posted on behalf of the chat @story_id Story identifier chatStatisticsObjectTypeStory story_id:int32 = ChatStatisticsObjectType; -//@description Contains statistics about interactions with a message sent in the chat or a story sent by the chat +//@description Contains statistics about interactions with a message sent in the chat or a story posted on behalf of the chat //@object_type Type of the object //@view_count Number of times the object was viewed //@forward_count Number of times the object was forwarded @@ -7978,9 +8045,9 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_ //@mean_message_view_count Mean number of times the recently sent messages were viewed //@mean_message_share_count Mean number of times the recently sent messages were shared //@mean_message_reaction_count Mean number of times reactions were added to the recently sent messages -//@mean_story_view_count Mean number of times the recently sent stories were viewed -//@mean_story_share_count Mean number of times the recently sent stories were shared -//@mean_story_reaction_count Mean number of times reactions were added to the recently sent stories +//@mean_story_view_count Mean number of times the recently posted stories were viewed +//@mean_story_share_count Mean number of times the recently posted stories were shared +//@mean_story_reaction_count Mean number of times reactions were added to the recently posted stories //@enabled_notifications_percentage A percentage of users with enabled notifications for the chat; 0-100 //@member_count_graph A graph containing number of members in the chat //@join_graph A graph containing number of members joined and left the chat @@ -7994,7 +8061,7 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_ //@story_interaction_graph A graph containing number of story views and shares //@story_reaction_graph A graph containing number of reactions on stories //@instant_view_interaction_graph A graph containing number of views of associated with the chat instant views -//@recent_interactions Detailed statistics about number of views and shares of recently sent messages and stories +//@recent_interactions Detailed statistics about number of views and shares of recently sent messages and posted stories chatStatisticsChannel period:dateRange member_count:statisticalValue mean_message_view_count:statisticalValue mean_message_share_count:statisticalValue mean_message_reaction_count:statisticalValue mean_story_view_count:statisticalValue mean_story_share_count:statisticalValue mean_story_reaction_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_interactions:vector = ChatStatistics; @@ -8359,9 +8426,10 @@ updateForumTopicInfo info:forumTopicInfo = Update; //@chat_id Chat identifier //@message_thread_id Message thread identifier of the topic //@is_pinned True, if the topic is pinned in the topic list +//@last_read_inbox_message_id Identifier of the last read incoming message //@last_read_outbox_message_id Identifier of the last read outgoing message //@notification_settings Notification settings for the topic -updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_outbox_message_id:int53 notification_settings:chatNotificationSettings = Update; +updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 notification_settings:chatNotificationSettings = Update; //@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; @@ -8486,14 +8554,26 @@ updateApplicationRecaptchaVerificationRequired verification_id:int53 action:stri //@description New call was created or information about a call was updated @call New data about a call updateCall call:call = Update; -//@description Information about a group call was updated @group_call New data about a group call +//@description Information about a group call was updated @group_call New data about the group call updateGroupCall group_call:groupCall = Update; //@description Information about a group call participant was changed. The updates are sent only after the group call is received through getGroupCall and only if the call is joined or being joined -//@group_call_id Identifier of group call -//@participant New data about a participant +//@group_call_id Identifier of the group call +//@participant New data about the participant updateGroupCallParticipant group_call_id:int32 participant:groupCallParticipant = Update; +//@description The list of group call participants that can send and receive encrypted call data has changed; for group calls not bound to a chat only +//@group_call_id Identifier of the group call +//@participant_user_ids New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. +//-The participants must be shown in the list of group call participants even there is no information about them +updateGroupCallParticipants group_call_id:int32 participant_user_ids:vector = Update; + +//@description The verification state of an encrypted group call has changed; for group calls not bound to a chat only +//@group_call_id Identifier of the group call +//@generation The call state generation to which the emoji corresponds. If generation is different for two users, then their emoji may be also different +//@emojis Group call state fingerprint represented as 4 emoji; may be empty if the state isn't verified yet +updateGroupCallVerificationState group_call_id:int32 generation:int32 emojis:vector = Update; + //@description New call signaling data arrived @call_id The call identifier @data The data updateNewCallSignalingData call_id:int32 data:bytes = Update; @@ -8518,17 +8598,17 @@ updateUnreadChatCount chat_list:ChatList total_count:int32 unread_count:int32 un //@description A story was changed @story The new information about the story updateStory story:story = Update; -//@description A story became inaccessible @story_sender_chat_id Identifier of the chat that posted the story @story_id Story identifier -updateStoryDeleted story_sender_chat_id:int53 story_id:int32 = Update; +//@description A story became inaccessible @story_poster_chat_id Identifier of the chat that posted the story @story_id Story identifier +updateStoryDeleted story_poster_chat_id:int53 story_id:int32 = Update; -//@description A story has been successfully sent @story The sent story @old_story_id The previous temporary story identifier -updateStorySendSucceeded story:story old_story_id:int32 = Update; +//@description A story has been successfully posted @story The posted story @old_story_id The previous temporary story identifier +updateStoryPostSucceeded story:story old_story_id:int32 = Update; -//@description A story failed to send. If the story sending is canceled, then updateStoryDeleted will be received instead of this update -//@story The failed to send story -//@error The cause of the story sending failure +//@description A story failed to post. If the story posting is canceled, then updateStoryDeleted will be received instead of this update +//@story The failed to post story +//@error The cause of the story posting failure //@error_type Type of the error; may be null if unknown -updateStorySendFailed story:story error:error error_type:CanSendStoryResult = Update; +updateStoryPostFailed story:story error:error error_type:CanPostStoryResult = Update; //@description The list of active stories posted by a specific chat has changed //@active_stories The new list of active stories @@ -9339,7 +9419,7 @@ searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit searchSavedMessages saved_messages_topic_id:int53 tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; -//@description Searches for call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib +//@description Searches for call and group call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib //@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 messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@only_missed Pass true to search only for messages with missed/declined calls @@ -9357,11 +9437,11 @@ searchOutgoingDocumentMessages query:string limit:int32 = FoundMessages; searchPublicMessagesByTag tag:string offset:string limit:int32 = FoundMessages; //@description Searches for public stories containing the given hashtag or cashtag. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -//@story_sender_chat_id Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats +//@story_poster_chat_id Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats //@tag Hashtag or cashtag to search for //@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 stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -searchPublicStoriesByTag story_sender_chat_id:int53 tag:string offset:string limit:int32 = FoundStories; +searchPublicStoriesByTag story_poster_chat_id:int53 tag:string offset:string limit:int32 = FoundStories; //@description Searches for public stories by the given address location. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit //@address Address of the location @@ -9788,16 +9868,16 @@ readBusinessMessage business_connection_id:string chat_id:int53 message_id:int53 //@message_ids Identifier of the messages deleteBusinessMessages business_connection_id:string message_ids:vector = Ok; -//@description Changes a story sent by the bot on behalf of a business account; for bots only -//@story_sender_chat_id Identifier of the chat that posted the story +//@description Changes a story posted by the bot on behalf of a business account; for bots only +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to edit //@content New content of the story //@areas New clickable rectangle areas to be shown on the story media //@caption New story caption //@privacy_settings The new privacy settings for the story -editBusinessStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings = Story; +editBusinessStory story_poster_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings = Story; -//@description Deletes a story sent by the bot on behalf of a business account; for bots only +//@description Deletes a story posted by the bot on behalf of a business account; for bots only //@business_connection_id Unique identifier of business connection //@story_id Identifier of the story to delete deleteBusinessStory business_connection_id:string story_id:int32 = Ok; @@ -10718,43 +10798,43 @@ getCurrentWeather location:location = CurrentWeather; //@description Returns a story -//@story_sender_chat_id Identifier of the chat that posted the story +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Story identifier //@only_local Pass true to get only locally available information without sending network requests -getStory story_sender_chat_id:int53 story_id:int32 only_local:Bool = Story; +getStory story_poster_chat_id:int53 story_id:int32 only_local:Bool = Story; -//@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there -getChatsToSendStories = Chats; +//@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canPostStory before actually trying to post a story there +getChatsToPostStories = Chats; -//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +//@description Checks whether the current user can post a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats //@chat_id Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user -canSendStory chat_id:int53 = CanSendStoryResult; +canPostStory chat_id:int53 = CanPostStoryResult; -//@description Sends a new story to a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story +//@description Posts a new story on behalf of a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story //@chat_id Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") -//@privacy_settings The privacy settings for the story; ignored for stories sent to supergroup and channel chats +//@privacy_settings The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@from_story_full_id Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story //@is_posted_to_chat_page Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; +postStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; //@description Changes content and caption of a story. Can be called only if story.can_be_edited == true -//@story_sender_chat_id Identifier of the chat that posted the story +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to edit //@content New content of the story; pass null to keep the current content //@areas New clickable rectangle areas to be shown on the story media; pass null to keep the current areas. Areas can't be edited if story content isn't changed //@caption New story caption; pass null to keep the current caption -editStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; +editStory story_poster_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; //@description Changes cover of a video story. Can be called only if story.can_be_edited == true and the story isn't being edited now -//@story_sender_chat_id Identifier of the chat that posted the story +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to edit //@cover_frame_timestamp New timestamp of the frame, which will be used as video thumbnail -editStoryCover story_sender_chat_id:int53 story_id:int32 cover_frame_timestamp:double = Ok; +editStoryCover story_poster_chat_id:int53 story_id:int32 cover_frame_timestamp:double = Ok; //@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true //@story_id Identifier of the story @@ -10762,21 +10842,21 @@ editStoryCover story_sender_chat_id:int53 story_id:int32 cover_frame_timestamp:d setStoryPrivacySettings story_id:int32 privacy_settings:StoryPrivacySettings = Ok; //@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_posted_to_chat_page == true -//@story_sender_chat_id Identifier of the chat that posted the story +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story //@is_posted_to_chat_page Pass true to make the story accessible after expiration; pass false to make it private -toggleStoryIsPostedToChatPage story_sender_chat_id:int53 story_id:int32 is_posted_to_chat_page:Bool = Ok; +toggleStoryIsPostedToChatPage story_poster_chat_id:int53 story_id:int32 is_posted_to_chat_page:Bool = Ok; -//@description Deletes a previously sent story. Can be called only if story.can_be_deleted == true -//@story_sender_chat_id Identifier of the chat that posted the story +//@description Deletes a previously posted story. Can be called only if story.can_be_deleted == true +//@story_poster_chat_id Identifier of the chat that posted the story //@story_id Identifier of the story to delete -deleteStory story_sender_chat_id:int53 story_id:int32 = Ok; +deleteStory story_poster_chat_id:int53 story_id:int32 = Ok; //@description Returns the list of chats with non-default notification settings for stories getStoryNotificationSettingsExceptions = Chats; //@description Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by -//-the pair (active_stories.order, active_stories.story_sender_chat_id) in descending order. Returns a 404 error if all active stories have been loaded +//-the pair (active_stories.order, active_stories.story_poster_chat_id) in descending order. Returns a 404 error if all active stories have been loaded //@story_list The story list in which to load active stories loadActiveStories story_list:StoryList = Ok; @@ -10808,24 +10888,24 @@ getChatArchivedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; setChatPinnedStories chat_id:int53 story_ids:vector = Ok; //@description Informs TDLib that a story is opened and is being viewed by the user -//@story_sender_chat_id The identifier of the sender of the opened story +//@story_poster_chat_id The identifier of the chat that posted the opened story //@story_id The identifier of the story -openStory story_sender_chat_id:int53 story_id:int32 = Ok; +openStory story_poster_chat_id:int53 story_id:int32 = Ok; //@description Informs TDLib that a story is closed by the user -//@story_sender_chat_id The identifier of the sender of the story to close +//@story_poster_chat_id The identifier of the poster of the story to close //@story_id The identifier of the story -closeStory story_sender_chat_id:int53 story_id:int32 = Ok; +closeStory story_poster_chat_id:int53 story_id:int32 = Ok; //@description Returns reactions, which can be chosen for a story @row_size Number of reaction per row, 5-25 getStoryAvailableReactions row_size:int32 = AvailableReactions; //@description Changes chosen reaction on a story that has already been sent -//@story_sender_chat_id The identifier of the sender of the story +//@story_poster_chat_id The identifier of the poster of the story //@story_id The identifier of the story //@reaction_type Type of the reaction to set; pass null to remove the reaction. Custom emoji reactions can be used only by Telegram Premium users. Paid reactions can't be set //@update_recent_reactions Pass true if the reaction needs to be added to recent reactions -setStoryReaction story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType update_recent_reactions:Bool = Ok; +setStoryReaction story_poster_chat_id:int53 story_id:int32 reaction_type:ReactionType update_recent_reactions:Bool = Ok; //@description Returns interactions with a story. The method can be called only for stories posted on behalf of the current user //@story_id Story identifier @@ -10838,20 +10918,20 @@ setStoryReaction story_sender_chat_id:int53 story_id:int32 reaction_type:Reactio getStoryInteractions story_id:int32 query:string only_contacts:Bool prefer_forwards:Bool prefer_with_reaction:Bool offset:string limit:int32 = StoryInteractions; //@description Returns interactions with a story posted in a chat. Can be used only if story is posted on behalf of a chat and the user is an administrator in the chat -//@story_sender_chat_id The identifier of the sender of the story +//@story_poster_chat_id The identifier of the poster of the story //@story_id Story identifier //@reaction_type Pass the default heart reaction or a suggested reaction type to receive only interactions with the specified reaction type; pass null to receive all interactions; reactionTypePaid isn't supported //@prefer_forwards Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date //@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 story interactions to return -getChatStoryInteractions story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType prefer_forwards:Bool offset:string limit:int32 = StoryInteractions; +getChatStoryInteractions story_poster_chat_id:int53 story_id:int32 reaction_type:ReactionType prefer_forwards:Bool offset:string limit:int32 = StoryInteractions; //@description Reports a story to the Telegram moderators -//@story_sender_chat_id The identifier of the sender of the story to report +//@story_poster_chat_id The identifier of the poster of the story to report //@story_id The identifier of the story to report //@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; +reportStory story_poster_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 @@ -10859,11 +10939,11 @@ activateStoryStealthMode = Ok; //@description Returns forwards of a story as a message to public chats and reposts by public channels. Can be used only if the story is posted on behalf of the current user or story.can_get_statistics == true. //-For optimal performance, the number of returned messages and stories is chosen by TDLib -//@story_sender_chat_id The identifier of the sender of the story +//@story_poster_chat_id The identifier of the poster of the story //@story_id The identifier of the story //@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 messages and stories 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 -getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; +getStoryPublicForwards story_poster_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; //@description Returns the list of features available on the specific chat boost level. This is an offline method @@ -10990,7 +11070,7 @@ finishFileGeneration generation_id:int64 error:error = Ok; //@file_id Identifier of the file. The file must be located in the TDLib file cache //@offset The offset from which to read the file //@count Number of bytes to read. An error will be returned if there are not enough bytes available in the file from the specified position. Pass 0 to read all available data from the specified position -readFilePart file_id:int32 offset:int53 count:int53 = FilePart; +readFilePart file_id:int32 offset:int53 count:int53 = Data; //@description Deletes a file from the TDLib file cache @file_id Identifier of the file to delete deleteFile file_id:int32 = Ok; @@ -11152,8 +11232,7 @@ processChatJoinRequests chat_id:int53 invite_link:string approve:Bool = Ok; //@user_id Identifier of the user to be called //@protocol The call protocols supported by the application //@is_video Pass true to create a video call -//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none -createCall user_id:int53 protocol:callProtocol is_video:Bool group_call_id:int32 = CallId; +createCall user_id:int53 protocol:callProtocol is_video:Bool = CallId; //@description Accepts an incoming call @call_id Call identifier @protocol The call protocols supported by the application acceptCall call_id:int32 protocol:callProtocol = Ok; @@ -11164,10 +11243,11 @@ sendCallSignalingData call_id:int32 data:bytes = Ok; //@description Discards a call //@call_id Call identifier //@is_disconnected Pass true if the user was disconnected +//@invite_link If the call was upgraded to a group call, pass invite link to the group call //@duration The call duration, in seconds //@is_video Pass true if the call was a video call //@connection_id Identifier of the connection used during the call -discardCall call_id:int32 is_disconnected:Bool duration:int32 is_video:Bool connection_id:int64 = Ok; +discardCall call_id:int32 is_disconnected:Bool invite_link:string duration:int32 is_video:Bool connection_id:int64 = Ok; //@description Sends a call rating //@call_id Call identifier @@ -11196,36 +11276,35 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; -//@description Creates a group call from a one-to-one call @call_id Call identifier -createGroupCall call_id:int32 = Ok; +//@description Creates a new group call that isn't bound to a chat @join_parameters Parameters to join the call; pass null to only create call link without joining the call +createGroupCall join_parameters:groupCallJoinParameters = GroupCallInfo; -//@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right @chat_id Chat identifier +//@description Returns RTMP URL for streaming to the video chat of a chat; requires can_manage_video_chats administrator right @chat_id Chat identifier getVideoChatRtmpUrl chat_id:int53 = RtmpUrl; -//@description Replaces the current RTMP URL for streaming to the chat; requires owner privileges @chat_id Chat identifier +//@description Replaces the current RTMP URL for streaming to the video chat of a chat; requires owner privileges in the chat @chat_id Chat identifier replaceVideoChatRtmpUrl chat_id:int53 = RtmpUrl; //@description Returns information about a group call @group_call_id Group call identifier getGroupCall group_call_id:int32 = GroupCall; -//@description Starts a scheduled group call @group_call_id Group call identifier -startScheduledGroupCall group_call_id:int32 = Ok; +//@description Starts a scheduled video chat @group_call_id Group call identifier of the video chat +startScheduledVideoChat group_call_id:int32 = Ok; -//@description Toggles whether the current user will receive a notification when the group call starts; scheduled group calls only +//@description Toggles whether the current user will receive a notification when the video chat starts; for scheduled video chats only //@group_call_id Group call identifier //@enabled_start_notification New value of the enabled_start_notification setting -toggleGroupCallEnabledStartNotification group_call_id:int32 enabled_start_notification:Bool = Ok; +toggleVideoChatEnabledStartNotification group_call_id:int32 enabled_start_notification:Bool = Ok; -//@description Joins an active group call. Returns join response payload for tgcalls +//@description Joins a group call that is not bound to a chat @input_group_call The group call to join @join_parameters Parameters to join the call +joinGroupCall input_group_call:InputGroupCall join_parameters:groupCallJoinParameters = GroupCallInfo; + +//@description Joins an active video chat. Returns join response payload for tgcalls //@group_call_id Group call identifier //@participant_id Identifier of a group call participant, which will be used to join the call; pass null to join as self; video chats only -//@audio_source_id Caller audio channel synchronization source identifier; received from tgcalls -//@payload Group call join payload; received from tgcalls -//@is_muted Pass true to join the call with muted microphone -//@is_my_video_enabled Pass true if the user's video is enabled -//@invite_hash If non-empty, invite hash to be used to join the group call without being muted by administrators -//@key_fingerprint Fingerprint of the encryption key for E2E group calls not bound to a chat; pass 0 for voice chats -joinGroupCall group_call_id:int32 participant_id:MessageSender audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool invite_hash:string key_fingerprint:int64 = Text; +//@join_parameters Parameters to join the call +//@invite_hash Invite hash as received from internalLinkTypeVideoChat +joinVideoChat group_call_id:int32 participant_id:MessageSender join_parameters:groupCallJoinParameters invite_hash:string = Text; //@description Starts screen sharing in a joined group call. Returns join response payload for tgcalls //@group_call_id Group call identifier @@ -11239,35 +11318,52 @@ toggleGroupCallScreenSharingIsPaused group_call_id:int32 is_paused:Bool = Ok; //@description Ends screen sharing in a joined group call @group_call_id Group call identifier endGroupCallScreenSharing group_call_id:int32 = Ok; -//@description Sets group call title. Requires groupCall.can_be_managed group call flag @group_call_id Group call identifier @title New group call title; 1-64 characters -setGroupCallTitle group_call_id:int32 title:string = Ok; +//@description Sets title of a video chat; requires groupCall.can_be_managed right @group_call_id Group call identifier @title New group call title; 1-64 characters +setVideoChatTitle group_call_id:int32 title:string = Ok; -//@description Toggles whether new participants of a group call can be unmuted only by administrators of the group call. Requires groupCall.can_toggle_mute_new_participants group call flag +//@description Toggles whether new participants of a video chat can be unmuted only by administrators of the video chat. Requires groupCall.can_toggle_mute_new_participants right //@group_call_id Group call identifier //@mute_new_participants New value of the mute_new_participants setting -toggleGroupCallMuteNewParticipants group_call_id:int32 mute_new_participants:Bool = Ok; +toggleVideoChatMuteNewParticipants group_call_id:int32 mute_new_participants:Bool = Ok; -//@description Invites users to an active group call. Sends a service message of type messageInviteVideoChatParticipants for video chats +//@description Invites a user to an active group call; for group calls not bound to a chat only. Sends a service message of the type messageGroupCall. +//-The group call can have at most getOption("group_call_participant_count_max") participants +//@group_call_id Group call identifier +//@user_id User identifier +//@is_video Pass true if the group call is a video call +inviteGroupCallParticipant group_call_id:int32 user_id:int53 is_video:Bool = InviteGroupCallParticipantResult; + +//@description Declines an invitation to an active group call via messageGroupCall. Can be called both by the sender and the receiver of the invitation +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message of the type messageGroupCall +declineGroupCallInvitation chat_id:int53 message_id:int53 = Ok; + +//@description Bans users from a group call not bound to a chat; requires groupCall.is_owned. Only the owner of the group call can invite the banned users back +//@group_call_id Group call identifier +//@user_ids Identifiers of group call participants to ban; identifiers of unknown users from the update updateGroupCallParticipants can be also passed to the method +banGroupCallParticipants group_call_id:int32 user_ids:vector = Ok; + +//@description Invites users to an active video chat. Sends a service message of the type messageInviteVideoChatParticipants to the chat bound to the group call //@group_call_id Group call identifier //@user_ids User identifiers. At most 10 users can be invited simultaneously -inviteGroupCallParticipants group_call_id:int32 user_ids:vector = Ok; +inviteVideoChatParticipants group_call_id:int32 user_ids:vector = Ok; //@description Returns invite link to a video chat in a public chat //@group_call_id Group call identifier -//@can_self_unmute Pass true if the invite link needs to contain an invite hash, passing which to joinGroupCall would allow the invited user to unmute themselves. Requires groupCall.can_be_managed group call flag -getGroupCallInviteLink group_call_id:int32 can_self_unmute:Bool = HttpUrl; +//@can_self_unmute Pass true if the invite link needs to contain an invite hash, passing which to joinVideoChat would allow the invited user to unmute themselves. Requires groupCall.can_be_managed right +getVideoChatInviteLink group_call_id:int32 can_self_unmute:Bool = HttpUrl; -//@description Revokes invite link for a group call. Requires groupCall.can_be_managed group call flag @group_call_id Group call identifier +//@description Revokes invite link for a group call. Requires groupCall.can_be_managed right for video chats or groupCall.is_owned otherwise @group_call_id Group call identifier revokeGroupCallInviteLink group_call_id:int32 = Ok; -//@description Starts recording of an active group call. Requires groupCall.can_be_managed group call flag +//@description Starts recording of an active group call; for video chats only. Requires groupCall.can_be_managed right //@group_call_id Group call identifier //@title Group call recording title; 0-64 characters //@record_video Pass true to record a video file instead of an audio file //@use_portrait_orientation Pass true to use portrait orientation for video instead of landscape one startGroupCallRecording group_call_id:int32 title:string record_video:Bool use_portrait_orientation:Bool = Ok; -//@description Ends recording of an active group call. Requires groupCall.can_be_managed group call flag @group_call_id Group call identifier +//@description Ends recording of an active group call; for video chats only. Requires groupCall.can_be_managed right @group_call_id Group call identifier endGroupCallRecording group_call_id:int32 = Ok; //@description Toggles whether current user's video is paused @group_call_id Group call identifier @is_my_video_paused Pass true if the current user's video is paused @@ -11276,7 +11372,7 @@ toggleGroupCallIsMyVideoPaused group_call_id:int32 is_my_video_paused:Bool = Ok; //@description Toggles whether current user's video is enabled @group_call_id Group call identifier @is_my_video_enabled Pass true if the current user's video is enabled toggleGroupCallIsMyVideoEnabled group_call_id:int32 is_my_video_enabled:Bool = Ok; -//@description Informs TDLib that speaking state of a participant of an active group has changed +//@description Informs TDLib that speaking state of a participant of an active group call has changed //@group_call_id Group call identifier //@audio_source Group call participant's synchronization audio source identifier, or 0 for the current user //@is_speaking Pass true if the user is speaking @@ -11288,18 +11384,24 @@ setGroupCallParticipantIsSpeaking group_call_id:int32 audio_source:int32 is_spea //@is_muted Pass true to mute the user; pass false to unmute them toggleGroupCallParticipantIsMuted group_call_id:int32 participant_id:MessageSender is_muted:Bool = Ok; -//@description Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant's volume level will be changed for all users with the default volume level +//@description Changes volume level of a participant of an active group call. If the current user can manage the group call or is the owner of the group call, +//-then the participant's volume level will be changed for all users with the default volume level //@group_call_id Group call identifier //@participant_id Participant identifier //@volume_level New participant's volume level; 1-20000 in hundreds of percents setGroupCallParticipantVolumeLevel group_call_id:int32 participant_id:MessageSender volume_level:int32 = Ok; -//@description Toggles whether a group call participant hand is rased +//@description Toggles whether a group call participant hand is rased; for video chats only //@group_call_id Group call identifier //@participant_id Participant identifier -//@is_hand_raised Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed group call flag to lower other's hand +//@is_hand_raised Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed right to lower other's hand toggleGroupCallParticipantIsHandRaised group_call_id:int32 participant_id:MessageSender is_hand_raised:Bool = Ok; +//@description Returns information about participants of a non-joined group call that is not bound to a chat +//@input_group_call The group call which participants will be returned +//@limit The maximum number of participants to return; must be positive +getGroupCallParticipants input_group_call:InputGroupCall limit:int32 = GroupCallParticipants; + //@description Loads more participants of a group call. The loaded participants will be received through updates. Use the field groupCall.loaded_all_participants to check whether all participants have already been loaded //@group_call_id Group call identifier. The group call must be previously received through getGroupCall and must be joined or being joined //@limit The maximum number of participants to load; up to 100 @@ -11308,19 +11410,33 @@ loadGroupCallParticipants group_call_id:int32 limit:int32 = Ok; //@description Leaves a group call @group_call_id Group call identifier leaveGroupCall group_call_id:int32 = Ok; -//@description Ends a group call. Requires groupCall.can_be_managed @group_call_id Group call identifier +//@description Ends a group call. Requires groupCall.can_be_managed right for video chats or groupCall.is_owned otherwise @group_call_id Group call identifier endGroupCall group_call_id:int32 = Ok; -//@description Returns information about available group call streams @group_call_id Group call identifier -getGroupCallStreams group_call_id:int32 = GroupCallStreams; +//@description Returns information about available video chat streams @group_call_id Group call identifier +getVideoChatStreams group_call_id:int32 = VideoChatStreams; -//@description Returns a file with a segment of a group call stream in a modified OGG format for audio or MPEG-4 format for video +//@description Returns a file with a segment of a video chat stream in a modified OGG format for audio or MPEG-4 format for video //@group_call_id Group call identifier //@time_offset Point in time when the stream segment begins; Unix timestamp in milliseconds //@scale Segment duration scale; 0-1. Segment's duration is 1000/(2**scale) milliseconds //@channel_id Identifier of an audio/video channel to get as received from tgcalls //@video_quality Video quality as received from tgcalls; pass null to get the worst available quality -getGroupCallStreamSegment group_call_id:int32 time_offset:int53 scale:int32 channel_id:int32 video_quality:GroupCallVideoQuality = FilePart; +getVideoChatStreamSegment group_call_id:int32 time_offset:int53 scale:int32 channel_id:int32 video_quality:GroupCallVideoQuality = Data; + +//@description Encrypts group call data before sending them over network using tgcalls +//@group_call_id Group call identifier. The call must not be a video chat +//@data_channel Data channel for which data is encrypted +//@data Data to encrypt +//@unencrypted_prefix_size Size of data prefix that must be kept unencrypted +encryptGroupCallData group_call_id:int32 data_channel:GroupCallDataChannel data:bytes unencrypted_prefix_size:int32 = Data; + +//@description Decrypts group call data received by tgcalls +//@group_call_id Group call identifier. The call must not be a video chat +//@participant_id Identifier of the group call participant, which sent the data +//@data_channel Data channel for which data was encrypted; pass null if unknown +//@data Data to decrypt +decryptGroupCallData group_call_id:int32 participant_id:MessageSender data_channel:GroupCallDataChannel data:bytes = Data; //@description Changes the block list of a message sender. Currently, only users and supergroup chats can be blocked From eb767ed26e973d845b3f56090ab4b05b9762fbf1 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 1 May 2025 20:32:42 +0800 Subject: [PATCH 16/29] Improve command parser --- client/extra.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/client/extra.go b/client/extra.go index 827c857..c199cbf 100644 --- a/client/extra.go +++ b/client/extra.go @@ -15,33 +15,29 @@ func UuidV4Generator() ExtraGenerator { } func IsCommand(text string) bool { - if text != "" { - if text[0] == '/' { - return true - } + if i := strings.Index(text, "/"); i == 0 { + return true } return false } func CheckCommand(text string, entities []*TextEntity) string { if IsCommand(text) { + var cmd string + // e.g. ["/hello 123", "/hell o 123"] // Result: "/hello", "/hell" if i := strings.Index(text, " "); i != -1 { - // Fallback: remove @bot - if i2 := strings.Index(text, "@"); i2 != -1 { - return text[:i2] - } - return text[:i] + cmd = text[:i] } // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] // Result: "/hello" if i := strings.Index(text, "@"); i != -1 { - return text[:i] + cmd = text[:i] } - return text + return cmd } return "" } From 3a8d30fd35cb717fa240c1d025e26d6db49596bb Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 1 May 2025 20:45:52 +0800 Subject: [PATCH 17/29] Add tde2e to LDFLAGS --- client/tdlib.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/tdlib.go b/client/tdlib.go index c9c07db..dc943a0 100644 --- a/client/tdlib.go +++ b/client/tdlib.go @@ -4,9 +4,9 @@ package client //#cgo freebsd CFLAGS: -I/usr/local/include //#cgo darwin CFLAGS: -I/usr/local/include //#cgo windows CFLAGS: -IE:/src/tdlib -IE:/src/tdlib/build -//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm -//#cgo freebsd LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm -//#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltde2e -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo freebsd LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltde2e -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltde2e -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm //#cgo windows LDFLAGS: -LE:/src/tdlib/build/Release -ltdjson //#include //#include From e5eeec83b356158480f2e51a9a16f04a0ab79c96 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 2 May 2025 03:40:05 +0800 Subject: [PATCH 18/29] Fix command parser Return text without argument --- client/extra.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/extra.go b/client/extra.go index c199cbf..c786893 100644 --- a/client/extra.go +++ b/client/extra.go @@ -37,6 +37,10 @@ func CheckCommand(text string, entities []*TextEntity) string { cmd = text[:i] } + if cmd == "" { + return text + } + return cmd } return "" From 969ddb47467c4fa95337eaf250269fd7000058dd Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 9 May 2025 14:42:54 +0800 Subject: [PATCH 19/29] Update to TDLib 1.8.49 --- client/function.go | 135 +++++++++- client/type.go | 600 +++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 298 ++++++++++++++++++++- data/td_api.tl | 155 +++++++++-- 4 files changed, 1125 insertions(+), 63 deletions(-) diff --git a/client/function.go b/client/function.go index ed53166..1102459 100755 --- a/client/function.go +++ b/client/function.go @@ -8708,6 +8708,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(result.Data) + case TypeInternalLinkTypeMyStars: + return UnmarshalInternalLinkTypeMyStars(result.Data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(result.Data) @@ -19163,6 +19166,35 @@ func (client *Client) ToggleSupergroupCanHaveSponsoredMessages(req *ToggleSuperg return UnmarshalOk(result.Data) } +type ToggleSupergroupHasAutomaticTranslationRequest struct { + // The identifier of the channel + SupergroupId int64 `json:"supergroup_id"` + // The new value of has_automatic_translation + HasAutomaticTranslation bool `json:"has_automatic_translation"` +} + +// Toggles whether messages are automatically translated in the channel chat; requires can_change_info administrator right in the channel. The chat must have at least chatBoostFeatures.min_automatic_translation_boost_level boost level to enable automatic translation +func (client *Client) ToggleSupergroupHasAutomaticTranslation(req *ToggleSupergroupHasAutomaticTranslationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupHasAutomaticTranslation", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "has_automatic_translation": req.HasAutomaticTranslation, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupHasHiddenMembersRequest struct { // Identifier of the supergroup SupergroupId int64 `json:"supergroup_id"` @@ -19670,7 +19702,7 @@ func (client *Client) SetGiftSettings(req *SetGiftSettingsRequest) (*Ok, error) } // Returns gifts that can be sent to other users and channel chats -func (client *Client) GetAvailableGifts() (*Gifts, error) { +func (client *Client) GetAvailableGifts() (*AvailableGifts, error) { result, err := client.Send(Request{ meta: meta{ Type: "getAvailableGifts", @@ -19685,7 +19717,7 @@ func (client *Client) GetAvailableGifts() (*Gifts, error) { return nil, buildResponseError(result.Data) } - return UnmarshalGifts(result.Data) + return UnmarshalAvailableGifts(result.Data) } type SendGiftRequest struct { @@ -19938,6 +19970,38 @@ func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SendResoldGiftRequest struct { + // Name of the upgraded gift to send + GiftName string `json:"gift_name"` + // Identifier of the user or the channel chat that will receive the gift + OwnerId MessageSender `json:"owner_id"` + // The amount of Telegram Stars required to pay for the gift + StarCount int64 `json:"star_count"` +} + +// Sends an upgraded gift that is available for resale to another user or channel chat; gifts already owned by the current user must be transferred using transferGift and can't be passed to the method +func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendResoldGift", + }, + Data: map[string]interface{}{ + "gift_name": req.GiftName, + "owner_id": req.OwnerId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetReceivedGiftsRequest struct { // Unique identifier of business connection on behalf of which to send the request; for bots only BusinessConnectionId string `json:"business_connection_id"` @@ -20072,6 +20136,73 @@ func (client *Client) GetUpgradedGiftWithdrawalUrl(req *GetUpgradedGiftWithdrawa return UnmarshalHttpUrl(result.Data) } +type SetGiftResalePriceRequest struct { + // Identifier of the unique gift + ReceivedGiftId string `json:"received_gift_id"` + // The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift + ResaleStarCount int64 `json:"resale_star_count"` +} + +// Changes resale price of a unique gift owned by the current user +func (client *Client) SetGiftResalePrice(req *SetGiftResalePriceRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftResalePrice", + }, + Data: map[string]interface{}{ + "received_gift_id": req.ReceivedGiftId, + "resale_star_count": req.ResaleStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SearchGiftsForResaleRequest struct { + // Identifier of the regular gift that was upgraded to a unique gift + GiftId JsonInt64 `json:"gift_id"` + // Order in which the results will be sorted + Order GiftForResaleOrder `json:"order"` + // Attributes used to filter received gifts. If multiple attributes of the same type are specified, then all of them are allowed. If none attributes of specific type are specified, then all values for this attribute type are allowed + Attributes []UpgradedGiftAttributeId `json:"attributes"` + // Offset of the first entry to return as received from the previous request with the same order and attributes; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of gifts to return + Limit int32 `json:"limit"` +} + +// Returns upgraded gifts that can be bought from other owners +func (client *Client) SearchGiftsForResale(req *SearchGiftsForResaleRequest) (*GiftsForResale, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchGiftsForResale", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + "order": req.Order, + "attributes": req.Attributes, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftsForResale(result.Data) +} + type CreateInvoiceLinkRequest struct { // Unique identifier of business connection on behalf of which to send the request BusinessConnectionId string `json:"business_connection_id"` diff --git a/client/type.go b/client/type.go index 1848a98..ab92cfc 100755 --- a/client/type.go +++ b/client/type.go @@ -26,6 +26,8 @@ const ( ClassStarSubscriptionType = "StarSubscriptionType" ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassUpgradedGiftAttributeId = "UpgradedGiftAttributeId" + ClassGiftForResaleOrder = "GiftForResaleOrder" ClassSentGift = "SentGift" ClassStarTransactionDirection = "StarTransactionDirection" ClassStarTransactionType = "StarTransactionType" @@ -280,9 +282,15 @@ const ( ClassUpgradedGiftBackdrop = "UpgradedGiftBackdrop" ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" ClassGift = "Gift" - ClassGifts = "Gifts" ClassUpgradedGift = "UpgradedGift" ClassUpgradeGiftResult = "UpgradeGiftResult" + ClassAvailableGift = "AvailableGift" + ClassAvailableGifts = "AvailableGifts" + ClassUpgradedGiftModelCount = "UpgradedGiftModelCount" + ClassUpgradedGiftSymbolCount = "UpgradedGiftSymbolCount" + ClassUpgradedGiftBackdropCount = "UpgradedGiftBackdropCount" + ClassGiftForResale = "GiftForResale" + ClassGiftsForResale = "GiftsForResale" ClassReceivedGift = "ReceivedGift" ClassReceivedGifts = "ReceivedGifts" ClassGiftUpgradePreview = "GiftUpgradePreview" @@ -798,9 +806,21 @@ const ( TypeUpgradedGiftBackdrop = "upgradedGiftBackdrop" TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" TypeGift = "gift" - TypeGifts = "gifts" TypeUpgradedGift = "upgradedGift" TypeUpgradeGiftResult = "upgradeGiftResult" + TypeAvailableGift = "availableGift" + TypeAvailableGifts = "availableGifts" + TypeUpgradedGiftAttributeIdModel = "upgradedGiftAttributeIdModel" + TypeUpgradedGiftAttributeIdSymbol = "upgradedGiftAttributeIdSymbol" + TypeUpgradedGiftAttributeIdBackdrop = "upgradedGiftAttributeIdBackdrop" + TypeUpgradedGiftModelCount = "upgradedGiftModelCount" + TypeUpgradedGiftSymbolCount = "upgradedGiftSymbolCount" + TypeUpgradedGiftBackdropCount = "upgradedGiftBackdropCount" + TypeGiftForResaleOrderPrice = "giftForResaleOrderPrice" + TypeGiftForResaleOrderPriceChangeDate = "giftForResaleOrderPriceChangeDate" + TypeGiftForResaleOrderNumber = "giftForResaleOrderNumber" + TypeGiftForResale = "giftForResale" + TypeGiftsForResale = "giftsForResale" TypeSentGiftRegular = "sentGiftRegular" TypeSentGiftUpgraded = "sentGiftUpgraded" TypeReceivedGift = "receivedGift" @@ -831,6 +851,8 @@ const ( TypeStarTransactionTypeGiftTransfer = "starTransactionTypeGiftTransfer" TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" TypeStarTransactionTypeGiftUpgrade = "starTransactionTypeGiftUpgrade" + TypeStarTransactionTypeUpgradedGiftPurchase = "starTransactionTypeUpgradedGiftPurchase" + TypeStarTransactionTypeUpgradedGiftSale = "starTransactionTypeUpgradedGiftSale" TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" @@ -1701,6 +1723,7 @@ const ( TypeChatEventHasAggressiveAntiSpamEnabledToggled = "chatEventHasAggressiveAntiSpamEnabledToggled" TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled" TypeChatEventShowMessageSenderToggled = "chatEventShowMessageSenderToggled" + TypeChatEventAutomaticTranslationToggled = "chatEventAutomaticTranslationToggled" TypeChatEventInviteLinkEdited = "chatEventInviteLinkEdited" TypeChatEventInviteLinkRevoked = "chatEventInviteLinkRevoked" TypeChatEventInviteLinkDeleted = "chatEventInviteLinkDeleted" @@ -2033,6 +2056,7 @@ const ( TypeInternalLinkTypeMainWebApp = "internalLinkTypeMainWebApp" TypeInternalLinkTypeMessage = "internalLinkTypeMessage" TypeInternalLinkTypeMessageDraft = "internalLinkTypeMessageDraft" + TypeInternalLinkTypeMyStars = "internalLinkTypeMyStars" TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" @@ -2141,6 +2165,7 @@ const ( TypeSuggestedActionSetProfilePhoto = "suggestedActionSetProfilePhoto" TypeSuggestedActionExtendPremium = "suggestedActionExtendPremium" TypeSuggestedActionExtendStarSubscriptions = "suggestedActionExtendStarSubscriptions" + TypeSuggestedActionCustom = "suggestedActionCustom" TypeCount = "count" TypeText = "text" TypeData = "data" @@ -2464,6 +2489,16 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Contains identifier of an upgraded gift attribute to search for +type UpgradedGiftAttributeId interface { + UpgradedGiftAttributeIdType() string +} + +// Describes order in which upgraded gifts for resale will be sorted +type GiftForResaleOrder interface { + GiftForResaleOrderType() string +} + // Represents content of a gift received by a user or a channel chat type SentGift interface { SentGiftType() string @@ -8766,6 +8801,8 @@ func (*UpgradedGiftBackdropColors) GetType() string { // Describes a backdrop of an upgraded gift type UpgradedGiftBackdrop struct { meta + // Unique identifier of the backdrop + Id int32 `json:"id"` // Name of the backdrop Name string `json:"name"` // Colors of the backdrop @@ -8885,29 +8922,6 @@ func (*Gift) GetType() string { return TypeGift } -// Contains a list of gifts that can be sent to another user or channel chat -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 -} - // Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT type UpgradedGift struct { meta @@ -8915,7 +8929,7 @@ type UpgradedGift struct { Id JsonInt64 `json:"id"` // The title of the upgraded gift Title string `json:"title"` - // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift + // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift Name string `json:"name"` // Unique number of the upgraded gift among gifts upgraded from the same gift Number int32 `json:"number"` @@ -8939,6 +8953,8 @@ type UpgradedGift struct { Backdrop *UpgradedGiftBackdrop `json:"backdrop"` // Information about the originally sent gift; may be null if unknown OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` + // Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible + ResaleStarCount int64 `json:"resale_star_count"` } func (entity *UpgradedGift) MarshalJSON() ([]byte, error) { @@ -8973,6 +8989,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { Symbol *UpgradedGiftSymbol `json:"symbol"` Backdrop *UpgradedGiftBackdrop `json:"backdrop"` OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` + ResaleStarCount int64 `json:"resale_star_count"` } err := json.Unmarshal(data, &tmp) @@ -8993,6 +9010,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { upgradedGift.Symbol = tmp.Symbol upgradedGift.Backdrop = tmp.Backdrop upgradedGift.OriginalDetails = tmp.OriginalDetails + upgradedGift.ResaleStarCount = tmp.ResaleStarCount fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) upgradedGift.OwnerId = fieldOwnerId @@ -9013,6 +9031,10 @@ type UpgradeGiftResult struct { CanBeTransferred bool `json:"can_be_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT ExportDate int32 `json:"export_date"` } @@ -9033,6 +9055,347 @@ func (*UpgradeGiftResult) GetType() string { return TypeUpgradeGiftResult } +// Describes a gift that is available for purchase +type AvailableGift struct { + meta + // The gift + Gift *Gift `json:"gift"` + // Number of gifts that are available for resale + ResaleCount int32 `json:"resale_count"` + // The minimum price for the gifts available for resale; 0 if there are no such gifts + MinResaleStarCount int64 `json:"min_resale_star_count"` + // The title of the upgraded gift; empty if the gift isn't available for resale + Title string `json:"title"` +} + +func (entity *AvailableGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AvailableGift + + return json.Marshal((*stub)(entity)) +} + +func (*AvailableGift) GetClass() string { + return ClassAvailableGift +} + +func (*AvailableGift) GetType() string { + return TypeAvailableGift +} + +// Contains a list of gifts that can be sent to another user or channel chat +type AvailableGifts struct { + meta + // The list of gifts + Gifts []*AvailableGift `json:"gifts"` +} + +func (entity *AvailableGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AvailableGifts + + return json.Marshal((*stub)(entity)) +} + +func (*AvailableGifts) GetClass() string { + return ClassAvailableGifts +} + +func (*AvailableGifts) GetType() string { + return TypeAvailableGifts +} + +// Identifier of a gift model +type UpgradedGiftAttributeIdModel struct { + meta + // Identifier of the sticker representing the model + StickerId JsonInt64 `json:"sticker_id"` +} + +func (entity *UpgradedGiftAttributeIdModel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdModel + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdModel) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdModel) GetType() string { + return TypeUpgradedGiftAttributeIdModel +} + +func (*UpgradedGiftAttributeIdModel) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdModel +} + +// Identifier of a gift symbol +type UpgradedGiftAttributeIdSymbol struct { + meta + // Identifier of the sticker representing the symbol + StickerId JsonInt64 `json:"sticker_id"` +} + +func (entity *UpgradedGiftAttributeIdSymbol) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdSymbol + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdSymbol) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdSymbol) GetType() string { + return TypeUpgradedGiftAttributeIdSymbol +} + +func (*UpgradedGiftAttributeIdSymbol) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdSymbol +} + +// Identifier of a gift backdrop +type UpgradedGiftAttributeIdBackdrop struct { + meta + // Identifier of the backdrop + BackdropId int32 `json:"backdrop_id"` +} + +func (entity *UpgradedGiftAttributeIdBackdrop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdBackdrop + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdBackdrop) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdBackdrop) GetType() string { + return TypeUpgradedGiftAttributeIdBackdrop +} + +func (*UpgradedGiftAttributeIdBackdrop) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdBackdrop +} + +// Describes a model of an upgraded gift with the number of gifts found +type UpgradedGiftModelCount struct { + meta + // The model + Model *UpgradedGiftModel `json:"model"` + // Total number of gifts with the model + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftModelCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftModelCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftModelCount) GetClass() string { + return ClassUpgradedGiftModelCount +} + +func (*UpgradedGiftModelCount) GetType() string { + return TypeUpgradedGiftModelCount +} + +// Describes a symbol shown on the pattern of an upgraded gift +type UpgradedGiftSymbolCount struct { + meta + // The symbol + Symbol *UpgradedGiftSymbol `json:"symbol"` + // Total number of gifts with the symbol + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftSymbolCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftSymbolCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftSymbolCount) GetClass() string { + return ClassUpgradedGiftSymbolCount +} + +func (*UpgradedGiftSymbolCount) GetType() string { + return TypeUpgradedGiftSymbolCount +} + +// Describes a backdrop of an upgraded gift +type UpgradedGiftBackdropCount struct { + meta + // The backdrop + Backdrop *UpgradedGiftBackdrop `json:"backdrop"` + // Total number of gifts with the symbol + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftBackdropCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftBackdropCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftBackdropCount) GetClass() string { + return ClassUpgradedGiftBackdropCount +} + +func (*UpgradedGiftBackdropCount) GetType() string { + return TypeUpgradedGiftBackdropCount +} + +// The gifts will be sorted by their price from the lowest to the highest +type GiftForResaleOrderPrice struct{ + meta +} + +func (entity *GiftForResaleOrderPrice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderPrice + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderPrice) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderPrice) GetType() string { + return TypeGiftForResaleOrderPrice +} + +func (*GiftForResaleOrderPrice) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderPrice +} + +// The gifts will be sorted by the last date when their price was changed from the newest to the oldest +type GiftForResaleOrderPriceChangeDate struct{ + meta +} + +func (entity *GiftForResaleOrderPriceChangeDate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderPriceChangeDate + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderPriceChangeDate) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderPriceChangeDate) GetType() string { + return TypeGiftForResaleOrderPriceChangeDate +} + +func (*GiftForResaleOrderPriceChangeDate) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderPriceChangeDate +} + +// The gifts will be sorted by their number from the smallest to the largest +type GiftForResaleOrderNumber struct{ + meta +} + +func (entity *GiftForResaleOrderNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderNumber + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderNumber) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderNumber) GetType() string { + return TypeGiftForResaleOrderNumber +} + +func (*GiftForResaleOrderNumber) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderNumber +} + +// Describes a gift available for resale +type GiftForResale struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // Unique identifier of the received gift for the current user; only for the gifts owned by the current user + ReceivedGiftId string `json:"received_gift_id"` +} + +func (entity *GiftForResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResale + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResale) GetClass() string { + return ClassGiftForResale +} + +func (*GiftForResale) GetType() string { + return TypeGiftForResale +} + +// Describes gifts available for resale +type GiftsForResale struct { + meta + // Total number of gifts found + TotalCount int32 `json:"total_count"` + // The gifts + Gifts []*GiftForResale `json:"gifts"` + // Available models; for searchGiftsForResale requests without offset and attributes only + Models []*UpgradedGiftModelCount `json:"models"` + // Available symbols; for searchGiftsForResale requests without offset and attributes only + Symbols []*UpgradedGiftSymbolCount `json:"symbols"` + // Available backdrops; for searchGiftsForResale requests without offset and attributes only + Backdrops []*UpgradedGiftBackdropCount `json:"backdrops"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *GiftsForResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftsForResale + + return json.Marshal((*stub)(entity)) +} + +func (*GiftsForResale) GetClass() string { + return ClassGiftsForResale +} + +func (*GiftsForResale) GetType() string { + return TypeGiftsForResale +} + // Regular gift type SentGiftRegular struct { meta @@ -9118,6 +9481,10 @@ type ReceivedGift struct { PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -9154,6 +9521,8 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` TransferStarCount int64 `json:"transfer_star_count"` + NextTransferDate int32 `json:"next_transfer_date"` + NextResaleDate int32 `json:"next_resale_date"` ExportDate int32 `json:"export_date"` } @@ -9174,6 +9543,8 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { receivedGift.SellStarCount = tmp.SellStarCount receivedGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount receivedGift.TransferStarCount = tmp.TransferStarCount + receivedGift.NextTransferDate = tmp.NextTransferDate + receivedGift.NextResaleDate = tmp.NextResaleDate receivedGift.ExportDate = tmp.ExportDate fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) @@ -10092,6 +10463,66 @@ func (*StarTransactionTypeGiftUpgrade) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftUpgrade } +// The transaction is a purchase of an upgraded gift for some user or channel; for regular users only +type StarTransactionTypeUpgradedGiftPurchase struct { + meta + // Identifier of the user that sold the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeUpgradedGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUpgradedGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUpgradedGiftPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUpgradedGiftPurchase) GetType() string { + return TypeStarTransactionTypeUpgradedGiftPurchase +} + +func (*StarTransactionTypeUpgradedGiftPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeUpgradedGiftPurchase +} + +// The transaction is a sale of an upgraded gift; for regular users only +type StarTransactionTypeUpgradedGiftSale struct { + meta + // Identifier of the user that bought the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` + // Information about commission received by Telegram from the transaction + Affiliate *AffiliateInfo `json:"affiliate"` +} + +func (entity *StarTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUpgradedGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUpgradedGiftSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUpgradedGiftSale) GetType() string { + return TypeStarTransactionTypeUpgradedGiftSale +} + +func (*StarTransactionTypeUpgradedGiftSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeUpgradedGiftSale +} + // The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only type StarTransactionTypeChannelPaidReactionSend struct { meta @@ -12712,6 +13143,8 @@ type Supergroup struct { MemberCount int32 `json:"member_count"` // Approximate boost level for the chat BoostLevel int32 `json:"boost_level"` + // True, if automatic translation of messages is enabled in the channel + HasAutomaticTranslation bool `json:"has_automatic_translation"` // True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel HasLinkedChat bool `json:"has_linked_chat"` // True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup @@ -12771,6 +13204,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { Status json.RawMessage `json:"status"` MemberCount int32 `json:"member_count"` BoostLevel int32 `json:"boost_level"` + HasAutomaticTranslation bool `json:"has_automatic_translation"` HasLinkedChat bool `json:"has_linked_chat"` HasLocation bool `json:"has_location"` SignMessages bool `json:"sign_messages"` @@ -12800,6 +13234,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.Date = tmp.Date supergroup.MemberCount = tmp.MemberCount supergroup.BoostLevel = tmp.BoostLevel + supergroup.HasAutomaticTranslation = tmp.HasAutomaticTranslation supergroup.HasLinkedChat = tmp.HasLinkedChat supergroup.HasLocation = tmp.HasLocation supergroup.SignMessages = tmp.SignMessages @@ -28100,7 +28535,7 @@ type MessageUpgradedGift struct { SenderId MessageSender `json:"sender_id"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` @@ -28108,8 +28543,14 @@ type MessageUpgradedGift struct { CanBeTransferred bool `json:"can_be_transferred"` // True, if the gift was transferred to another owner; only for the receiver of the gift WasTransferred bool `json:"was_transferred"` + // Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred + LastResaleStarCount int64 `json:"last_resale_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -28143,7 +28584,10 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error IsSaved bool `json:"is_saved"` CanBeTransferred bool `json:"can_be_transferred"` WasTransferred bool `json:"was_transferred"` + LastResaleStarCount int64 `json:"last_resale_star_count"` TransferStarCount int64 `json:"transfer_star_count"` + NextTransferDate int32 `json:"next_transfer_date"` + NextResaleDate int32 `json:"next_resale_date"` ExportDate int32 `json:"export_date"` } @@ -28158,7 +28602,10 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error messageUpgradedGift.IsSaved = tmp.IsSaved messageUpgradedGift.CanBeTransferred = tmp.CanBeTransferred messageUpgradedGift.WasTransferred = tmp.WasTransferred + messageUpgradedGift.LastResaleStarCount = tmp.LastResaleStarCount messageUpgradedGift.TransferStarCount = tmp.TransferStarCount + messageUpgradedGift.NextTransferDate = tmp.NextTransferDate + messageUpgradedGift.NextResaleDate = tmp.NextResaleDate messageUpgradedGift.ExportDate = tmp.ExportDate fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) @@ -28174,7 +28621,7 @@ type MessageRefundedUpgradedGift struct { Gift *Gift `json:"gift"` // Sender of the gift SenderId MessageSender `json:"sender_id"` - // True, if the gift was obtained by upgrading of a previously received gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` } @@ -34116,6 +34563,8 @@ type ChatBoostLevelFeatures struct { CanSetCustomBackground bool `json:"can_set_custom_background"` // True, if custom emoji sticker set can be set for the chat CanSetCustomEmojiStickerSet bool `json:"can_set_custom_emoji_sticker_set"` + // True, if automatic translation of messages can be enabled in the chat + CanEnableAutomaticTranslation bool `json:"can_enable_automatic_translation"` // True, if speech recognition can be used for video note and voice note messages by all users CanRecognizeSpeech bool `json:"can_recognize_speech"` // True, if sponsored messages can be disabled in the chat @@ -34155,6 +34604,8 @@ type ChatBoostFeatures struct { MinCustomBackgroundBoostLevel int32 `json:"min_custom_background_boost_level"` // The minimum boost level required to set custom emoji sticker set for the chat; for supergroup chats only MinCustomEmojiStickerSetBoostLevel int32 `json:"min_custom_emoji_sticker_set_boost_level"` + // The minimum boost level allowing to enable automatic translation of messages for non-Premium users; for channel chats only + MinAutomaticTranslationBoostLevel int32 `json:"min_automatic_translation_boost_level"` // The minimum boost level allowing to recognize speech in video note and voice note messages for non-Premium users; for supergroup chats only MinSpeechRecognitionBoostLevel int32 `json:"min_speech_recognition_boost_level"` // The minimum boost level allowing to disable sponsored messages in the chat; for channel chats only @@ -39936,6 +40387,33 @@ func (*ChatEventShowMessageSenderToggled) ChatEventActionType() string { return TypeChatEventShowMessageSenderToggled } +// The has_automatic_translation setting of a channel was toggled +type ChatEventAutomaticTranslationToggled struct { + meta + // New value of has_automatic_translation + HasAutomaticTranslation bool `json:"has_automatic_translation"` +} + +func (entity *ChatEventAutomaticTranslationToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventAutomaticTranslationToggled + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventAutomaticTranslationToggled) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventAutomaticTranslationToggled) GetType() string { + return TypeChatEventAutomaticTranslationToggled +} + +func (*ChatEventAutomaticTranslationToggled) ChatEventActionType() string { + return TypeChatEventAutomaticTranslationToggled +} + // A chat invite link was edited type ChatEventInviteLinkEdited struct { meta @@ -44061,8 +44539,10 @@ func (*Hashtags) GetType() string { } // A story can be sent -type CanPostStoryResultOk struct{ +type CanPostStoryResultOk struct { meta + // Number of stories that can be posted by the user + StoryCount int32 `json:"story_count"` } func (entity *CanPostStoryResultOk) MarshalJSON() ([]byte, error) { @@ -45191,7 +45671,7 @@ func (*PushMessageContentGift) PushMessageContentType() string { // A message with an upgraded gift type PushMessageContentUpgradedGift struct { meta - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` } @@ -49413,6 +49893,31 @@ func (*InternalLinkTypeMessageDraft) InternalLinkTypeType() string { return TypeInternalLinkTypeMessageDraft } +// The link is a link to the screen with information about Telegram Star balance and transactions of the current user +type InternalLinkTypeMyStars struct{ + meta +} + +func (entity *InternalLinkTypeMyStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeMyStars + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeMyStars) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeMyStars) GetType() string { + return TypeInternalLinkTypeMyStars +} + +func (*InternalLinkTypeMyStars) InternalLinkTypeType() string { + return TypeInternalLinkTypeMyStars +} + // The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it type InternalLinkTypePassportDataRequest struct { meta @@ -52402,6 +52907,39 @@ func (*SuggestedActionExtendStarSubscriptions) SuggestedActionType() string { return TypeSuggestedActionExtendStarSubscriptions } +// A custom suggestion to be shown at the top of the chat list +type SuggestedActionCustom struct { + meta + // Unique name of the suggestion + Name string `json:"name"` + // Title of the suggestion + Title *FormattedText `json:"title"` + // Description of the suggestion + Description *FormattedText `json:"description"` + // The link to open when the suggestion is clicked + Url string `json:"url"` +} + +func (entity *SuggestedActionCustom) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionCustom + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionCustom) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionCustom) GetType() string { + return TypeSuggestedActionCustom +} + +func (*SuggestedActionCustom) SuggestedActionType() string { + return TypeSuggestedActionCustom +} + // Contains a counter type Count struct { meta @@ -54003,7 +54541,7 @@ func (*VectorPathCommandLine) VectorPathCommandType() string { return TypeVectorPathCommandLine } -// A cubic Bézier curve to a given point +// A cubic Bézier curve to a given point type VectorPathCommandCubicBezierCurve struct { meta // The start control point of the curve diff --git a/client/unmarshaler.go b/client/unmarshaler.go index dd0a41a..d5efa81 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -770,6 +770,80 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalUpgradedGiftAttributeId(data json.RawMessage) (UpgradedGiftAttributeId, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUpgradedGiftAttributeIdModel: + return UnmarshalUpgradedGiftAttributeIdModel(data) + + case TypeUpgradedGiftAttributeIdSymbol: + return UnmarshalUpgradedGiftAttributeIdSymbol(data) + + case TypeUpgradedGiftAttributeIdBackdrop: + return UnmarshalUpgradedGiftAttributeIdBackdrop(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUpgradedGiftAttributeId(dataList []json.RawMessage) ([]UpgradedGiftAttributeId, error) { + list := []UpgradedGiftAttributeId{} + + for _, data := range dataList { + entity, err := UnmarshalUpgradedGiftAttributeId(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGiftForResaleOrder(data json.RawMessage) (GiftForResaleOrder, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftForResaleOrderPrice: + return UnmarshalGiftForResaleOrderPrice(data) + + case TypeGiftForResaleOrderPriceChangeDate: + return UnmarshalGiftForResaleOrderPriceChangeDate(data) + + case TypeGiftForResaleOrderNumber: + return UnmarshalGiftForResaleOrderNumber(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftForResaleOrder(dataList []json.RawMessage) ([]GiftForResaleOrder, error) { + list := []GiftForResaleOrder{} + + for _, data := range dataList { + entity, err := UnmarshalGiftForResaleOrder(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSentGift(data json.RawMessage) (SentGift, error) { var meta meta @@ -916,6 +990,12 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: + return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) + + case TypeStarTransactionTypeUpgradedGiftSale: + return UnmarshalStarTransactionTypeUpgradedGiftSale(data) + case TypeStarTransactionTypeChannelPaidReactionSend: return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) @@ -5410,6 +5490,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventShowMessageSenderToggled: return UnmarshalChatEventShowMessageSenderToggled(data) + case TypeChatEventAutomaticTranslationToggled: + return UnmarshalChatEventAutomaticTranslationToggled(data) + case TypeChatEventInviteLinkEdited: return UnmarshalChatEventInviteLinkEdited(data) @@ -7231,6 +7314,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(data) + case TypeInternalLinkTypeMyStars: + return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -7750,6 +7836,9 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionExtendStarSubscriptions: return UnmarshalSuggestedActionExtendStarSubscriptions(data) + case TypeSuggestedActionCustom: + return UnmarshalSuggestedActionCustom(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -10123,14 +10212,6 @@ func UnmarshalGift(data json.RawMessage) (*Gift, error) { return &resp, err } -func UnmarshalGifts(data json.RawMessage) (*Gifts, error) { - var resp Gifts - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalUpgradedGift(data json.RawMessage) (*UpgradedGift, error) { var resp UpgradedGift @@ -10147,6 +10228,110 @@ func UnmarshalUpgradeGiftResult(data json.RawMessage) (*UpgradeGiftResult, error return &resp, err } +func UnmarshalAvailableGift(data json.RawMessage) (*AvailableGift, error) { + var resp AvailableGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAvailableGifts(data json.RawMessage) (*AvailableGifts, error) { + var resp AvailableGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdModel(data json.RawMessage) (*UpgradedGiftAttributeIdModel, error) { + var resp UpgradedGiftAttributeIdModel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdSymbol(data json.RawMessage) (*UpgradedGiftAttributeIdSymbol, error) { + var resp UpgradedGiftAttributeIdSymbol + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdBackdrop(data json.RawMessage) (*UpgradedGiftAttributeIdBackdrop, error) { + var resp UpgradedGiftAttributeIdBackdrop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftModelCount(data json.RawMessage) (*UpgradedGiftModelCount, error) { + var resp UpgradedGiftModelCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftSymbolCount(data json.RawMessage) (*UpgradedGiftSymbolCount, error) { + var resp UpgradedGiftSymbolCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftBackdropCount(data json.RawMessage) (*UpgradedGiftBackdropCount, error) { + var resp UpgradedGiftBackdropCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderPrice(data json.RawMessage) (*GiftForResaleOrderPrice, error) { + var resp GiftForResaleOrderPrice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderPriceChangeDate(data json.RawMessage) (*GiftForResaleOrderPriceChangeDate, error) { + var resp GiftForResaleOrderPriceChangeDate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderNumber(data json.RawMessage) (*GiftForResaleOrderNumber, error) { + var resp GiftForResaleOrderNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResale(data json.RawMessage) (*GiftForResale, error) { + var resp GiftForResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftsForResale(data json.RawMessage) (*GiftsForResale, error) { + var resp GiftsForResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSentGiftRegular(data json.RawMessage) (*SentGiftRegular, error) { var resp SentGiftRegular @@ -10387,6 +10572,22 @@ func UnmarshalStarTransactionTypeGiftUpgrade(data json.RawMessage) (*StarTransac return &resp, err } +func UnmarshalStarTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*StarTransactionTypeUpgradedGiftPurchase, error) { + var resp StarTransactionTypeUpgradedGiftPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeUpgradedGiftSale(data json.RawMessage) (*StarTransactionTypeUpgradedGiftSale, error) { + var resp StarTransactionTypeUpgradedGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeChannelPaidReactionSend(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionSend, error) { var resp StarTransactionTypeChannelPaidReactionSend @@ -17347,6 +17548,14 @@ func UnmarshalChatEventShowMessageSenderToggled(data json.RawMessage) (*ChatEven return &resp, err } +func UnmarshalChatEventAutomaticTranslationToggled(data json.RawMessage) (*ChatEventAutomaticTranslationToggled, error) { + var resp ChatEventAutomaticTranslationToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventInviteLinkEdited(data json.RawMessage) (*ChatEventInviteLinkEdited, error) { var resp ChatEventInviteLinkEdited @@ -20003,6 +20212,14 @@ func UnmarshalInternalLinkTypeMessageDraft(data json.RawMessage) (*InternalLinkT return &resp, err } +func UnmarshalInternalLinkTypeMyStars(data json.RawMessage) (*InternalLinkTypeMyStars, error) { + var resp InternalLinkTypeMyStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypePassportDataRequest(data json.RawMessage) (*InternalLinkTypePassportDataRequest, error) { var resp InternalLinkTypePassportDataRequest @@ -20867,6 +21084,14 @@ func UnmarshalSuggestedActionExtendStarSubscriptions(data json.RawMessage) (*Sug return &resp, err } +func UnmarshalSuggestedActionCustom(data json.RawMessage) (*SuggestedActionCustom, error) { + var resp SuggestedActionCustom + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCount(data json.RawMessage) (*Count, error) { var resp Count @@ -23227,15 +23452,51 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGift: return UnmarshalGift(data) - case TypeGifts: - return UnmarshalGifts(data) - case TypeUpgradedGift: return UnmarshalUpgradedGift(data) case TypeUpgradeGiftResult: return UnmarshalUpgradeGiftResult(data) + case TypeAvailableGift: + return UnmarshalAvailableGift(data) + + case TypeAvailableGifts: + return UnmarshalAvailableGifts(data) + + case TypeUpgradedGiftAttributeIdModel: + return UnmarshalUpgradedGiftAttributeIdModel(data) + + case TypeUpgradedGiftAttributeIdSymbol: + return UnmarshalUpgradedGiftAttributeIdSymbol(data) + + case TypeUpgradedGiftAttributeIdBackdrop: + return UnmarshalUpgradedGiftAttributeIdBackdrop(data) + + case TypeUpgradedGiftModelCount: + return UnmarshalUpgradedGiftModelCount(data) + + case TypeUpgradedGiftSymbolCount: + return UnmarshalUpgradedGiftSymbolCount(data) + + case TypeUpgradedGiftBackdropCount: + return UnmarshalUpgradedGiftBackdropCount(data) + + case TypeGiftForResaleOrderPrice: + return UnmarshalGiftForResaleOrderPrice(data) + + case TypeGiftForResaleOrderPriceChangeDate: + return UnmarshalGiftForResaleOrderPriceChangeDate(data) + + case TypeGiftForResaleOrderNumber: + return UnmarshalGiftForResaleOrderNumber(data) + + case TypeGiftForResale: + return UnmarshalGiftForResale(data) + + case TypeGiftsForResale: + return UnmarshalGiftsForResale(data) + case TypeSentGiftRegular: return UnmarshalSentGiftRegular(data) @@ -23326,6 +23587,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: + return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) + + case TypeStarTransactionTypeUpgradedGiftSale: + return UnmarshalStarTransactionTypeUpgradedGiftSale(data) + case TypeStarTransactionTypeChannelPaidReactionSend: return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) @@ -25936,6 +26203,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventShowMessageSenderToggled: return UnmarshalChatEventShowMessageSenderToggled(data) + case TypeChatEventAutomaticTranslationToggled: + return UnmarshalChatEventAutomaticTranslationToggled(data) + case TypeChatEventInviteLinkEdited: return UnmarshalChatEventInviteLinkEdited(data) @@ -26932,6 +27202,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(data) + case TypeInternalLinkTypeMyStars: + return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -27256,6 +27529,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionExtendStarSubscriptions: return UnmarshalSuggestedActionExtendStarSubscriptions(data) + case TypeSuggestedActionCustom: + return UnmarshalSuggestedActionCustom(data) + case TypeCount: return UnmarshalCount(data) diff --git a/data/td_api.tl b/data/td_api.tl index eb49cac..b4ebb53 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -1093,10 +1093,11 @@ upgradedGiftSymbol name:string sticker:sticker rarity_per_mille:int32 = Upgraded upgradedGiftBackdropColors center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 = UpgradedGiftBackdropColors; //@description Describes a backdrop of an upgraded gift +//@id Unique identifier of the backdrop //@name Name of the backdrop //@colors Colors of the backdrop //@rarity_per_mille The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded -upgradedGiftBackdrop name:string colors:upgradedGiftBackdropColors rarity_per_mille:int32 = UpgradedGiftBackdrop; +upgradedGiftBackdrop id:int32 name:string colors:upgradedGiftBackdropColors rarity_per_mille:int32 = UpgradedGiftBackdrop; //@description Describes the original details about the gift //@sender_id Identifier of the user or the chat that sent the gift; may be null if the gift was private @@ -1118,13 +1119,10 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; -//@description Contains a list of gifts that can be sent to another user or channel chat @gifts The list of gifts -gifts gifts:vector = Gifts; - //@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift //@title The title of the upgraded gift -//@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift +//@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift //@total_upgraded_count Total number of gifts that were upgraded from the same gift //@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift @@ -1136,7 +1134,8 @@ gifts gifts:vector = Gifts; //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown -upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; +//@resale_star_count Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible +upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1144,8 +1143,69 @@ upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count //@is_saved True, if the gift is displayed on the user's or the channel's profile page //@can_be_transferred True, if the gift can be transferred to another owner //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT -upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; +upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = UpgradeGiftResult; + +//@description Describes a gift that is available for purchase +//@gift The gift +//@resale_count Number of gifts that are available for resale +//@min_resale_star_count The minimum price for the gifts available for resale; 0 if there are no such gifts +//@title The title of the upgraded gift; empty if the gift isn't available for resale +availableGift gift:gift resale_count:int32 min_resale_star_count:int53 title:string = AvailableGift; + +//@description Contains a list of gifts that can be sent to another user or channel chat @gifts The list of gifts +availableGifts gifts:vector = AvailableGifts; + + +//@class UpgradedGiftAttributeId @description Contains identifier of an upgraded gift attribute to search for + +//@description Identifier of a gift model @sticker_id Identifier of the sticker representing the model +upgradedGiftAttributeIdModel sticker_id:int64 = UpgradedGiftAttributeId; + +//@description Identifier of a gift symbol @sticker_id Identifier of the sticker representing the symbol +upgradedGiftAttributeIdSymbol sticker_id:int64 = UpgradedGiftAttributeId; + +//@description Identifier of a gift backdrop @backdrop_id Identifier of the backdrop +upgradedGiftAttributeIdBackdrop backdrop_id:int32 = UpgradedGiftAttributeId; + + +//@description Describes a model of an upgraded gift with the number of gifts found @model The model @total_count Total number of gifts with the model +upgradedGiftModelCount model:upgradedGiftModel total_count:int32 = UpgradedGiftModelCount; + +//@description Describes a symbol shown on the pattern of an upgraded gift @symbol The symbol @total_count Total number of gifts with the symbol +upgradedGiftSymbolCount symbol:upgradedGiftSymbol total_count:int32 = UpgradedGiftSymbolCount; + +//@description Describes a backdrop of an upgraded gift @backdrop The backdrop @total_count Total number of gifts with the symbol +upgradedGiftBackdropCount backdrop:upgradedGiftBackdrop total_count:int32 = UpgradedGiftBackdropCount; + + +//@class GiftForResaleOrder @description Describes order in which upgraded gifts for resale will be sorted + +//@description The gifts will be sorted by their price from the lowest to the highest +giftForResaleOrderPrice = GiftForResaleOrder; + +//@description The gifts will be sorted by the last date when their price was changed from the newest to the oldest +giftForResaleOrderPriceChangeDate = GiftForResaleOrder; + +//@description The gifts will be sorted by their number from the smallest to the largest +giftForResaleOrderNumber = GiftForResaleOrder; + + +//@description Describes a gift available for resale +//@gift The gift +//@received_gift_id Unique identifier of the received gift for the current user; only for the gifts owned by the current user +giftForResale gift:upgradedGift received_gift_id:string = GiftForResale; + +//@description Describes gifts available for resale +//@total_count Total number of gifts found +//@gifts The gifts +//@models Available models; for searchGiftsForResale requests without offset and attributes only +//@symbols Available symbols; for searchGiftsForResale requests without offset and attributes only +//@backdrops Available backdrops; for searchGiftsForResale requests without offset and attributes only +//@next_offset The offset for the next request. If empty, then there are no more results +giftsForResale total_count:int32 gifts:vector models:vector symbols:vector backdrops:vector next_offset:string = GiftsForResale; //@class SentGift @description Represents content of a gift received by a user or a channel chat @@ -1172,8 +1232,10 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = ReceivedGift; //@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts @@ -1304,6 +1366,15 @@ starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; //@description The transaction is an upgrade of a gift; for regular users only @user_id Identifier of the user that initially sent the gift @gift The upgraded gift starTransactionTypeGiftUpgrade user_id:int53 gift:upgradedGift = StarTransactionType; +//@description The transaction is a purchase of an upgraded gift for some user or channel; for regular users only @user_id Identifier of the user that sold the gift @gift The gift +starTransactionTypeUpgradedGiftPurchase user_id:int53 gift:upgradedGift = StarTransactionType; + +//@description The transaction is a sale of an upgraded gift; for regular users only +//@user_id Identifier of the user that bought the gift +//@gift The gift +//@affiliate Information about commission received by Telegram from the transaction +starTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift affiliate:affiliateInfo = StarTransactionType; + //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat //@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message @@ -1779,6 +1850,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, //-or for chats with messages or stories from publicForwards and foundStories //@boost_level Approximate boost level for the chat +//@has_automatic_translation True, if automatic translation of messages is enabled in the channel //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup //@sign_messages True, if messages sent to the channel contains name of the sender. This field is only applicable to channels @@ -1795,7 +1867,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -4189,18 +4261,21 @@ messageGift gift:gift sender_id:MessageSender received_gift_id:string text:forma //@gift The gift //@sender_id Sender of the gift; may be null for anonymous gifts //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift //@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift //@was_transferred True, if the gift was transferred to another owner; only for the receiver of the gift +//@last_resale_star_count Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; +messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded //@gift The gift //@sender_id Sender of the gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift messageRefundedUpgradedGift gift:gift sender_id:MessageSender is_upgrade:Bool = MessageContent; //@description Paid messages were refunded @message_count The number of refunded messages @star_count The number of refunded Telegram Stars @@ -5124,9 +5199,10 @@ botMediaPreviewInfo previews:vector language_codes:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_speech_recognition_boost_level:int32 min_sponsored_message_disable_boost_level:int32 = ChatBoostFeatures; +chatBoostFeatures features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_automatic_translation_boost_level:int32 min_speech_recognition_boost_level:int32 min_sponsored_message_disable_boost_level:int32 = ChatBoostFeatures; //@class ChatBoostSource @description Describes source of a chat boost @@ -6064,6 +6141,9 @@ chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction; //@description The show_message_sender setting of a channel was toggled @show_message_sender New value of show_message_sender chatEventShowMessageSenderToggled show_message_sender:Bool = ChatEventAction; +//@description The has_automatic_translation setting of a channel was toggled @has_automatic_translation New value of has_automatic_translation +chatEventAutomaticTranslationToggled has_automatic_translation:Bool = ChatEventAction; + //@description A chat invite link was edited @old_invite_link Previous information about the invite link @new_invite_link New information about the invite link chatEventInviteLinkEdited old_invite_link:chatInviteLink new_invite_link:chatInviteLink = ChatEventAction; @@ -6655,8 +6735,8 @@ hashtags hashtags:vector = Hashtags; //@class CanPostStoryResult @description Represents result of checking whether the current user can post a story on behalf of the specific chat -//@description A story can be sent -canPostStoryResultOk = CanPostStoryResult; +//@description A story can be sent @story_count Number of stories that can be posted by the user +canPostStoryResultOk story_count:int32 = CanPostStoryResult; //@description The user must subscribe to Telegram Premium to be able to post stories canPostStoryResultPremiumNeeded = CanPostStoryResult; @@ -6809,7 +6889,7 @@ pushMessageContentGiveaway winner_count:int32 prize:GiveawayPrize is_pinned:Bool pushMessageContentGift star_count:int53 = PushMessageContent; //@description A message with an upgraded gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift pushMessageContentUpgradedGift is_upgrade:Bool = PushMessageContent; //@description A screenshot of a message in the chat has been taken @@ -7438,6 +7518,9 @@ internalLinkTypeMessage url:string = InternalLinkType; //@contains_link True, if the first line of the text contains a link. If true, the input field needs to be focused and the text after the link must be selected internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLinkType; +//@description The link is a link to the screen with information about Telegram Star balance and transactions of the current user +internalLinkTypeMyStars = InternalLinkType; + //@description The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it //@bot_user_id User identifier of the service's bot; the corresponding user may be unknown yet //@scope Telegram Passport element types requested by the service @@ -7894,6 +7977,13 @@ suggestedActionExtendPremium manage_premium_subscription_url:string = SuggestedA //-to get the number of expiring subscriptions and the number of required to buy Telegram Stars suggestedActionExtendStarSubscriptions = SuggestedAction; +//@description A custom suggestion to be shown at the top of the chat list +//@name Unique name of the suggestion +//@title Title of the suggestion +//@param_description Description of the suggestion +//@url The link to open when the suggestion is clicked +suggestedActionCustom name:string title:formattedText description:formattedText url:string = SuggestedAction; + //@description Contains a counter @count Count count count:int32 = Count; @@ -8157,7 +8247,7 @@ point x:double y:double = Point; //@description A straight line to a given point @end_point The end point of the straight line vectorPathCommandLine end_point:point = VectorPathCommand; -//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve +//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve vectorPathCommandCubicBezierCurve start_control_point:point end_control_point:point end_point:point = VectorPathCommand; @@ -12058,6 +12148,12 @@ toggleSupergroupIsAllHistoryAvailable supergroup_id:int53 is_all_history_availab //@can_have_sponsored_messages The new value of can_have_sponsored_messages toggleSupergroupCanHaveSponsoredMessages supergroup_id:int53 can_have_sponsored_messages:Bool = Ok; +//@description Toggles whether messages are automatically translated in the channel chat; requires can_change_info administrator right in the channel. +//-The chat must have at least chatBoostFeatures.min_automatic_translation_boost_level boost level to enable automatic translation +//@supergroup_id The identifier of the channel +//@has_automatic_translation The new value of has_automatic_translation +toggleSupergroupHasAutomaticTranslation supergroup_id:int53 has_automatic_translation:Bool = Ok; + //@description Toggles whether non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers. Can be called only if supergroupFullInfo.can_hide_members == true //@supergroup_id Identifier of the supergroup //@has_hidden_members New value of has_hidden_members @@ -12147,7 +12243,7 @@ deleteSavedCredentials = Ok; setGiftSettings settings:giftSettings = Ok; //@description Returns gifts that can be sent to other users and channel chats -getAvailableGifts = Gifts; +getAvailableGifts = AvailableGifts; //@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send @@ -12195,6 +12291,13 @@ upgradeGift business_connection_id:string received_gift_id:string keep_original_ //@star_count The amount of Telegram Stars required to pay for the transfer transferGift business_connection_id:string received_gift_id:string new_owner_id:MessageSender star_count:int53 = Ok; +//@description Sends an upgraded gift that is available for resale to another user or channel chat; gifts already owned by the current user +//-must be transferred using transferGift and can't be passed to the method +//@gift_name Name of the upgraded gift to send +//@owner_id Identifier of the user or the channel chat that will receive the gift +//@star_count The amount of Telegram Stars required to pay for the gift +sendResoldGift gift_name:string owner_id:MessageSender star_count:int53 = Ok; + //@description Returns gifts received by the given user or chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@owner_id Identifier of the gift receiver @@ -12219,6 +12322,20 @@ getUpgradedGift name:string = UpgradedGift; //@password The 2-step verification password of the current user getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; +//@description Changes resale price of a unique gift owned by the current user +//@received_gift_id Identifier of the unique gift +//@resale_star_count The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. +//-The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift +setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; + +//@description Returns upgraded gifts that can be bought from other owners +//@gift_id Identifier of the regular gift that was upgraded to a unique gift +//@order Order in which the results will be sorted +//@attributes Attributes used to filter received gifts. If multiple attributes of the same type are specified, then all of them are allowed. +//-If none attributes of specific type are specified, then all values for this attribute type are allowed +//@offset Offset of the first entry to return as received from the previous request with the same order and attributes; use empty string to get the first chunk of results +//@limit The maximum number of gifts to return +searchGiftsForResale gift_id:int64 order:GiftForResaleOrder attributes:vector offset:string limit:int32 = GiftsForResale; //@description Creates a link for the given invoice; for bots only //@business_connection_id Unique identifier of business connection on behalf of which to send the request From bc2b5f58230b2ff037cf0b6603be9599af96f6b9 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 10 Jun 2025 23:44:57 +0800 Subject: [PATCH 20/29] Update to TDLib 1.8.50 --- client/function.go | 454 +++++++++++++++++++++++++++++++++++++++--- client/type.go | 407 ++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 137 +++++++++++++ data/td_api.tl | 244 ++++++++++++++++++----- 4 files changed, 1133 insertions(+), 109 deletions(-) diff --git a/client/function.go b/client/function.go index 1102459..072145a 100755 --- a/client/function.go +++ b/client/function.go @@ -1672,6 +1672,35 @@ func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*Message return UnmarshalMessageViewers(result.Data) } +type GetMessageAuthorRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns information about actual author of a message sent on behalf of a channel. The method can be called if messageProperties.can_get_author == true +func (client *Client) GetMessageAuthor(req *GetMessageAuthorRequest) (*User, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageAuthor", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUser(result.Data) +} + type GetFileRequest struct { // Identifier of the file to get FileId int32 `json:"file_id"` @@ -2387,7 +2416,7 @@ func (client *Client) GetSuitableDiscussionChats() (*Chats, error) { return UnmarshalChats(result.Data) } -// Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium +// Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives the error "CHANNELS_TOO_MUCH". Also, the limit can be increased with Telegram Premium func (client *Client) GetInactiveSupergroupChats() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2425,6 +2454,320 @@ func (client *Client) GetSuitablePersonalChats() (*Chats, error) { return UnmarshalChats(result.Data) } +type LoadDirectMessagesChatTopicsRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached + Limit int32 `json:"limit"` +} + +// Loads more topics in a channel direct messages chat administered by the current user. The loaded topics will be sent through updateDirectMessagesChatTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +func (client *Client) LoadDirectMessagesChatTopics(req *LoadDirectMessagesChatTopicsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "loadDirectMessagesChatTopics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetDirectMessagesChatTopicRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic to get + TopicId int64 `json:"topic_id"` +} + +// Returns information about the topic in a channel direct messages chat administered by the current user +func (client *Client) GetDirectMessagesChatTopic(req *GetDirectMessagesChatTopicRequest) (*DirectMessagesChatTopic, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopic", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalDirectMessagesChatTopic(result.Data) +} + +type GetDirectMessagesChatTopicHistoryRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be fetched + TopicId int64 `json:"topic_id"` + // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns messages in the topic in a channel direct messages chat administered by the current user. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) +func (client *Client) GetDirectMessagesChatTopicHistory(req *GetDirectMessagesChatTopicHistoryRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type GetDirectMessagesChatTopicMessageByDateRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be fetched + TopicId int64 `json:"topic_id"` + // Point in time (Unix timestamp) relative to which to search for messages + Date int32 `json:"date"` +} + +// Returns the last message sent in the topic in a channel direct messages chat administered by the current user no later than the specified date +func (client *Client) GetDirectMessagesChatTopicMessageByDate(req *GetDirectMessagesChatTopicMessageByDateRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicMessageByDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "date": req.Date, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type DeleteDirectMessagesChatTopicHistoryRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be deleted + TopicId int64 `json:"topic_id"` +} + +// Deletes all messages in the topic in a channel direct messages chat administered by the current user +func (client *Client) DeleteDirectMessagesChatTopicHistory(req *DeleteDirectMessagesChatTopicHistoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteDirectMessagesChatTopicHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteDirectMessagesChatTopicMessagesByDateRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be deleted + TopicId int64 `json:"topic_id"` + // The minimum date of the messages to delete + MinDate int32 `json:"min_date"` + // The maximum date of the messages to delete + MaxDate int32 `json:"max_date"` +} + +// Deletes all messages between the specified dates in the topic in a channel direct messages chat administered by the current user. Messages sent in the last 30 seconds will not be deleted +func (client *Client) DeleteDirectMessagesChatTopicMessagesByDate(req *DeleteDirectMessagesChatTopicMessagesByDateRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteDirectMessagesChatTopicMessagesByDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "min_date": req.MinDate, + "max_date": req.MaxDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetDirectMessagesChatTopicIsMarkedAsUnreadRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` + // New value of is_marked_as_unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` +} + +// Changes the marked as unread state of the topic in a channel direct messages chat administered by the current user +func (client *Client) SetDirectMessagesChatTopicIsMarkedAsUnread(req *SetDirectMessagesChatTopicIsMarkedAsUnreadRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setDirectMessagesChatTopicIsMarkedAsUnread", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "is_marked_as_unread": req.IsMarkedAsUnread, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetDirectMessagesChatTopicDraftMessageRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` + // New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored + DraftMessage *DraftMessage `json:"draft_message"` +} + +// Changes the draft message in the topic in a channel direct messages chat administered by the current user +func (client *Client) SetDirectMessagesChatTopicDraftMessage(req *SetDirectMessagesChatTopicDraftMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setDirectMessagesChatTopicDraftMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "draft_message": req.DraftMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type UnpinAllDirectMessagesChatTopicMessagesRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` +} + +// Removes all pinned messages from the topic in a channel direct messages chat administered by the current user +func (client *Client) UnpinAllDirectMessagesChatTopicMessages(req *UnpinAllDirectMessagesChatTopicMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "unpinAllDirectMessagesChatTopicMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReadAllDirectMessagesChatTopicReactionsRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` +} + +// Removes all unread reactions in the topic in a channel direct messages chat administered by the current user +func (client *Client) ReadAllDirectMessagesChatTopicReactions(req *ReadAllDirectMessagesChatTopicReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readAllDirectMessagesChatTopicReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type LoadSavedMessagesTopicsRequest struct { // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached Limit int32 `json:"limit"` @@ -2797,6 +3140,8 @@ func (client *Client) DeleteChat(req *DeleteChatRequest) (*Ok, error) { type SearchChatMessagesRequest struct { // Identifier of the chat in which to search messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to search messages only in specific topic; pass null to search for messages in all topics + TopicId MessageTopic `json:"topic_id"` // Query to search for Query string `json:"query"` // Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats @@ -2809,13 +3154,9 @@ type SearchChatMessagesRequest struct { Limit int32 `json:"limit"` // Additional filter for messages to search; pass null to search for all messages Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified thread will be returned; supergroups only - MessageThreadId int64 `json:"message_thread_id"` - // If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } -// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation +// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and topic_id search criteria is expected to be supported, only if it is required for Telegram official application implementation func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*FoundChatMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2823,14 +3164,13 @@ func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Found }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "query": req.Query, "sender_id": req.SenderId, "from_message_id": req.FromMessageId, "offset": req.Offset, "limit": req.Limit, "filter": req.Filter, - "message_thread_id": req.MessageThreadId, - "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -3371,12 +3711,12 @@ func (client *Client) GetChatSparseMessagePositions(req *GetChatSparseMessagePos type GetChatMessageCalendarRequest struct { // Identifier of the chat in which to return information about messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to get the result only in specific topic; pass null to get the result in all topics; forum topics aren't supported + TopicId MessageTopic `json:"topic_id"` // Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function Filter SearchMessagesFilter `json:"filter"` // The message identifier from which to return information about messages; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // If not0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } // Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" @@ -3387,9 +3727,9 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "filter": req.Filter, "from_message_id": req.FromMessageId, - "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -3406,15 +3746,15 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) type GetChatMessageCountRequest struct { // Identifier of the chat in which to count messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to get number of messages only in specific topic; pass null to get number of messages in all topics + TopicId MessageTopic `json:"topic_id"` // Filter for message content; searchMessagesFilterEmpty is unsupported in this function Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally ReturnLocal bool `json:"return_local"` } -// Returns approximate number of messages of the specified type in the chat +// Returns approximate number of messages of the specified type in the chat or its topic func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Count, error) { result, err := client.Send(Request{ meta: meta{ @@ -3422,8 +3762,8 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "filter": req.Filter, - "saved_messages_topic_id": req.SavedMessagesTopicId, "return_local": req.ReturnLocal, }, }) @@ -3441,17 +3781,15 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou type GetChatMessagePositionRequest struct { // Identifier of the chat in which to find message position ChatId int64 `json:"chat_id"` - // Message identifier - MessageId int64 `json:"message_id"` + // Pass topic identifier to get position among messages only in specific topic; pass null to get position among all chat messages + TopicId MessageTopic `json:"topic_id"` // Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified thread will be considered; supergroups only - MessageThreadId int64 `json:"message_thread_id"` - // If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // Message identifier + MessageId int64 `json:"message_id"` } -// Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats +// Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat and topic. Cannot be used in secret chats func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) (*Count, error) { result, err := client.Send(Request{ meta: meta{ @@ -3459,10 +3797,9 @@ func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_id": req.MessageId, + "topic_id": req.TopicId, "filter": req.Filter, - "message_thread_id": req.MessageThreadId, - "saved_messages_topic_id": req.SavedMessagesTopicId, + "message_id": req.MessageId, }, }) if err != nil { @@ -4235,7 +4572,7 @@ type ForwardMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` - // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable + // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // Pass true to remove media captions of message copies. Ignored if send_copy is false RemoveCaption bool `json:"remove_caption"` @@ -4362,7 +4699,7 @@ func (client *Client) SendChatScreenshotTakenNotification(req *SendChatScreensho } type AddLocalMessageRequest struct { - // Target chat + // Target chat; channel direct messages chats aren't supported ChatId int64 `json:"chat_id"` // Identifier of the sender of the message SenderId MessageSender `json:"sender_id"` @@ -7976,8 +8313,10 @@ type OpenWebAppRequest struct { BotUserId int64 `json:"bot_user_id"` // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise Url string `json:"url"` - // If not 0, the message thread identifier in which the message will be sent + // If not 0, the message thread identifier to which the message will be sent MessageThreadId int64 `json:"message_thread_id"` + // If not 0, unique identifier of the topic of channel direct messages chat to which the message will be sent + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` // Information about the message or story to be replied in the message sent by the Web App; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` // Parameters to use to open the Web App @@ -7995,6 +8334,7 @@ func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { "bot_user_id": req.BotUserId, "url": req.Url, "message_thread_id": req.MessageThreadId, + "direct_messages_chat_topic_id": req.DirectMessagesChatTopicId, "reply_to": req.ReplyTo, "parameters": req.Parameters, }, @@ -10449,6 +10789,38 @@ func (client *Client) SetChatDiscussionGroup(req *SetChatDiscussionGroupRequest) return UnmarshalOk(result.Data) } +type SetChatDirectMessagesGroupRequest struct { + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Pass true if the direct messages group is enabled for the channel chat; pass false otherwise + IsEnabled bool `json:"is_enabled"` + // The new number of Telegram Stars that must be paid for each message that is sent to the direct messages chat unless the sender is an administrator of the channel chat; 0-getOption("paid_message_star_count_max"). The channel will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. Requires supergroupFullInfo.can_enable_paid_messages for positive amounts + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Changes direct messages group settings for a channel chat; requires owner privileges in the chat +func (client *Client) SetChatDirectMessagesGroup(req *SetChatDirectMessagesGroupRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatDirectMessagesGroup", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_enabled": req.IsEnabled, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetChatLocationRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -13114,7 +13486,7 @@ func (client *Client) SearchFileDownloads(req *SearchFileDownloadsRequest) (*Fou type SetApplicationVerificationTokenRequest struct { // Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired VerificationId int64 `json:"verification_id"` - // Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request + // Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; pass an empty string to abort verification and receive the error "VERIFICATION_FAILED" for the request Token string `json:"token"` } @@ -14779,8 +15151,8 @@ type SetGroupCallParticipantIsSpeakingRequest struct { IsSpeaking bool `json:"is_speaking"` } -// Informs TDLib that speaking state of a participant of an active group call has changed -func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallParticipantIsSpeakingRequest) (*Ok, error) { +// Informs TDLib that speaking state of a participant of an active group call has changed. Returns identifier of the participant if it is found +func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallParticipantIsSpeakingRequest) (MessageSender, error) { result, err := client.Send(Request{ meta: meta{ Type: "setGroupCallParticipantIsSpeaking", @@ -14799,7 +15171,16 @@ func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallPartici return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeMessageSenderUser: + return UnmarshalMessageSenderUser(result.Data) + + case TypeMessageSenderChat: + return UnmarshalMessageSenderChat(result.Data) + + default: + return nil, errors.New("invalid type") + } } type ToggleGroupCallParticipantIsMutedRequest struct { @@ -19258,6 +19639,8 @@ type ToggleSupergroupIsForumRequest struct { SupergroupId int64 `json:"supergroup_id"` // New value of is_forum IsForum bool `json:"is_forum"` + // New value of has_forum_tabs; ignored if is_forum is false + HasForumTabs bool `json:"has_forum_tabs"` } // Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums @@ -19269,6 +19652,7 @@ func (client *Client) ToggleSupergroupIsForum(req *ToggleSupergroupIsForumReques Data: map[string]interface{}{ "supergroup_id": req.SupergroupId, "is_forum": req.IsForum, + "has_forum_tabs": req.HasForumTabs, }, }) if err != nil { @@ -25371,6 +25755,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(result.Data) + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(result.Data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(result.Data) + case TypeUpdateQuickReplyShortcut: return UnmarshalUpdateQuickReplyShortcut(result.Data) diff --git a/client/type.go b/client/type.go index ab92cfc..2fd662d 100755 --- a/client/type.go +++ b/client/type.go @@ -45,6 +45,7 @@ const ( ClassMessageOrigin = "MessageOrigin" ClassReactionType = "ReactionType" ClassPaidReactionType = "PaidReactionType" + ClassMessageTopic = "MessageTopic" ClassMessageEffectType = "MessageEffectType" ClassMessageSendingState = "MessageSendingState" ClassMessageReplyTo = "MessageReplyTo" @@ -400,6 +401,7 @@ const ( ClassWebAppOpenParameters = "WebAppOpenParameters" ClassMessageThreadInfo = "MessageThreadInfo" ClassSavedMessagesTopic = "SavedMessagesTopic" + ClassDirectMessagesChatTopic = "DirectMessagesChatTopic" ClassForumTopicIcon = "ForumTopicIcon" ClassForumTopicInfo = "ForumTopicInfo" ClassForumTopic = "ForumTopic" @@ -965,6 +967,9 @@ const ( TypeMessageReactions = "messageReactions" TypeMessageInteractionInfo = "messageInteractionInfo" TypeUnreadReaction = "unreadReaction" + TypeMessageTopicForum = "messageTopicForum" + TypeMessageTopicDirectMessages = "messageTopicDirectMessages" + TypeMessageTopicSavedMessages = "messageTopicSavedMessages" TypeMessageEffectTypeEmojiReaction = "messageEffectTypeEmojiReaction" TypeMessageEffectTypePremiumSticker = "messageEffectTypePremiumSticker" TypeMessageEffect = "messageEffect" @@ -991,6 +996,7 @@ const ( TypeMessageSourceChatHistory = "messageSourceChatHistory" TypeMessageSourceMessageThreadHistory = "messageSourceMessageThreadHistory" TypeMessageSourceForumTopicHistory = "messageSourceForumTopicHistory" + TypeMessageSourceDirectMessagesChatTopicHistory = "messageSourceDirectMessagesChatTopicHistory" TypeMessageSourceHistoryPreview = "messageSourceHistoryPreview" TypeMessageSourceChatList = "messageSourceChatList" TypeMessageSourceSearch = "messageSourceSearch" @@ -1101,6 +1107,7 @@ const ( TypeSavedMessagesTopicTypeAuthorHidden = "savedMessagesTopicTypeAuthorHidden" TypeSavedMessagesTopicTypeSavedFromChat = "savedMessagesTopicTypeSavedFromChat" TypeSavedMessagesTopic = "savedMessagesTopic" + TypeDirectMessagesChatTopic = "directMessagesChatTopic" TypeForumTopicIcon = "forumTopicIcon" TypeForumTopicInfo = "forumTopicInfo" TypeForumTopic = "forumTopic" @@ -1384,6 +1391,7 @@ const ( TypeMessageRefundedUpgradedGift = "messageRefundedUpgradedGift" TypeMessagePaidMessagesRefunded = "messagePaidMessagesRefunded" TypeMessagePaidMessagePriceChanged = "messagePaidMessagePriceChanged" + TypeMessageDirectMessagePriceChanged = "messageDirectMessagePriceChanged" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -2273,6 +2281,8 @@ const ( TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" TypeUpdateSavedMessagesTopic = "updateSavedMessagesTopic" TypeUpdateSavedMessagesTopicCount = "updateSavedMessagesTopicCount" + TypeUpdateDirectMessagesChatTopic = "updateDirectMessagesChatTopic" + TypeUpdateTopicMessageCount = "updateTopicMessageCount" TypeUpdateQuickReplyShortcut = "updateQuickReplyShortcut" TypeUpdateQuickReplyShortcutDeleted = "updateQuickReplyShortcutDeleted" TypeUpdateQuickReplyShortcuts = "updateQuickReplyShortcuts" @@ -2584,6 +2594,11 @@ type PaidReactionType interface { PaidReactionTypeType() string } +// Describes a topic of messages in a chat +type MessageTopic interface { + MessageTopicType() string +} + // Describes type of emoji effect type MessageEffectType interface { MessageEffectTypeType() string @@ -7626,11 +7641,11 @@ func (*ChatPermissions) GetType() string { // Describes rights of the administrator type ChatAdministratorRights struct { meta - // True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only + // True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` - // True, if the administrator can create channel posts or view channel statistics; applicable to channels only + // True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only CanPostMessages bool `json:"can_post_messages"` // True, if the administrator can edit messages of other users and pin messages; applicable to channels only CanEditMessages bool `json:"can_edit_messages"` @@ -10639,7 +10654,7 @@ func (*StarTransactionTypePaidMessageSend) StarTransactionTypeType() string { return TypeStarTransactionTypePaidMessageSend } -// The transaction is a receiving of a paid message; for regular users and supergroup chats only +// The transaction is a receiving of a paid message; for regular users, supergroup and channel chats only type StarTransactionTypePaidMessageReceive struct { meta // Identifier of the sender of the message @@ -13165,8 +13180,16 @@ type Supergroup struct { IsBroadcastGroup bool `json:"is_broadcast_group"` // True, if the supergroup is a forum with topics IsForum bool `json:"is_forum"` + // True, if the supergroup is a direct message group for a channel chat + IsDirectMessagesGroup bool `json:"is_direct_messages_group"` + // True, if the supergroup is a direct messages group for a channel chat that is administered by the current user + IsAdministeredDirectMessagesGroup bool `json:"is_administered_direct_messages_group"` // Information about verification status of the supergroup or channel; may be null if none VerificationStatus *VerificationStatus `json:"verification_status"` + // True, if the channel has direct messages group + HasDirectMessagesGroup bool `json:"has_direct_messages_group"` + // True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups + HasForumTabs bool `json:"has_forum_tabs"` // True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler HasSensitiveContent bool `json:"has_sensitive_content"` // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted @@ -13215,7 +13238,11 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { IsChannel bool `json:"is_channel"` IsBroadcastGroup bool `json:"is_broadcast_group"` IsForum bool `json:"is_forum"` + IsDirectMessagesGroup bool `json:"is_direct_messages_group"` + IsAdministeredDirectMessagesGroup bool `json:"is_administered_direct_messages_group"` VerificationStatus *VerificationStatus `json:"verification_status"` + HasDirectMessagesGroup bool `json:"has_direct_messages_group"` + HasForumTabs bool `json:"has_forum_tabs"` HasSensitiveContent bool `json:"has_sensitive_content"` RestrictionReason string `json:"restriction_reason"` PaidMessageStarCount int64 `json:"paid_message_star_count"` @@ -13245,7 +13272,11 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.IsChannel = tmp.IsChannel supergroup.IsBroadcastGroup = tmp.IsBroadcastGroup supergroup.IsForum = tmp.IsForum + supergroup.IsDirectMessagesGroup = tmp.IsDirectMessagesGroup + supergroup.IsAdministeredDirectMessagesGroup = tmp.IsAdministeredDirectMessagesGroup supergroup.VerificationStatus = tmp.VerificationStatus + supergroup.HasDirectMessagesGroup = tmp.HasDirectMessagesGroup + supergroup.HasForumTabs = tmp.HasForumTabs supergroup.HasSensitiveContent = tmp.HasSensitiveContent supergroup.RestrictionReason = tmp.RestrictionReason supergroup.PaidMessageStarCount = tmp.PaidMessageStarCount @@ -13275,6 +13306,8 @@ type SupergroupFullInfo struct { BannedCount int32 `json:"banned_count"` // Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown LinkedChatId int64 `json:"linked_chat_id"` + // Chat identifier of a direct messages group for the channel, or a channel, for which the supergroup is the designated direct messages group; 0 if none + DirectMessagesChatId int64 `json:"direct_messages_chat_id"` // Delay between consecutive sent messages for non-administrator supergroup members, in seconds SlowModeDelay int32 `json:"slow_mode_delay"` // Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero @@ -14515,6 +14548,87 @@ func (unreadReaction *UnreadReaction) UnmarshalJSON(data []byte) error { return nil } +// A topic in a forum supergroup chat +type MessageTopicForum struct { + meta + // Unique identifier of the forum topic; all messages in a non-forum supergroup chats belongs to the General topic + ForumTopicId int64 `json:"forum_topic_id"` +} + +func (entity *MessageTopicForum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicForum + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicForum) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicForum) GetType() string { + return TypeMessageTopicForum +} + +func (*MessageTopicForum) MessageTopicType() string { + return TypeMessageTopicForum +} + +// A topic in a channel direct messages chat administered by the current user +type MessageTopicDirectMessages struct { + meta + // Unique identifier of the topic + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` +} + +func (entity *MessageTopicDirectMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicDirectMessages + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicDirectMessages) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicDirectMessages) GetType() string { + return TypeMessageTopicDirectMessages +} + +func (*MessageTopicDirectMessages) MessageTopicType() string { + return TypeMessageTopicDirectMessages +} + +// A topic in Saved Messages chat +type MessageTopicSavedMessages struct { + meta + // Unique identifier of the Saved Messages topic + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` +} + +func (entity *MessageTopicSavedMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicSavedMessages + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicSavedMessages) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicSavedMessages) GetType() string { + return TypeMessageTopicSavedMessages +} + +func (*MessageTopicSavedMessages) MessageTopicType() string { + return TypeMessageTopicSavedMessages +} + // An effect from an emoji reaction type MessageEffectTypeEmojiReaction struct { meta @@ -14973,14 +15087,12 @@ 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 using inputMessageForwarded or forwardMessages with copy options + // True, if content of the message can be saved locally 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"` // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts IsChannelPost bool `json:"is_channel_post"` - // True, if the message is a forum topic message - IsTopicMessage bool `json:"is_topic_message"` // True, if the message contains an unread mention for the current user ContainsUnreadMention bool `json:"contains_unread_mention"` // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages @@ -15001,8 +15113,8 @@ type Message struct { ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs MessageThreadId int64 `json:"message_thread_id"` - // Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // Identifier of the topic within the chat to which the message belongs; may be null if none + TopicId MessageTopic `json:"topic_id"` // The message's self-destruct type; may be null if none SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet @@ -15062,7 +15174,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { CanBeSaved bool `json:"can_be_saved"` HasTimestampedMedia bool `json:"has_timestamped_media"` IsChannelPost bool `json:"is_channel_post"` - IsTopicMessage bool `json:"is_topic_message"` ContainsUnreadMention bool `json:"contains_unread_mention"` Date int32 `json:"date"` EditDate int32 `json:"edit_date"` @@ -15073,7 +15184,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { FactCheck *FactCheck `json:"fact_check"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + TopicId json.RawMessage `json:"topic_id"` SelfDestructType json.RawMessage `json:"self_destruct_type"` SelfDestructIn float64 `json:"self_destruct_in"` AutoDeleteIn float64 `json:"auto_delete_in"` @@ -15103,7 +15214,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.CanBeSaved = tmp.CanBeSaved message.HasTimestampedMedia = tmp.HasTimestampedMedia message.IsChannelPost = tmp.IsChannelPost - message.IsTopicMessage = tmp.IsTopicMessage message.ContainsUnreadMention = tmp.ContainsUnreadMention message.Date = tmp.Date message.EditDate = tmp.EditDate @@ -15113,7 +15223,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.UnreadReactions = tmp.UnreadReactions message.FactCheck = tmp.FactCheck message.MessageThreadId = tmp.MessageThreadId - message.SavedMessagesTopicId = tmp.SavedMessagesTopicId message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn message.ViaBotUserId = tmp.ViaBotUserId @@ -15138,6 +15247,9 @@ func (message *Message) UnmarshalJSON(data []byte) error { fieldReplyTo, _ := UnmarshalMessageReplyTo(tmp.ReplyTo) message.ReplyTo = fieldReplyTo + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + message.TopicId = fieldTopicId + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) message.SelfDestructType = fieldSelfDestructType @@ -15404,7 +15516,7 @@ func (*MessageSourceChatHistory) MessageSourceType() string { return TypeMessageSourceChatHistory } -// The message is from a message thread history +// The message is from history of a message thread type MessageSourceMessageThreadHistory struct{ meta } @@ -15429,7 +15541,7 @@ func (*MessageSourceMessageThreadHistory) MessageSourceType() string { return TypeMessageSourceMessageThreadHistory } -// The message is from a forum topic history +// The message is from history of a forum topic type MessageSourceForumTopicHistory struct{ meta } @@ -15454,6 +15566,31 @@ func (*MessageSourceForumTopicHistory) MessageSourceType() string { return TypeMessageSourceForumTopicHistory } +// The message is from history of a topic in a channel direct messages chat administered by the current user +type MessageSourceDirectMessagesChatTopicHistory struct{ + meta +} + +func (entity *MessageSourceDirectMessagesChatTopicHistory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceDirectMessagesChatTopicHistory + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceDirectMessagesChatTopicHistory) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceDirectMessagesChatTopicHistory) GetType() string { + return TypeMessageSourceDirectMessagesChatTopicHistory +} + +func (*MessageSourceDirectMessagesChatTopicHistory) MessageSourceType() string { + return TypeMessageSourceDirectMessagesChatTopicHistory +} + // The message is from chat, message thread or forum topic history preview type MessageSourceHistoryPreview struct{ meta @@ -19020,6 +19157,86 @@ func (savedMessagesTopic *SavedMessagesTopic) UnmarshalJSON(data []byte) error { return nil } +// Contains information about a topic in a channel direct messages chat administered by the current user +type DirectMessagesChatTopic struct { + meta + // Identifier of the chat to which the topic belongs + ChatId int64 `json:"chat_id"` + // Unique topic identifier + Id int64 `json:"id"` + // Identifier of the user or chat that sends the messages to the topic + SenderId MessageSender `json:"sender_id"` + // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order + Order JsonInt64 `json:"order"` + // True, if the forum topic is marked as unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + // Number of unread messages in the chat + UnreadCount int64 `json:"unread_count"` + // Identifier of the last read incoming message + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + // Identifier of the last read outgoing message + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Number of messages with unread reactions in the chat + UnreadReactionCount int64 `json:"unread_reaction_count"` + // Last message in the topic; may be null if none or unknown + LastMessage *Message `json:"last_message"` + // A draft of a message in the topic; may be null if none + DraftMessage *DraftMessage `json:"draft_message"` +} + +func (entity *DirectMessagesChatTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DirectMessagesChatTopic + + return json.Marshal((*stub)(entity)) +} + +func (*DirectMessagesChatTopic) GetClass() string { + return ClassDirectMessagesChatTopic +} + +func (*DirectMessagesChatTopic) GetType() string { + return TypeDirectMessagesChatTopic +} + +func (directMessagesChatTopic *DirectMessagesChatTopic) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + Id int64 `json:"id"` + SenderId json.RawMessage `json:"sender_id"` + Order JsonInt64 `json:"order"` + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + UnreadCount int64 `json:"unread_count"` + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + UnreadReactionCount int64 `json:"unread_reaction_count"` + LastMessage *Message `json:"last_message"` + DraftMessage *DraftMessage `json:"draft_message"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + directMessagesChatTopic.ChatId = tmp.ChatId + directMessagesChatTopic.Id = tmp.Id + directMessagesChatTopic.Order = tmp.Order + directMessagesChatTopic.IsMarkedAsUnread = tmp.IsMarkedAsUnread + directMessagesChatTopic.UnreadCount = tmp.UnreadCount + directMessagesChatTopic.LastReadInboxMessageId = tmp.LastReadInboxMessageId + directMessagesChatTopic.LastReadOutboxMessageId = tmp.LastReadOutboxMessageId + directMessagesChatTopic.UnreadReactionCount = tmp.UnreadReactionCount + directMessagesChatTopic.LastMessage = tmp.LastMessage + directMessagesChatTopic.DraftMessage = tmp.DraftMessage + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + directMessagesChatTopic.SenderId = fieldSenderId + + return nil +} + // Describes a forum topic icon type ForumTopicIcon struct { meta @@ -19050,6 +19267,8 @@ type ForumTopicInfo struct { meta // Identifier of the forum chat to which the topic belongs ChatId int64 `json:"chat_id"` + // Forum topic identifier of the topic + ForumTopicId int64 `json:"forum_topic_id"` // Message thread identifier of the topic MessageThreadId int64 `json:"message_thread_id"` // Name of the topic @@ -19089,6 +19308,7 @@ func (*ForumTopicInfo) GetType() string { func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { var tmp struct { ChatId int64 `json:"chat_id"` + ForumTopicId int64 `json:"forum_topic_id"` MessageThreadId int64 `json:"message_thread_id"` Name string `json:"name"` Icon *ForumTopicIcon `json:"icon"` @@ -19106,6 +19326,7 @@ func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { } forumTopicInfo.ChatId = tmp.ChatId + forumTopicInfo.ForumTopicId = tmp.ForumTopicId forumTopicInfo.MessageThreadId = tmp.MessageThreadId forumTopicInfo.Name = tmp.Name forumTopicInfo.Icon = tmp.Icon @@ -27045,7 +27266,7 @@ func (messageCall *MessageCall) UnmarshalJSON(data []byte) error { return nil } -// A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden +// A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use getGroupCallParticipants to show current group call participants on the screen. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden type MessageGroupCall struct { meta // True, if the call is active, i.e. the called user joined the call @@ -28441,6 +28662,8 @@ type MessageGift struct { Gift *Gift `json:"gift"` // Sender of the gift SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` // Message added to the gift @@ -28489,6 +28712,7 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { var tmp struct { Gift *Gift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` ReceivedGiftId string `json:"received_gift_id"` Text *FormattedText `json:"text"` SellStarCount int64 `json:"sell_star_count"` @@ -28523,6 +28747,9 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageGift.SenderId = fieldSenderId + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageGift.ReceiverId = fieldReceiverId + return nil } @@ -28533,6 +28760,8 @@ type MessageUpgradedGift struct { Gift *UpgradedGift `json:"gift"` // Sender of the gift; may be null for anonymous gifts SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift @@ -28579,6 +28808,7 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error var tmp struct { Gift *UpgradedGift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` ReceivedGiftId string `json:"received_gift_id"` IsUpgrade bool `json:"is_upgrade"` IsSaved bool `json:"is_saved"` @@ -28611,6 +28841,9 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageUpgradedGift.SenderId = fieldSenderId + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageUpgradedGift.ReceiverId = fieldReceiverId + return nil } @@ -28621,6 +28854,8 @@ type MessageRefundedUpgradedGift struct { Gift *Gift `json:"gift"` // Sender of the gift SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` } @@ -28649,6 +28884,7 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da var tmp struct { Gift *Gift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` IsUpgrade bool `json:"is_upgrade"` } @@ -28663,6 +28899,9 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageRefundedUpgradedGift.SenderId = fieldSenderId + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageRefundedUpgradedGift.ReceiverId = fieldReceiverId + return nil } @@ -28722,6 +28961,35 @@ func (*MessagePaidMessagePriceChanged) MessageContentType() string { return TypeMessagePaidMessagePriceChanged } +// A price for direct messages was changed in the channel chat +type MessageDirectMessagePriceChanged struct { + meta + // True, if direct messages group was enabled for the channel; false otherwise + IsEnabled bool `json:"is_enabled"` + // The new number of Telegram Stars that must be paid by non-administrator users of the channel chat for each message sent to the direct messages group; 0 if the direct messages group was disabled or the messages are free + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +func (entity *MessageDirectMessagePriceChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageDirectMessagePriceChanged + + return json.Marshal((*stub)(entity)) +} + +func (*MessageDirectMessagePriceChanged) GetClass() string { + return ClassMessageContent +} + +func (*MessageDirectMessagePriceChanged) GetType() string { + return TypeMessageDirectMessagePriceChanged +} + +func (*MessageDirectMessagePriceChanged) MessageContentType() string { + return TypeMessageDirectMessagePriceChanged +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -29940,6 +30208,8 @@ func (*MessageSelfDestructTypeImmediately) MessageSelfDestructTypeType() string // Options to be used when a message is sent type MessageSendOptions struct { meta + // Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` // Pass true to disable notification for the message DisableNotification bool `json:"disable_notification"` // Pass true if the message is sent from the background @@ -29952,7 +30222,7 @@ type MessageSendOptions struct { PaidMessageStarCount int64 `json:"paid_message_star_count"` // Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` - // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled + // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, to a channel direct messages chat, live location messages and self-destructing messages can't be scheduled SchedulingState MessageSchedulingState `json:"scheduling_state"` // Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats EffectId JsonInt64 `json:"effect_id"` @@ -29980,6 +30250,7 @@ func (*MessageSendOptions) GetType() string { func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { var tmp struct { + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` DisableNotification bool `json:"disable_notification"` FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` @@ -29997,6 +30268,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { return err } + messageSendOptions.DirectMessagesChatTopicId = tmp.DirectMessagesChatTopicId messageSendOptions.DisableNotification = tmp.DisableNotification messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent @@ -30016,7 +30288,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { // Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied type MessageCopyOptions struct { meta - // 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. Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable + // 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. Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false ReplaceCaption bool `json:"replace_caption"` @@ -30858,12 +31130,12 @@ func (*InputMessageInvoice) InputMessageContentType() string { return TypeInputMessageInvoice } -// A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot +// A message with a poll. Polls can't be sent to secret chats and channel direct messages chats. Polls can be sent to a private chat only if the chat is a chat with a bot or the Saved Messages chat type InputMessagePoll struct { meta // Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users Question *FormattedText `json:"question"` - // List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users + // List of poll answer options, 2-getOption("poll_answer_count_max") strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users Options []*FormattedText `json:"options"` // True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels IsAnonymous bool `json:"is_anonymous"` @@ -30995,6 +31267,8 @@ func (*InputMessageForwarded) InputMessageContentType() string { // Contains properties of a message and describes actions that can be done with the message right now type MessageProperties struct { meta + // True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options + CanBeCopied bool `json:"can_be_copied"` // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options CanBeCopiedToSecretChat bool `json:"can_be_copied_to_secret_chat"` // True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false @@ -31003,7 +31277,7 @@ type MessageProperties struct { CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message CanBeEdited bool `json:"can_be_edited"` - // True, if the message can be forwarded using inputMessageForwarded or forwardMessages + // True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options CanBeForwarded bool `json:"can_be_forwarded"` // True, if the message can be paid using inputInvoiceMessage CanBePaid bool `json:"can_be_paid"` @@ -31013,7 +31287,7 @@ type MessageProperties struct { CanBeReplied bool `json:"can_be_replied"` // True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` - // True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options + // True, if content of the message can be saved locally CanBeSaved bool `json:"can_be_saved"` // True, if the message can be shared in a story using inputStoryAreaTypeMessage CanBeSharedInStory bool `json:"can_be_shared_in_story"` @@ -31021,6 +31295,8 @@ type MessageProperties struct { CanEditMedia bool `json:"can_edit_media"` // True, if scheduling state of the message can be edited CanEditSchedulingState bool `json:"can_edit_scheduling_state"` + // True, if author of the message sent on behalf of a chat can be received through getMessageAuthor + CanGetAuthor bool `json:"can_get_author"` // True, if code for message embedding can be received using getMessageEmbeddingCode CanGetEmbeddingCode bool `json:"can_get_embedding_code"` // True, if a link can be generated for the message using getMessageLink @@ -34981,7 +35257,7 @@ func (*ResendCodeReasonUserRequest) ResendCodeReasonType() string { // The code is re-sent, because device verification has failed type ResendCodeReasonVerificationFailed struct { meta - // Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, or APNS_INIT_FAILED + // Cause of the verification failure, for example, "PLAY_SERVICES_NOT_AVAILABLE", "APNS_RECEIVE_TIMEOUT", or "APNS_INIT_FAILED" ErrorMessage string `json:"error_message"` } @@ -49650,7 +49926,7 @@ func (*InternalLinkTypeGame) InternalLinkTypeType() string { return TypeInternalLinkTypeGame } -// The link is a link to a group call that isn't bound to a chat. Call joinGroupCall with the given invite_link +// The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. Call joinGroupCall with the given invite_link to join the call type InternalLinkTypeGroupCall struct { meta // Internal representation of the invite link @@ -54541,7 +54817,7 @@ func (*VectorPathCommandLine) VectorPathCommandType() string { return TypeVectorPathCommandLine } -// A cubic Bézier curve to a given point +// A cubic Bézier curve to a given point type VectorPathCommandCubicBezierCurve struct { meta // The start control point of the curve @@ -56538,6 +56814,85 @@ func (*UpdateSavedMessagesTopicCount) UpdateType() string { return TypeUpdateSavedMessagesTopicCount } +// Basic information about a topic in a channel direct messages chat administered by the current user has changed. This update is guaranteed to come before the topic identifier is returned to the application +type UpdateDirectMessagesChatTopic struct { + meta + // New data about the topic + Topic *DirectMessagesChatTopic `json:"topic"` +} + +func (entity *UpdateDirectMessagesChatTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateDirectMessagesChatTopic + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateDirectMessagesChatTopic) GetClass() string { + return ClassUpdate +} + +func (*UpdateDirectMessagesChatTopic) GetType() string { + return TypeUpdateDirectMessagesChatTopic +} + +func (*UpdateDirectMessagesChatTopic) UpdateType() string { + return TypeUpdateDirectMessagesChatTopic +} + +// Number of messages in a topic has changed; for Saved Messages and channel direct messages chat topics only +type UpdateTopicMessageCount struct { + meta + // Identifier of the chat in topic of which the number of messages has changed + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId MessageTopic `json:"topic_id"` + // Approximate number of messages in the topics + MessageCount int32 `json:"message_count"` +} + +func (entity *UpdateTopicMessageCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTopicMessageCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTopicMessageCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateTopicMessageCount) GetType() string { + return TypeUpdateTopicMessageCount +} + +func (*UpdateTopicMessageCount) UpdateType() string { + return TypeUpdateTopicMessageCount +} + +func (updateTopicMessageCount *UpdateTopicMessageCount) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + TopicId json.RawMessage `json:"topic_id"` + MessageCount int32 `json:"message_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateTopicMessageCount.ChatId = tmp.ChatId + updateTopicMessageCount.MessageCount = tmp.MessageCount + + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + updateTopicMessageCount.TopicId = fieldTopicId + + return nil +} + // Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application type UpdateQuickReplyShortcut struct { meta @@ -56688,6 +57043,10 @@ type UpdateForumTopic struct { LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` // Identifier of the last read outgoing message LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Number of unread messages with a mention/reply in the topic + UnreadMentionCount int32 `json:"unread_mention_count"` + // Number of messages with unread reactions in the topic + UnreadReactionCount int32 `json:"unread_reaction_count"` // Notification settings for the topic NotificationSettings *ChatNotificationSettings `json:"notification_settings"` } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index d5efa81..6adae01 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1599,6 +1599,43 @@ func UnmarshalListOfPaidReactionType(dataList []json.RawMessage) ([]PaidReaction return list, nil } +func UnmarshalMessageTopic(data json.RawMessage) (MessageTopic, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageTopicForum: + return UnmarshalMessageTopicForum(data) + + case TypeMessageTopicDirectMessages: + return UnmarshalMessageTopicDirectMessages(data) + + case TypeMessageTopicSavedMessages: + return UnmarshalMessageTopicSavedMessages(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageTopic(dataList []json.RawMessage) ([]MessageTopic, error) { + list := []MessageTopic{} + + for _, data := range dataList { + entity, err := UnmarshalMessageTopic(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageEffectType(data json.RawMessage) (MessageEffectType, error) { var meta meta @@ -1756,6 +1793,9 @@ func UnmarshalMessageSource(data json.RawMessage) (MessageSource, error) { case TypeMessageSourceForumTopicHistory: return UnmarshalMessageSourceForumTopicHistory(data) + case TypeMessageSourceDirectMessagesChatTopicHistory: + return UnmarshalMessageSourceDirectMessagesChatTopicHistory(data) + case TypeMessageSourceHistoryPreview: return UnmarshalMessageSourceHistoryPreview(data) @@ -3608,6 +3648,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePaidMessagePriceChanged: return UnmarshalMessagePaidMessagePriceChanged(data) + case TypeMessageDirectMessagePriceChanged: + return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -8393,6 +8436,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(data) + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(data) + case TypeUpdateQuickReplyShortcut: return UnmarshalUpdateQuickReplyShortcut(data) @@ -11484,6 +11533,30 @@ func UnmarshalUnreadReaction(data json.RawMessage) (*UnreadReaction, error) { return &resp, err } +func UnmarshalMessageTopicForum(data json.RawMessage) (*MessageTopicForum, error) { + var resp MessageTopicForum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageTopicDirectMessages(data json.RawMessage) (*MessageTopicDirectMessages, error) { + var resp MessageTopicDirectMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageTopicSavedMessages(data json.RawMessage) (*MessageTopicSavedMessages, error) { + var resp MessageTopicSavedMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageEffectTypeEmojiReaction(data json.RawMessage) (*MessageEffectTypeEmojiReaction, error) { var resp MessageEffectTypeEmojiReaction @@ -11692,6 +11765,14 @@ func UnmarshalMessageSourceForumTopicHistory(data json.RawMessage) (*MessageSour return &resp, err } +func UnmarshalMessageSourceDirectMessagesChatTopicHistory(data json.RawMessage) (*MessageSourceDirectMessagesChatTopicHistory, error) { + var resp MessageSourceDirectMessagesChatTopicHistory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSourceHistoryPreview(data json.RawMessage) (*MessageSourceHistoryPreview, error) { var resp MessageSourceHistoryPreview @@ -12572,6 +12653,14 @@ func UnmarshalSavedMessagesTopic(data json.RawMessage) (*SavedMessagesTopic, err return &resp, err } +func UnmarshalDirectMessagesChatTopic(data json.RawMessage) (*DirectMessagesChatTopic, error) { + var resp DirectMessagesChatTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalForumTopicIcon(data json.RawMessage) (*ForumTopicIcon, error) { var resp ForumTopicIcon @@ -14836,6 +14925,14 @@ func UnmarshalMessagePaidMessagePriceChanged(data json.RawMessage) (*MessagePaid return &resp, err } +func UnmarshalMessageDirectMessagePriceChanged(data json.RawMessage) (*MessageDirectMessagePriceChanged, error) { + var resp MessageDirectMessagePriceChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -21948,6 +22045,22 @@ func UnmarshalUpdateSavedMessagesTopicCount(data json.RawMessage) (*UpdateSavedM return &resp, err } +func UnmarshalUpdateDirectMessagesChatTopic(data json.RawMessage) (*UpdateDirectMessagesChatTopic, error) { + var resp UpdateDirectMessagesChatTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateTopicMessageCount(data json.RawMessage) (*UpdateTopicMessageCount, error) { + var resp UpdateTopicMessageCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateQuickReplyShortcut(data json.RawMessage) (*UpdateQuickReplyShortcut, error) { var resp UpdateQuickReplyShortcut @@ -23929,6 +24042,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUnreadReaction: return UnmarshalUnreadReaction(data) + case TypeMessageTopicForum: + return UnmarshalMessageTopicForum(data) + + case TypeMessageTopicDirectMessages: + return UnmarshalMessageTopicDirectMessages(data) + + case TypeMessageTopicSavedMessages: + return UnmarshalMessageTopicSavedMessages(data) + case TypeMessageEffectTypeEmojiReaction: return UnmarshalMessageEffectTypeEmojiReaction(data) @@ -24007,6 +24129,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSourceForumTopicHistory: return UnmarshalMessageSourceForumTopicHistory(data) + case TypeMessageSourceDirectMessagesChatTopicHistory: + return UnmarshalMessageSourceDirectMessagesChatTopicHistory(data) + case TypeMessageSourceHistoryPreview: return UnmarshalMessageSourceHistoryPreview(data) @@ -24337,6 +24462,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSavedMessagesTopic: return UnmarshalSavedMessagesTopic(data) + case TypeDirectMessagesChatTopic: + return UnmarshalDirectMessagesChatTopic(data) + case TypeForumTopicIcon: return UnmarshalForumTopicIcon(data) @@ -25186,6 +25314,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePaidMessagePriceChanged: return UnmarshalMessagePaidMessagePriceChanged(data) + case TypeMessageDirectMessagePriceChanged: + return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -27853,6 +27984,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(data) + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(data) + case TypeUpdateQuickReplyShortcut: return UnmarshalUpdateQuickReplyShortcut(data) diff --git a/data/td_api.tl b/data/td_api.tl index b4ebb53..5b4847b 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -838,9 +838,10 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_link_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_create_topics:Bool = ChatPermissions; //@description Describes rights of the administrator -//@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only +//@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, +//-ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only //@can_change_info True, if the administrator can change the chat title, photo, and other settings -//@can_post_messages True, if the administrator can create channel posts or view channel statistics; applicable to channels only +//@can_post_messages True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only //@can_delete_messages True, if the administrator can delete messages of other users //@can_invite_users True, if the administrator can invite new users to the chat @@ -1393,7 +1394,7 @@ starTransactionTypeAffiliateProgramCommission chat_id:int53 commission_per_mille //@description The transaction is a sending of a paid message; for regular users only @chat_id Identifier of the chat that received the payment @message_count Number of sent paid messages starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTransactionType; -//@description The transaction is a receiving of a paid message; for regular users and supergroup chats only +//@description The transaction is a receiving of a paid message; for regular users, supergroup and channel chats only //@sender_id Identifier of the sender of the message //@message_count Number of received paid messages //@commission_per_mille The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending @@ -1861,13 +1862,17 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@is_channel True, if the supergroup is a channel //@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members //@is_forum True, if the supergroup is a forum with topics +//@is_direct_messages_group True, if the supergroup is a direct message group for a channel chat +//@is_administered_direct_messages_group True, if the supergroup is a direct messages group for a channel chat that is administered by the current user //@verification_status Information about verification status of the supergroup or channel; may be null if none +//@has_direct_messages_group True, if the channel has direct messages group +//@has_forum_tabs True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups //@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted //@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_direct_messages_group:Bool is_administered_direct_messages_group:Bool verification_status:verificationStatus has_direct_messages_group:Bool has_forum_tabs:Bool has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1877,6 +1882,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@restricted_count Number of restricted users in the supergroup; 0 if unknown //@banned_count Number of users banned from chat; 0 if unknown //@linked_chat_id Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown +//@direct_messages_chat_id Chat identifier of a direct messages group for the channel, or a channel, for which the supergroup is the designated direct messages group; 0 if none //@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds //@slow_mode_delay_expires_in Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero //@can_enable_paid_messages True, if paid messages can be enabled in the supergroup chat; for supergroup only @@ -1908,7 +1914,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 direct_messages_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -2091,6 +2097,18 @@ messageInteractionInfo view_count:int32 forward_count:int32 reply_info:messageRe unreadReaction type:ReactionType sender_id:MessageSender is_big:Bool = UnreadReaction; +//@class MessageTopic @description Describes a topic of messages in a chat + +//@description A topic in a forum supergroup chat @forum_topic_id Unique identifier of the forum topic; all messages in a non-forum supergroup chats belongs to the General topic +messageTopicForum forum_topic_id:int53 = MessageTopic; + +//@description A topic in a channel direct messages chat administered by the current user @direct_messages_chat_topic_id Unique identifier of the topic +messageTopicDirectMessages direct_messages_chat_topic_id:int53 = MessageTopic; + +//@description A topic in Saved Messages chat @saved_messages_topic_id Unique identifier of the Saved Messages topic +messageTopicSavedMessages saved_messages_topic_id:int53 = MessageTopic; + + //@class MessageEffectType @description Describes type of emoji effect //@description An effect from an emoji reaction @select_animation Select animation for the effect in TGS format @effect_animation Effect animation for the effect in TGS format @@ -2189,10 +2207,9 @@ 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 using inputMessageForwarded or forwardMessages with copy options +//@can_be_saved True, if content of the message can be saved locally //@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 //@contains_unread_mention True, if the message contains an unread mention for the current user //@date Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages //@edit_date Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages @@ -2203,7 +2220,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@fact_check Information about fact-check added to the message; may be null if none //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs -//@saved_messages_topic_id Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages +//@topic_id Identifier of the topic within the chat to which the message belongs; may be null if none //@self_destruct_type The message's self-destruct type; may be null if none //@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet //@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never @@ -2218,7 +2235,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2255,12 +2272,15 @@ businessMessages messages:vector = BusinessMessages; //@description The message is from a chat history messageSourceChatHistory = MessageSource; -//@description The message is from a message thread history +//@description The message is from history of a message thread messageSourceMessageThreadHistory = MessageSource; -//@description The message is from a forum topic history +//@description The message is from history of a forum topic messageSourceForumTopicHistory = MessageSource; +//@description The message is from history of a topic in a channel direct messages chat administered by the current user +messageSourceDirectMessagesChatTopicHistory = MessageSource; + //@description The message is from chat, message thread or forum topic history preview messageSourceHistoryPreview = MessageSource; @@ -2892,11 +2912,27 @@ savedMessagesTopicTypeSavedFromChat chat_id:int53 = SavedMessagesTopicType; savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int64 last_message:message draft_message:draftMessage = SavedMessagesTopic; +//@description Contains information about a topic in a channel direct messages chat administered by the current user +//@chat_id Identifier of the chat to which the topic belongs +//@id Unique topic identifier +//@sender_id Identifier of the user or chat that sends the messages to the topic +//@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order +//@is_marked_as_unread True, if the forum topic is marked as unread +//@unread_count Number of unread messages in the chat +//@last_read_inbox_message_id Identifier of the last read incoming message +//@last_read_outbox_message_id Identifier of the last read outgoing message +//@unread_reaction_count Number of messages with unread reactions in the chat +//@last_message Last message in the topic; may be null if none or unknown +//@draft_message A draft of a message in the topic; may be null if none +directMessagesChatTopic chat_id:int53 id:int53 sender_id:MessageSender order:int64 is_marked_as_unread:Bool unread_count:int53 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_reaction_count:int53 last_message:message draft_message:draftMessage = DirectMessagesChatTopic; + + //@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@description Contains basic information about a forum topic //@chat_id Identifier of the forum chat to which the topic belongs +//@forum_topic_id Forum topic identifier of the topic //@message_thread_id Message thread identifier of the topic //@name Name of the topic //@icon Icon of the topic @@ -2906,7 +2942,7 @@ forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@is_outgoing True, if the topic was created by the current user //@is_closed True, if the topic is closed //@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only -forumTopicInfo chat_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; +forumTopicInfo chat_id:int53 forum_topic_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; //@description Describes a forum topic //@info Basic information about the topic @@ -4030,8 +4066,8 @@ messageInvoice product_info:productInfo currency:string total_amount:int53 start messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; //@description A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, -//-and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. -//-If the call become active or missed, then the call screen must be hidden +//-and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use getGroupCallParticipants to show current group call participants on the screen. +//-Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden //@is_active True, if the call is active, i.e. the called user joined the call //@was_missed True, if the called user missed or declined the call //@is_video True, if the call is a video call @@ -4244,6 +4280,7 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@description A regular gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift //@sender_id Sender of the gift +//@receiver_id Receiver of the gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of 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 regular gift; 0 if the gift can't be sold by the receiver @@ -4255,11 +4292,12 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@was_upgraded True, if the gift was upgraded to a unique gift //@was_refunded True, if the gift was refunded and isn't available anymore //@upgraded_received_gift_id Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift -messageGift gift:gift sender_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; +messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; //@description An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift //@sender_id Sender of the gift; may be null for anonymous gifts +//@receiver_id Receiver of the gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift @@ -4270,13 +4308,14 @@ messageGift gift:gift sender_id:MessageSender received_gift_id:string text:forma //@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift //@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; +messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded //@gift The gift //@sender_id Sender of the gift +//@receiver_id Receiver of the gift //@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift -messageRefundedUpgradedGift gift:gift sender_id:MessageSender is_upgrade:Bool = MessageContent; +messageRefundedUpgradedGift gift:gift sender_id:MessageSender receiver_id:MessageSender is_upgrade:Bool = MessageContent; //@description Paid messages were refunded @message_count The number of refunded messages @star_count The number of refunded Telegram Stars messagePaidMessagesRefunded message_count:int32 star_count:int53 = MessageContent; @@ -4284,6 +4323,12 @@ messagePaidMessagesRefunded message_count:int32 star_count:int53 = MessageConten //@description A price for paid messages was changed in the supergroup chat @paid_message_star_count The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message messagePaidMessagePriceChanged paid_message_star_count:int53 = MessageContent; +//@description A price for direct messages was changed in the channel chat +//@is_enabled True, if direct messages group was enabled for the channel; false otherwise +//@paid_message_star_count The new number of Telegram Stars that must be paid by non-administrator users of the channel chat for each message sent to the direct messages group; +//-0 if the direct messages group was disabled or the messages are free +messageDirectMessagePriceChanged is_enabled:Bool paid_message_star_count:int53 = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4437,21 +4482,23 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@description Options to be used when a message is sent +//@direct_messages_chat_topic_id Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user //@disable_notification Pass true to disable notification for the message //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only //@allow_paid_broadcast Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only //@paid_message_star_count The number of Telegram Stars the user agreed to pay to send the messages //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum -//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled +//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, to a channel direct messages chat, +//-live location messages and self-destructing messages can't be scheduled //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions direct_messages_chat_topic_id:int53 disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. -//-Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable +//-Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable //@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 media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false @@ -4590,9 +4637,9 @@ inputMessageGame bot_user_id:int53 game_short_name:string = InputMessageContent; //@paid_media_caption Paid media caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string paid_media:inputPaidMedia paid_media_caption:formattedText = InputMessageContent; -//@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot +//@description A message with a poll. Polls can't be sent to secret chats and channel direct messages chats. Polls can be sent to a private chat only if the chat is a chat with a bot or the Saved Messages chat //@question Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users -//@options List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users +//@options List of poll answer options, 2-getOption("poll_answer_count_max") strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users //@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels //@type Type of the poll //@open_period Amount of time the poll will be active after creation, in seconds; for bots only @@ -4616,20 +4663,22 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_be_copied True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. //-For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message -//@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages +//@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options //@can_be_paid True, if the message can be paid using inputInvoiceMessage //@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage //@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage //@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage -//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options +//@can_be_saved True, if content of the message can be saved locally //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage //@can_edit_media True, if the message can be edited using the method editMessageMedia //@can_edit_scheduling_state True, if scheduling state of the message can be edited +//@can_get_author True, if author of the message sent on behalf of a chat can be received through getMessageAuthor //@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode //@can_get_link True, if a link can be generated for the message using getMessageLink //@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink @@ -4643,7 +4692,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -5291,7 +5340,7 @@ chatBoostSlots slots:vector = ChatBoostSlots; resendCodeReasonUserRequest = ResendCodeReason; //@description The code is re-sent, because device verification has failed -//@error_message Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, or APNS_INIT_FAILED +//@error_message Cause of the verification failure, for example, "PLAY_SERVICES_NOT_AVAILABLE", "APNS_RECEIVE_TIMEOUT", or "APNS_INIT_FAILED" resendCodeReasonVerificationFailed error_message:string = ResendCodeReason; @@ -7478,7 +7527,9 @@ internalLinkTypeEditProfileSettings = InternalLinkType; //@game_short_name Short name of the game internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkType; -//@description The link is a link to a group call that isn't bound to a chat. Call joinGroupCall with the given invite_link @invite_link Internal representation of the invite link +//@description The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. +//-Call joinGroupCall with the given invite_link to join the call +//@invite_link Internal representation of the invite link internalLinkTypeGroupCall invite_link:string = InternalLinkType; //@description The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. @@ -8247,7 +8298,7 @@ point x:double y:double = Point; //@description A straight line to a given point @end_point The end point of the straight line vectorPathCommandLine end_point:point = VectorPathCommand; -//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve +//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve vectorPathCommandCubicBezierCurve start_control_point:point end_control_point:point end_point:point = VectorPathCommand; @@ -8494,6 +8545,16 @@ updateSavedMessagesTopic topic:savedMessagesTopic = Update; //@description Number of Saved Messages topics has changed @topic_count Approximate total number of Saved Messages topics updateSavedMessagesTopicCount topic_count:int32 = Update; +//@description Basic information about a topic in a channel direct messages chat administered by the current user has changed. This update is guaranteed to come before the topic identifier is returned to the application +//@topic New data about the topic +updateDirectMessagesChatTopic topic:directMessagesChatTopic = Update; + +//@description Number of messages in a topic has changed; for Saved Messages and channel direct messages chat topics only +//@chat_id Identifier of the chat in topic of which the number of messages has changed +//@topic_id Identifier of the topic +//@message_count Approximate number of messages in the topics +updateTopicMessageCount chat_id:int53 topic_id:MessageTopic message_count:int32 = Update; + //@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application //@shortcut New data about the shortcut updateQuickReplyShortcut shortcut:quickReplyShortcut = Update; @@ -8518,8 +8579,10 @@ updateForumTopicInfo info:forumTopicInfo = Update; //@is_pinned True, if the topic is pinned in the topic list //@last_read_inbox_message_id Identifier of the last read incoming message //@last_read_outbox_message_id Identifier of the last read outgoing message +//@unread_mention_count Number of unread messages with a mention/reply in the topic +//@unread_reaction_count Number of messages with unread reactions in the topic //@notification_settings Notification settings for the topic -updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 notification_settings:chatNotificationSettings = Update; +updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings = Update; //@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; @@ -9282,6 +9345,11 @@ getMessageReadDate chat_id:int53 message_id:int53 = MessageReadDate; //@message_id Identifier of the message getMessageViewers chat_id:int53 message_id:int53 = MessageViewers; +//@description Returns information about actual author of a message sent on behalf of a channel. The method can be called if messageProperties.can_get_author == true +//@chat_id Chat identifier +//@message_id Identifier of the message +getMessageAuthor chat_id:int53 message_id:int53 = User; + //@description Returns information about a file. This is an offline method @file_id Identifier of the file to get getFile file_id:int32 = File; @@ -9382,13 +9450,74 @@ checkCreatedPublicChatsLimit type:PublicChatType = Ok; //-To set a returned supergroup as a discussion group, access to its old messages must be enabled using toggleSupergroupIsAllHistoryAvailable first getSuitableDiscussionChats = Chats; -//@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium +//@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives the error "CHANNELS_TOO_MUCH". Also, the limit can be increased with Telegram Premium getInactiveSupergroupChats = Chats; //@description Returns a list of channel chats, which can be used as a personal chat getSuitablePersonalChats = Chats; +//@description Loads more topics in a channel direct messages chat administered by the current user. The loaded topics will be sent through updateDirectMessagesChatTopic. +//-Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +//@chat_id Chat identifier of the channel direct messages chat +//@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached +loadDirectMessagesChatTopics chat_id:int53 limit:int32 = Ok; + +//@description Returns information about the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic to get +getDirectMessagesChatTopic chat_id:int53 topic_id:int53 = DirectMessagesChatTopic; + +//@description Returns messages in the topic in a channel direct messages chat administered by the current user. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be fetched +//@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message +//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +getDirectMessagesChatTopicHistory chat_id:int53 topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; + +//@description Returns the last message sent in the topic in a channel direct messages chat administered by the current user no later than the specified date +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be fetched +//@date Point in time (Unix timestamp) relative to which to search for messages +getDirectMessagesChatTopicMessageByDate chat_id:int53 topic_id:int53 date:int32 = Message; + +//@description Deletes all messages in the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be deleted +deleteDirectMessagesChatTopicHistory chat_id:int53 topic_id:int53 = Ok; + +//@description Deletes all messages between the specified dates in the topic in a channel direct messages chat administered by the current user. Messages sent in the last 30 seconds will not be deleted +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be deleted +//@min_date The minimum date of the messages to delete +//@max_date The maximum date of the messages to delete +deleteDirectMessagesChatTopicMessagesByDate chat_id:int53 topic_id:int53 min_date:int32 max_date:int32 = Ok; + +//@description Changes the marked as unread state of the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Topic identifier +//@is_marked_as_unread New value of is_marked_as_unread +setDirectMessagesChatTopicIsMarkedAsUnread chat_id:int53 topic_id:int53 is_marked_as_unread:Bool = Ok; + +//@description Changes the draft message in the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier +//@topic_id Topic identifier +//@draft_message New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored +setDirectMessagesChatTopicDraftMessage chat_id:int53 topic_id:int53 draft_message:draftMessage = Ok; + +//@description Removes all pinned messages from the topic in a channel direct messages chat administered by the current user +//@chat_id Identifier of the chat +//@topic_id Topic identifier +unpinAllDirectMessagesChatTopicMessages chat_id:int53 topic_id:int53 = Ok; + +//@description Removes all unread reactions in the topic in a channel direct messages chat administered by the current user +//@chat_id Identifier of the chat +//@topic_id Topic identifier +readAllDirectMessagesChatTopicReactions chat_id:int53 topic_id:int53 = Ok; + + //@description Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded //@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached loadSavedMessagesTopics limit:int32 = Ok; @@ -9464,8 +9593,9 @@ deleteChat chat_id:int53 = Ok; //@description Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query //-(searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. -//-A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation +//-A combination of query, sender_id, filter and topic_id search criteria is expected to be supported, only if it is required for Telegram official application implementation //@chat_id Identifier of the chat in which to search messages +//@topic_id Pass topic identifier to search messages only in specific topic; pass null to search for messages in all topics //@query Query to search for //@sender_id Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message @@ -9473,9 +9603,7 @@ deleteChat chat_id:int53 = Ok; //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages -//@message_thread_id If not 0, only messages in the specified thread will be returned; supergroups only -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages -searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = FoundChatMessages; +searchChatMessages chat_id:int53 topic_id:MessageTopic query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter = FoundChatMessages; //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit @@ -9577,25 +9705,24 @@ getChatSparseMessagePositions chat_id:int53 filter:SearchMessagesFilter from_mes //@description Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" //@chat_id Identifier of the chat in which to return information about messages +//@topic_id Pass topic identifier to get the result only in specific topic; pass null to get the result in all topics; forum topics aren't supported //@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about messages; use 0 to get results from the last message -//@saved_messages_topic_id If not0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages -getChatMessageCalendar chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 saved_messages_topic_id:int53 = MessageCalendar; +getChatMessageCalendar chat_id:int53 topic_id:MessageTopic filter:SearchMessagesFilter from_message_id:int53 = MessageCalendar; -//@description Returns approximate number of messages of the specified type in the chat +//@description Returns approximate number of messages of the specified type in the chat or its topic //@chat_id Identifier of the chat in which to count messages +//@topic_id Pass topic identifier to get number of messages only in specific topic; pass null to get number of messages in all topics //@filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages //@return_local Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally -getChatMessageCount chat_id:int53 filter:SearchMessagesFilter saved_messages_topic_id:int53 return_local:Bool = Count; +getChatMessageCount chat_id:int53 topic_id:MessageTopic filter:SearchMessagesFilter return_local:Bool = Count; -//@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats +//@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat and topic. Cannot be used in secret chats //@chat_id Identifier of the chat in which to find message position -//@message_id Message identifier +//@topic_id Pass topic identifier to get position among messages only in specific topic; pass null to get position among all chat messages //@filter Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function -//@message_thread_id If not 0, only messages in the specified thread will be considered; supergroups only -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages -getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = Count; +//@message_id Message identifier +getChatMessagePosition chat_id:int53 topic_id:MessageTopic filter:SearchMessagesFilter message_id:int53 = Count; //@description Returns all scheduled messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; @@ -9732,7 +9859,7 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:Inpu //@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if messageProperties.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options //@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. -//-Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable +//-Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; @@ -9754,7 +9881,7 @@ resendMessages chat_id:int53 message_ids:vector quote:inputTextQuote paid sendChatScreenshotTakenNotification chat_id:int53 = Ok; //@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message -//@chat_id Target chat +//@chat_id Target chat; channel direct messages chats aren't supported //@sender_id Identifier of the sender of the message //@reply_to Information about the message or story to be replied; pass null if none //@disable_notification Pass true to disable notification for the message @@ -10405,10 +10532,11 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats //@bot_user_id Identifier of the bot, providing the Web App. If the bot is restricted for the current user, then show an error instead of calling the method //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise -//@message_thread_id If not 0, the message thread identifier in which the message will be sent +//@message_thread_id If not 0, the message thread identifier to which the message will be sent +//@direct_messages_chat_topic_id If not 0, unique identifier of the topic of channel direct messages chat to which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none //@parameters Parameters to use to open the Web App -openWebApp chat_id:int53 bot_user_id:int53 url:string message_thread_id:int53 reply_to:InputMessageReplyTo parameters:webAppOpenParameters = WebAppInfo; +openWebApp chat_id:int53 bot_user_id:int53 url:string message_thread_id:int53 direct_messages_chat_topic_id:int53 reply_to:InputMessageReplyTo parameters:webAppOpenParameters = WebAppInfo; //@description Informs TDLib that a previously opened Web App was closed @web_app_launch_id Identifier of Web App launch, received from openWebApp closeWebApp web_app_launch_id:int64 = Ok; @@ -10754,6 +10882,13 @@ setChatDescription chat_id:int53 description:string = Ok; //-Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that setChatDiscussionGroup chat_id:int53 discussion_chat_id:int53 = Ok; +//@description Changes direct messages group settings for a channel chat; requires owner privileges in the chat +//@chat_id Identifier of the channel chat +//@is_enabled Pass true if the direct messages group is enabled for the channel chat; pass false otherwise +//@paid_message_star_count The new number of Telegram Stars that must be paid for each message that is sent to the direct messages chat unless the sender is an administrator of the channel chat; 0-getOption("paid_message_star_count_max"). +//-The channel will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. Requires supergroupFullInfo.can_enable_paid_messages for positive amounts +setChatDirectMessagesGroup chat_id:int53 is_enabled:Bool paid_message_star_count:int53 = Ok; + //@description Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use @chat_id Chat identifier @location New location for the chat; must be valid and not null setChatLocation chat_id:int53 location:chatLocation = Ok; @@ -11202,7 +11337,7 @@ searchFileDownloads query:string only_active:Bool only_completed:Bool offset:str //@description Application or reCAPTCHA verification has been completed. Can be called before authorization //@verification_id Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired //@token Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; -//-pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request +//-pass an empty string to abort verification and receive the error "VERIFICATION_FAILED" for the request setApplicationVerificationToken verification_id:int53 token:string = Ok; @@ -11462,11 +11597,11 @@ toggleGroupCallIsMyVideoPaused group_call_id:int32 is_my_video_paused:Bool = Ok; //@description Toggles whether current user's video is enabled @group_call_id Group call identifier @is_my_video_enabled Pass true if the current user's video is enabled toggleGroupCallIsMyVideoEnabled group_call_id:int32 is_my_video_enabled:Bool = Ok; -//@description Informs TDLib that speaking state of a participant of an active group call has changed +//@description Informs TDLib that speaking state of a participant of an active group call has changed. Returns identifier of the participant if it is found //@group_call_id Group call identifier //@audio_source Group call participant's synchronization audio source identifier, or 0 for the current user //@is_speaking Pass true if the user is speaking -setGroupCallParticipantIsSpeaking group_call_id:int32 audio_source:int32 is_speaking:Bool = Ok; +setGroupCallParticipantIsSpeaking group_call_id:int32 audio_source:int32 is_speaking:Bool = MessageSender; //@description Toggles whether a participant of an active group call is muted, unmuted, or allowed to unmute themselves //@group_call_id Group call identifier @@ -12164,8 +12299,11 @@ toggleSupergroupHasHiddenMembers supergroup_id:int53 has_hidden_members:Bool = O //@has_aggressive_anti_spam_enabled The new value of has_aggressive_anti_spam_enabled toggleSupergroupHasAggressiveAntiSpamEnabled supergroup_id:int53 has_aggressive_anti_spam_enabled:Bool = Ok; -//@description Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums @supergroup_id Identifier of the supergroup @is_forum New value of is_forum -toggleSupergroupIsForum supergroup_id:int53 is_forum:Bool = Ok; +//@description Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums +//@supergroup_id Identifier of the supergroup +//@is_forum New value of is_forum +//@has_forum_tabs New value of has_forum_tabs; ignored if is_forum is false +toggleSupergroupIsForum supergroup_id:int53 is_forum:Bool has_forum_tabs:Bool = Ok; //@description Upgrades supergroup to a broadcast group; requires owner privileges in the supergroup @supergroup_id Identifier of the supergroup toggleSupergroupIsBroadcastGroup supergroup_id:int53 = Ok; From 51f3ce0659570178da6a644de60f54b4e99fdde4 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Wed, 2 Jul 2025 23:52:52 +0800 Subject: [PATCH 21/29] Update to TDLib 1.8.51 --- client/function.go | 340 +++++++++++++++++++++++++++- client/type.go | 501 ++++++++++++++++++++++++++++++++++++++++-- client/unmarshaler.go | 197 ++++++++++++++++- data/td_api.tl | 187 ++++++++++++++-- 4 files changed, 1181 insertions(+), 44 deletions(-) diff --git a/client/function.go b/client/function.go index 072145a..c2e9384 100755 --- a/client/function.go +++ b/client/function.go @@ -1429,7 +1429,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 a 404 error if the message doesn't exist +// 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, the checklist message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, 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{ @@ -2768,6 +2768,70 @@ func (client *Client) ReadAllDirectMessagesChatTopicReactions(req *ReadAllDirect return UnmarshalOk(result.Data) } +type GetDirectMessagesChatTopicRevenueRequest struct { + // Chat identifier of the channel direct messages chat administered by the current user + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId int64 `json:"topic_id"` +} + +// Returns the total number of Telegram Stars received by the channel chat for direct messages from the given topic +func (client *Client) GetDirectMessagesChatTopicRevenue(req *GetDirectMessagesChatTopicRevenueRequest) (*StarCount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicRevenue", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarCount(result.Data) +} + +type ToggleDirectMessagesChatTopicCanSendUnpaidMessagesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId int64 `json:"topic_id"` + // Pass true to allow unpaid messages; pass false to disallow unpaid messages + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` + // Pass true to refund the user previously paid messages + RefundPayments bool `json:"refund_payments"` +} + +// Allows to send unpaid messages to the given topic of the channel direct messages chat administered by the current user +func (client *Client) ToggleDirectMessagesChatTopicCanSendUnpaidMessages(req *ToggleDirectMessagesChatTopicCanSendUnpaidMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleDirectMessagesChatTopicCanSendUnpaidMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "can_send_unpaid_messages": req.CanSendUnpaidMessages, + "refund_payments": req.RefundPayments, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type LoadSavedMessagesTopicsRequest struct { // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached Limit int32 `json:"limit"` @@ -4075,6 +4139,134 @@ func (client *Client) ReportSponsoredChat(req *ReportSponsoredChatRequest) (Repo } } +type GetVideoMessageAdvertisementsRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns advertisements to be shown while a video from a message is watched. Available only if messageProperties.can_get_video_advertisements +func (client *Client) GetVideoMessageAdvertisements(req *GetVideoMessageAdvertisementsRequest) (*VideoMessageAdvertisements, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getVideoMessageAdvertisements", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalVideoMessageAdvertisements(result.Data) +} + +type ViewVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` +} + +// Informs TDLib that the user viewed a video message advertisement +func (client *Client) ViewVideoMessageAdvertisement(req *ViewVideoMessageAdvertisementRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "viewVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ClickVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` +} + +// Informs TDLib that the user clicked a video message advertisement +func (client *Client) ClickVideoMessageAdvertisement(req *ClickVideoMessageAdvertisementRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clickVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` +} + +// Reports a video message advertisement to Telegram moderators +func (client *Client) ReportVideoMessageAdvertisement(req *ReportVideoMessageAdvertisementRequest) (ReportSponsoredResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + "option_id": req.OptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(result.Data) + + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(result.Data) + + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(result.Data) + + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(result.Data) + + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type RemoveNotificationRequest struct { // Identifier of notification group to which the notification belongs NotificationGroupId int32 `json:"notification_group_id"` @@ -4911,6 +5103,41 @@ func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationReques return UnmarshalMessage(result.Data) } +type EditMessageChecklistRequest struct { + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The new checklist. If some tasks were completed, this information will be kept + Checklist *InputChecklist `json:"checklist"` +} + +// Edits the message content of a checklist. Returns the edited message after the edit is completed on the server side +func (client *Client) EditMessageChecklist(req *EditMessageChecklistRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageChecklist", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "checklist": req.Checklist, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + type EditMessageMediaRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` @@ -5425,6 +5652,44 @@ func (client *Client) EditBusinessMessageLiveLocation(req *EditBusinessMessageLi return UnmarshalBusinessMessage(result.Data) } +type EditBusinessMessageChecklistRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The new checklist. If some tasks were completed, this information will be kept + Checklist *InputChecklist `json:"checklist"` +} + +// Edits the content of a checklist in a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageChecklist(req *EditBusinessMessageChecklistRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageChecklist", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "checklist": req.Checklist, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + type EditBusinessMessageMediaRequest struct { // Unique identifier of business connection on behalf of which the message was sent BusinessConnectionId string `json:"business_connection_id"` @@ -6137,7 +6402,7 @@ type AddQuickReplyShortcutMessageRequest struct { ShortcutName string `json:"shortcut_name"` // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` - // The content of the message to be added; inputMessagePoll, inputMessageForwarded and inputMessageLocation with live_period aren't supported + // The content of the message to be added; inputMessagePaidMedia, inputMessageForwarded and inputMessageLocation with live_period aren't supported InputMessageContent InputMessageContent `json:"input_message_content"` } @@ -6268,11 +6533,11 @@ type EditQuickReplyMessageRequest struct { ShortcutId int32 `json:"shortcut_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo + // New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageChecklist, inputMessageDocument, inputMessagePhoto, inputMessageText, or inputMessageVideo InputMessageContent InputMessageContent `json:"input_message_content"` } -// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Media message can be edited only to a media message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Media message can be edited only to a media message. Checklist messages can be edited only to a checklist message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa func (client *Client) EditQuickReplyMessage(req *EditQuickReplyMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7719,6 +7984,73 @@ func (client *Client) StopPoll(req *StopPollRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type AddChecklistTasksRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the checklist. Use messageProperties.can_add_tasks to check whether the tasks can be added + MessageId int64 `json:"message_id"` + // List of added tasks + Tasks []*InputChecklistTask `json:"tasks"` +} + +// Adds tasks to a checklist in a message +func (client *Client) AddChecklistTasks(req *AddChecklistTasksRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addChecklistTasks", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "tasks": req.Tasks, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type MarkChecklistTasksAsDoneRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the checklist. Use messageProperties.can_mark_tasks_as_done to check whether the tasks can be marked as done or not done + MessageId int64 `json:"message_id"` + // Identifiers of tasks that were marked as done + MarkedAsDoneTaskIds []int32 `json:"marked_as_done_task_ids"` + // Identifiers of tasks that were marked as not done + MarkedAsNotDoneTaskIds []int32 `json:"marked_as_not_done_task_ids"` +} + +// Adds tasks of a checklist in a message as done or not done +func (client *Client) MarkChecklistTasksAsDone(req *MarkChecklistTasksAsDoneRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "markChecklistTasksAsDone", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "marked_as_done_task_ids": req.MarkedAsDoneTaskIds, + "marked_as_not_done_task_ids": req.MarkedAsNotDoneTaskIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type HideSuggestedActionRequest struct { // Suggested action to hide Action SuggestedAction `json:"action"` diff --git a/client/type.go b/client/type.go index 2fd662d..9f487c5 100755 --- a/client/type.go +++ b/client/type.go @@ -200,6 +200,10 @@ const ( ClassClosedVectorPath = "ClosedVectorPath" ClassOutline = "Outline" ClassPollOption = "PollOption" + ClassChecklistTask = "ChecklistTask" + ClassInputChecklistTask = "InputChecklistTask" + ClassChecklist = "Checklist" + ClassInputChecklist = "InputChecklist" ClassAnimation = "Animation" ClassAudio = "Audio" ClassDocument = "Document" @@ -216,6 +220,7 @@ const ( ClassWebApp = "WebApp" ClassPoll = "Poll" ClassAlternativeVideo = "AlternativeVideo" + ClassVideoStoryboard = "VideoStoryboard" ClassBackground = "Background" ClassBackgrounds = "Backgrounds" ClassChatBackground = "ChatBackground" @@ -357,11 +362,13 @@ const ( ClassMessageCalendar = "MessageCalendar" ClassBusinessMessage = "BusinessMessage" ClassBusinessMessages = "BusinessMessages" - ClassMessageSponsor = "MessageSponsor" + ClassAdvertisementSponsor = "AdvertisementSponsor" ClassSponsoredMessage = "SponsoredMessage" ClassSponsoredMessages = "SponsoredMessages" ClassSponsoredChat = "SponsoredChat" ClassSponsoredChats = "SponsoredChats" + ClassVideoMessageAdvertisement = "VideoMessageAdvertisement" + ClassVideoMessageAdvertisements = "VideoMessageAdvertisements" ClassReportOption = "ReportOption" ClassFileDownload = "FileDownload" ClassDownloadedFileCounts = "DownloadedFileCounts" @@ -704,6 +711,10 @@ const ( TypePollOption = "pollOption" TypePollTypeRegular = "pollTypeRegular" TypePollTypeQuiz = "pollTypeQuiz" + TypeChecklistTask = "checklistTask" + TypeInputChecklistTask = "inputChecklistTask" + TypeChecklist = "checklist" + TypeInputChecklist = "inputChecklist" TypeAnimation = "animation" TypeAudio = "audio" TypeDocument = "document" @@ -720,6 +731,7 @@ const ( TypeWebApp = "webApp" TypePoll = "poll" TypeAlternativeVideo = "alternativeVideo" + TypeVideoStoryboard = "videoStoryboard" TypeBackground = "background" TypeBackgrounds = "backgrounds" TypeChatBackground = "chatBackground" @@ -1004,11 +1016,13 @@ const ( TypeMessageSourceNotification = "messageSourceNotification" TypeMessageSourceScreenshot = "messageSourceScreenshot" TypeMessageSourceOther = "messageSourceOther" - TypeMessageSponsor = "messageSponsor" + TypeAdvertisementSponsor = "advertisementSponsor" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" TypeSponsoredChat = "sponsoredChat" TypeSponsoredChats = "sponsoredChats" + TypeVideoMessageAdvertisement = "videoMessageAdvertisement" + TypeVideoMessageAdvertisements = "videoMessageAdvertisements" TypeReportOption = "reportOption" TypeReportSponsoredResultOk = "reportSponsoredResultOk" TypeReportSponsoredResultFailed = "reportSponsoredResultFailed" @@ -1344,6 +1358,7 @@ const ( TypeMessageGame = "messageGame" TypeMessagePoll = "messagePoll" TypeMessageStory = "messageStory" + TypeMessageChecklist = "messageChecklist" TypeMessageInvoice = "messageInvoice" TypeMessageCall = "messageCall" TypeMessageGroupCall = "messageGroupCall" @@ -1392,6 +1407,8 @@ const ( TypeMessagePaidMessagesRefunded = "messagePaidMessagesRefunded" TypeMessagePaidMessagePriceChanged = "messagePaidMessagePriceChanged" TypeMessageDirectMessagePriceChanged = "messageDirectMessagePriceChanged" + TypeMessageChecklistTasksDone = "messageChecklistTasksDone" + TypeMessageChecklistTasksAdded = "messageChecklistTasksAdded" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1453,6 +1470,7 @@ const ( TypeInputMessageInvoice = "inputMessageInvoice" TypeInputMessagePoll = "inputMessagePoll" TypeInputMessageStory = "inputMessageStory" + TypeInputMessageChecklist = "inputMessageChecklist" TypeInputMessageForwarded = "inputMessageForwarded" TypeMessageProperties = "messageProperties" TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty" @@ -1800,6 +1818,7 @@ const ( TypePremiumFeatureLastSeenTimes = "premiumFeatureLastSeenTimes" TypePremiumFeatureBusiness = "premiumFeatureBusiness" TypePremiumFeatureMessageEffects = "premiumFeatureMessageEffects" + TypePremiumFeatureChecklists = "premiumFeatureChecklists" TypeBusinessFeatureLocation = "businessFeatureLocation" TypeBusinessFeatureOpeningHours = "businessFeatureOpeningHours" TypeBusinessFeatureQuickReplies = "businessFeatureQuickReplies" @@ -1919,6 +1938,7 @@ const ( TypePushMessageContentSticker = "pushMessageContentSticker" TypePushMessageContentStory = "pushMessageContentStory" TypePushMessageContentText = "pushMessageContentText" + TypePushMessageContentChecklist = "pushMessageContentChecklist" TypePushMessageContentVideo = "pushMessageContentVideo" TypePushMessageContentVideoNote = "pushMessageContentVideoNote" TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote" @@ -1937,6 +1957,8 @@ const ( TypePushMessageContentRecurringPayment = "pushMessageContentRecurringPayment" TypePushMessageContentSuggestProfilePhoto = "pushMessageContentSuggestProfilePhoto" TypePushMessageContentProximityAlertTriggered = "pushMessageContentProximityAlertTriggered" + TypePushMessageContentChecklistTasksAdded = "pushMessageContentChecklistTasksAdded" + TypePushMessageContentChecklistTasksDone = "pushMessageContentChecklistTasksDone" TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards" TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum" TypeNotificationTypeNewMessage = "notificationTypeNewMessage" @@ -5493,6 +5515,122 @@ func (*PollTypeQuiz) PollTypeType() string { return TypePollTypeQuiz } +// Describes a task in a checklist +type ChecklistTask struct { + meta + // Unique identifier of the task + Id int32 `json:"id"` + // Text of the task; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Url, EmailAddress, Mention, Hashtag, Cashtag and PhoneNumber entities + Text *FormattedText `json:"text"` + // Identifier of the user that completed the task; 0 if the task isn't completed + CompletedByUserId int64 `json:"completed_by_user_id"` + // Point in time (Unix timestamp) when the task was completed; 0 if the task isn't completed + CompletionDate int32 `json:"completion_date"` +} + +func (entity *ChecklistTask) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChecklistTask + + return json.Marshal((*stub)(entity)) +} + +func (*ChecklistTask) GetClass() string { + return ClassChecklistTask +} + +func (*ChecklistTask) GetType() string { + return TypeChecklistTask +} + +// Describes a task in a checklist to be sent +type InputChecklistTask struct { + meta + // Unique identifier of the task; must be positive + Id int32 `json:"id"` + // Text of the task; 1-getOption("checklist_task_text_length_max") characters without line feeds. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Text *FormattedText `json:"text"` +} + +func (entity *InputChecklistTask) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChecklistTask + + return json.Marshal((*stub)(entity)) +} + +func (*InputChecklistTask) GetClass() string { + return ClassInputChecklistTask +} + +func (*InputChecklistTask) GetType() string { + return TypeInputChecklistTask +} + +// Describes a checklist +type Checklist struct { + meta + // Title of the checklist; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Title *FormattedText `json:"title"` + // List of tasks in the checklist + Tasks []*ChecklistTask `json:"tasks"` + // True, if users other than creator of the list can add tasks to the list + OthersCanAddTasks bool `json:"others_can_add_tasks"` + // True, if the current user can add tasks to the list if they have Telegram Premium subscription + CanAddTasks bool `json:"can_add_tasks"` + // True, if users other than creator of the list can mark tasks as done or not done. If true, then the checklist is called "group checklist" + OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done"` + // True, if the current user can mark tasks as done or not done if they have Telegram Premium subscription + CanMarkTasksAsDone bool `json:"can_mark_tasks_as_done"` +} + +func (entity *Checklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Checklist + + return json.Marshal((*stub)(entity)) +} + +func (*Checklist) GetClass() string { + return ClassChecklist +} + +func (*Checklist) GetType() string { + return TypeChecklist +} + +// Describes a checklist to be sent +type InputChecklist struct { + meta + // Title of the checklist; 1-getOption("checklist_title_length_max") characters. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Title *FormattedText `json:"title"` + // List of tasks in the checklist; 1-getOption("checklist_task_count_max") tasks + Tasks []*InputChecklistTask `json:"tasks"` + // True, if other users can add tasks to the list + OthersCanAddTasks bool `json:"others_can_add_tasks"` + // True, if other users can mark tasks as done or not done + OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done"` +} + +func (entity *InputChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*InputChecklist) GetClass() string { + return ClassInputChecklist +} + +func (*InputChecklist) GetType() string { + return TypeInputChecklist +} + // Describes an animation file. The animation must be encoded in GIF or MPEG4 format type Animation struct { meta @@ -6163,6 +6301,35 @@ func (*AlternativeVideo) GetType() string { return TypeAlternativeVideo } +// Describes a storyboard for a video +type VideoStoryboard struct { + meta + // A JPEG file that contains tiled previews of video + StoryboardFile *File `json:"storyboard_file"` + // Width of a tile + Width int32 `json:"width"` + // Height of a tile + Height int32 `json:"height"` + // File that describes mapping of position in the video to a tile in the JPEG file + MapFile *File `json:"map_file"` +} + +func (entity *VideoStoryboard) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoStoryboard + + return json.Marshal((*stub)(entity)) +} + +func (*VideoStoryboard) GetClass() string { + return ClassVideoStoryboard +} + +func (*VideoStoryboard) GetType() string { + return TypeVideoStoryboard +} + // Describes a chat background type Background struct { meta @@ -7600,7 +7767,7 @@ type ChatPermissions struct { CanSendVideoNotes bool `json:"can_send_video_notes"` // True, if the user can send voice notes CanSendVoiceNotes bool `json:"can_send_voice_notes"` - // True, if the user can send polls + // True, if the user can send polls and checklists CanSendPolls bool `json:"can_send_polls"` // True, if the user can send stickers. Implies can_send_messages permissions CanSendStickers bool `json:"can_send_stickers"` @@ -13352,6 +13519,8 @@ type SupergroupFullInfo struct { MyBoostCount int32 `json:"my_boost_count"` // Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` + // Number of Telegram Stars that must be paid by the current user for each sent message to the supergroup + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` // Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none StickerSetId JsonInt64 `json:"sticker_set_id"` // Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none @@ -14872,7 +15041,7 @@ type MessageReplyToMessage struct { Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat OriginSendDate int32 `json:"origin_send_date"` - // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote + // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote Content MessageContent `json:"content"` } @@ -15766,31 +15935,31 @@ func (*MessageSourceOther) MessageSourceType() string { return TypeMessageSourceOther } -// Information about the sponsor of a message -type MessageSponsor struct { +// Information about the sponsor of an advertisement +type AdvertisementSponsor struct { meta - // URL of the sponsor to be opened when the message is clicked + // URL of the sponsor to be opened when the advertisement is clicked Url string `json:"url"` // Photo of the sponsor; may be null if must not be shown Photo *Photo `json:"photo"` - // Additional optional information about the sponsor to be shown along with the message + // Additional optional information about the sponsor to be shown along with the advertisement Info string `json:"info"` } -func (entity *MessageSponsor) MarshalJSON() ([]byte, error) { +func (entity *AdvertisementSponsor) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageSponsor + type stub AdvertisementSponsor return json.Marshal((*stub)(entity)) } -func (*MessageSponsor) GetClass() string { - return ClassMessageSponsor +func (*AdvertisementSponsor) GetClass() string { + return ClassAdvertisementSponsor } -func (*MessageSponsor) GetType() string { - return TypeMessageSponsor +func (*AdvertisementSponsor) GetType() string { + return TypeAdvertisementSponsor } // Describes a sponsored message @@ -15805,7 +15974,7 @@ type SponsoredMessage struct { // 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"` + Sponsor *AdvertisementSponsor `json:"sponsor"` // Title of the sponsored message Title string `json:"title"` // Text for the message action button @@ -15840,7 +16009,7 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { IsRecommended bool `json:"is_recommended"` CanBeReported bool `json:"can_be_reported"` Content json.RawMessage `json:"content"` - Sponsor *MessageSponsor `json:"sponsor"` + Sponsor *AdvertisementSponsor `json:"sponsor"` Title string `json:"title"` ButtonText string `json:"button_text"` AccentColorId int32 `json:"accent_color_id"` @@ -15946,6 +16115,70 @@ func (*SponsoredChats) GetType() string { return TypeSponsoredChats } +// Describes an advertisent to be shown while a video from a message is watched +type VideoMessageAdvertisement struct { + meta + // Unique identifier of this result + UniqueId int64 `json:"unique_id"` + // Text of the advertisement + Text string `json:"text"` + // The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds + MinDisplayDuration int32 `json:"min_display_duration"` + // The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds + MaxDisplayDuration int32 `json:"max_display_duration"` + // True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement + CanBeReported bool `json:"can_be_reported"` + // Information about the sponsor of the advertisement + Sponsor *AdvertisementSponsor `json:"sponsor"` + // Title of the sponsored message + Title string `json:"title"` + // If non-empty, additional information about the sponsored message to be shown along with the message + AdditionalInfo string `json:"additional_info"` +} + +func (entity *VideoMessageAdvertisement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoMessageAdvertisement + + return json.Marshal((*stub)(entity)) +} + +func (*VideoMessageAdvertisement) GetClass() string { + return ClassVideoMessageAdvertisement +} + +func (*VideoMessageAdvertisement) GetType() string { + return TypeVideoMessageAdvertisement +} + +// Contains a list of advertisements to be shown while a video from a message is watched +type VideoMessageAdvertisements struct { + meta + // List of advertisements + Advertisements []*VideoMessageAdvertisement `json:"advertisements"` + // Delay before the first advertisement is shown, in seconds + StartDelay int32 `json:"start_delay"` + // Delay between consecutive advertisements, in seconds + BetweenDelay int32 `json:"between_delay"` +} + +func (entity *VideoMessageAdvertisements) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoMessageAdvertisements + + return json.Marshal((*stub)(entity)) +} + +func (*VideoMessageAdvertisements) GetClass() string { + return ClassVideoMessageAdvertisements +} + +func (*VideoMessageAdvertisements) GetType() string { + return TypeVideoMessageAdvertisements +} + // Describes an option to report an entity to Telegram type ReportOption struct { meta @@ -19168,6 +19401,8 @@ type DirectMessagesChatTopic struct { SenderId MessageSender `json:"sender_id"` // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order Order JsonInt64 `json:"order"` + // True, if the other party can send unpaid messages even if the chat has paid messages enabled + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` // True, if the forum topic is marked as unread IsMarkedAsUnread bool `json:"is_marked_as_unread"` // Number of unread messages in the chat @@ -19206,6 +19441,7 @@ func (directMessagesChatTopic *DirectMessagesChatTopic) UnmarshalJSON(data []byt Id int64 `json:"id"` SenderId json.RawMessage `json:"sender_id"` Order JsonInt64 `json:"order"` + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` IsMarkedAsUnread bool `json:"is_marked_as_unread"` UnreadCount int64 `json:"unread_count"` LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` @@ -19223,6 +19459,7 @@ func (directMessagesChatTopic *DirectMessagesChatTopic) UnmarshalJSON(data []byt directMessagesChatTopic.ChatId = tmp.ChatId directMessagesChatTopic.Id = tmp.Id directMessagesChatTopic.Order = tmp.Order + directMessagesChatTopic.CanSendUnpaidMessages = tmp.CanSendUnpaidMessages directMessagesChatTopic.IsMarkedAsUnread = tmp.IsMarkedAsUnread directMessagesChatTopic.UnreadCount = tmp.UnreadCount directMessagesChatTopic.LastReadInboxMessageId = tmp.LastReadInboxMessageId @@ -26677,6 +26914,8 @@ type MessageVideo struct { Video *Video `json:"video"` // Alternative qualities of the video AlternativeVideos []*AlternativeVideo `json:"alternative_videos"` + // Available storyboards for the video + Storyboards []*VideoStoryboard `json:"storyboards"` // Cover of the video; may be null if none Cover *Photo `json:"cover"` // Timestamp from which the video playing must start, in seconds @@ -27138,6 +27377,33 @@ func (*MessageStory) MessageContentType() string { return TypeMessageStory } +// A message with a checklist +type MessageChecklist struct { + meta + // The checklist description + List *Checklist `json:"list"` +} + +func (entity *MessageChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklist) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklist) GetType() string { + return TypeMessageChecklist +} + +func (*MessageChecklist) MessageContentType() string { + return TypeMessageChecklist +} + // A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice type MessageInvoice struct { meta @@ -28990,6 +29256,66 @@ func (*MessageDirectMessagePriceChanged) MessageContentType() string { return TypeMessageDirectMessagePriceChanged } +// Some tasks from a checklist were marked as done or not done +type MessageChecklistTasksDone struct { + meta + // Identifier of the message with the checklist; can be 0 if the message was deleted + ChecklistMessageId int64 `json:"checklist_message_id"` + // Identifiers of tasks that were marked as done + MarkedAsDoneTaskIds []int32 `json:"marked_as_done_task_ids"` + // Identifiers of tasks that were marked as not done + MarkedAsNotDoneTaskIds []int32 `json:"marked_as_not_done_task_ids"` +} + +func (entity *MessageChecklistTasksDone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklistTasksDone + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklistTasksDone) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklistTasksDone) GetType() string { + return TypeMessageChecklistTasksDone +} + +func (*MessageChecklistTasksDone) MessageContentType() string { + return TypeMessageChecklistTasksDone +} + +// Some tasks were added to a checklist +type MessageChecklistTasksAdded struct { + meta + // Identifier of the message with the checklist; can be 0 if the message was deleted + ChecklistMessageId int64 `json:"checklist_message_id"` + // List of tasks added to the checklist + Tasks []*ChecklistTask `json:"tasks"` +} + +func (entity *MessageChecklistTasksAdded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklistTasksAdded + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklistTasksAdded) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklistTasksAdded) GetType() string { + return TypeMessageChecklistTasksAdded +} + +func (*MessageChecklistTasksAdded) MessageContentType() string { + return TypeMessageChecklistTasksAdded +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -31227,6 +31553,33 @@ func (*InputMessageStory) InputMessageContentType() string { return TypeInputMessageStory } +// A message with a checklist. Checklists can't be sent to secret chats, channel chats and channel direct messages chats; for Telegram Premium users only +type InputMessageChecklist struct { + meta + // The checklist to send + Checklist *InputChecklist `json:"checklist"` +} + +func (entity *InputMessageChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageChecklist) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageChecklist) GetType() string { + return TypeInputMessageChecklist +} + +func (*InputMessageChecklist) InputMessageContentType() string { + return TypeInputMessageChecklist +} + // A forwarded message type InputMessageForwarded struct { meta @@ -31267,6 +31620,8 @@ func (*InputMessageForwarded) InputMessageContentType() string { // Contains properties of a message and describes actions that can be done with the message right now type MessageProperties struct { meta + // True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription + CanAddTasks bool `json:"can_add_tasks"` // True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options CanBeCopied bool `json:"can_be_copied"` // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options @@ -31275,7 +31630,7 @@ type MessageProperties struct { CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` // True, if the message can be deleted for all users using the method deleteMessages with revoke == true CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message + // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location, poll, and checklist messages this fields shows whether editMessageLiveLocation, stopPoll, or editMessageChecklist respectively can be used with this message CanBeEdited bool `json:"can_be_edited"` // True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options CanBeForwarded bool `json:"can_be_forwarded"` @@ -31309,8 +31664,12 @@ type MessageProperties struct { CanGetReadDate bool `json:"can_get_read_date"` // True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards CanGetStatistics bool `json:"can_get_statistics"` + // True, if advertisements for video of the message can be received though getVideoMessageAdvertisements + CanGetVideoAdvertisements bool `json:"can_get_video_advertisements"` // True, if chat members already viewed the message can be received through getMessageViewers CanGetViewers bool `json:"can_get_viewers"` + // True, if tasks can be marked as done or not done in the message's checklist using markChecklistTasksAsDone if the current user has Telegram Premium subscription + CanMarkTasksAsDone bool `json:"can_mark_tasks_as_done"` // True, if speech can be recognized for the message through recognizeSpeech CanRecognizeSpeech bool `json:"can_recognize_speech"` // True, if the message can be reported using reportChat @@ -42570,6 +42929,31 @@ func (*PremiumFeatureMessageEffects) PremiumFeatureType() string { return TypePremiumFeatureMessageEffects } +// The ability to create and use checklist messages +type PremiumFeatureChecklists struct{ + meta +} + +func (entity *PremiumFeatureChecklists) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureChecklists + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureChecklists) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureChecklists) GetType() string { + return TypePremiumFeatureChecklists +} + +func (*PremiumFeatureChecklists) PremiumFeatureType() string { + return TypePremiumFeatureChecklists +} + // The ability to set location type BusinessFeatureLocation struct{ meta @@ -46085,6 +46469,35 @@ func (*PushMessageContentText) PushMessageContentType() string { return TypePushMessageContentText } +// A message with a checklist +type PushMessageContentChecklist struct { + meta + // Checklist title + Title string `json:"title"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklist) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklist) GetType() string { + return TypePushMessageContentChecklist +} + +func (*PushMessageContentChecklist) PushMessageContentType() string { + return TypePushMessageContentChecklist +} + // A video message type PushMessageContentVideo struct { meta @@ -46575,6 +46988,60 @@ func (*PushMessageContentProximityAlertTriggered) PushMessageContentType() strin return TypePushMessageContentProximityAlertTriggered } +// Some tasks were added to a checklist +type PushMessageContentChecklistTasksAdded struct { + meta + // Number of added tasks + TaskCount int32 `json:"task_count"` +} + +func (entity *PushMessageContentChecklistTasksAdded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklistTasksAdded + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklistTasksAdded) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklistTasksAdded) GetType() string { + return TypePushMessageContentChecklistTasksAdded +} + +func (*PushMessageContentChecklistTasksAdded) PushMessageContentType() string { + return TypePushMessageContentChecklistTasksAdded +} + +// Some tasks from a checklist were marked as done or not done +type PushMessageContentChecklistTasksDone struct { + meta + // Number of changed tasks + TaskCount int32 `json:"task_count"` +} + +func (entity *PushMessageContentChecklistTasksDone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklistTasksDone + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklistTasksDone) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklistTasksDone) GetType() string { + return TypePushMessageContentChecklistTasksDone +} + +func (*PushMessageContentChecklistTasksDone) PushMessageContentType() string { + return TypePushMessageContentChecklistTasksDone +} + // A forwarded messages type PushMessageContentMessageForwards struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 6adae01..5991657 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -3507,6 +3507,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageStory: return UnmarshalMessageStory(data) + case TypeMessageChecklist: + return UnmarshalMessageChecklist(data) + case TypeMessageInvoice: return UnmarshalMessageInvoice(data) @@ -3651,6 +3654,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageDirectMessagePriceChanged: return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageChecklistTasksDone: + return UnmarshalMessageChecklistTasksDone(data) + + case TypeMessageChecklistTasksAdded: + return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -3962,6 +3971,9 @@ func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, er case TypeInputMessageStory: return UnmarshalInputMessageStory(data) + case TypeInputMessageChecklist: + return UnmarshalInputMessageChecklist(data) + case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) @@ -5803,6 +5815,9 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureMessageEffects: return UnmarshalPremiumFeatureMessageEffects(data) + case TypePremiumFeatureChecklists: + return UnmarshalPremiumFeatureChecklists(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6603,6 +6618,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentText: return UnmarshalPushMessageContentText(data) + case TypePushMessageContentChecklist: + return UnmarshalPushMessageContentChecklist(data) + case TypePushMessageContentVideo: return UnmarshalPushMessageContentVideo(data) @@ -6657,6 +6675,12 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentProximityAlertTriggered: return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentChecklistTasksAdded: + return UnmarshalPushMessageContentChecklistTasksAdded(data) + + case TypePushMessageContentChecklistTasksDone: + return UnmarshalPushMessageContentChecklistTasksDone(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -9429,6 +9453,38 @@ func UnmarshalPollTypeQuiz(data json.RawMessage) (*PollTypeQuiz, error) { return &resp, err } +func UnmarshalChecklistTask(data json.RawMessage) (*ChecklistTask, error) { + var resp ChecklistTask + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChecklistTask(data json.RawMessage) (*InputChecklistTask, error) { + var resp InputChecklistTask + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChecklist(data json.RawMessage) (*Checklist, error) { + var resp Checklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChecklist(data json.RawMessage) (*InputChecklist, error) { + var resp InputChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAnimation(data json.RawMessage) (*Animation, error) { var resp Animation @@ -9557,6 +9613,14 @@ func UnmarshalAlternativeVideo(data json.RawMessage) (*AlternativeVideo, error) return &resp, err } +func UnmarshalVideoStoryboard(data json.RawMessage) (*VideoStoryboard, error) { + var resp VideoStoryboard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBackground(data json.RawMessage) (*Background, error) { var resp Background @@ -11829,8 +11893,8 @@ func UnmarshalMessageSourceOther(data json.RawMessage) (*MessageSourceOther, err return &resp, err } -func UnmarshalMessageSponsor(data json.RawMessage) (*MessageSponsor, error) { - var resp MessageSponsor +func UnmarshalAdvertisementSponsor(data json.RawMessage) (*AdvertisementSponsor, error) { + var resp AdvertisementSponsor err := json.Unmarshal(data, &resp) @@ -11869,6 +11933,22 @@ func UnmarshalSponsoredChats(data json.RawMessage) (*SponsoredChats, error) { return &resp, err } +func UnmarshalVideoMessageAdvertisement(data json.RawMessage) (*VideoMessageAdvertisement, error) { + var resp VideoMessageAdvertisement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVideoMessageAdvertisements(data json.RawMessage) (*VideoMessageAdvertisements, error) { + var resp VideoMessageAdvertisements + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) { var resp ReportOption @@ -14549,6 +14629,14 @@ func UnmarshalMessageStory(data json.RawMessage) (*MessageStory, error) { return &resp, err } +func UnmarshalMessageChecklist(data json.RawMessage) (*MessageChecklist, error) { + var resp MessageChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageInvoice(data json.RawMessage) (*MessageInvoice, error) { var resp MessageInvoice @@ -14933,6 +15021,22 @@ func UnmarshalMessageDirectMessagePriceChanged(data json.RawMessage) (*MessageDi return &resp, err } +func UnmarshalMessageChecklistTasksDone(data json.RawMessage) (*MessageChecklistTasksDone, error) { + var resp MessageChecklistTasksDone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChecklistTasksAdded(data json.RawMessage) (*MessageChecklistTasksAdded, error) { + var resp MessageChecklistTasksAdded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -15421,6 +15525,14 @@ func UnmarshalInputMessageStory(data json.RawMessage) (*InputMessageStory, error return &resp, err } +func UnmarshalInputMessageChecklist(data json.RawMessage) (*InputMessageChecklist, error) { + var resp InputMessageChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputMessageForwarded(data json.RawMessage) (*InputMessageForwarded, error) { var resp InputMessageForwarded @@ -18197,6 +18309,14 @@ func UnmarshalPremiumFeatureMessageEffects(data json.RawMessage) (*PremiumFeatur return &resp, err } +func UnmarshalPremiumFeatureChecklists(data json.RawMessage) (*PremiumFeatureChecklists, error) { + var resp PremiumFeatureChecklists + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBusinessFeatureLocation(data json.RawMessage) (*BusinessFeatureLocation, error) { var resp BusinessFeatureLocation @@ -19149,6 +19269,14 @@ func UnmarshalPushMessageContentText(data json.RawMessage) (*PushMessageContentT return &resp, err } +func UnmarshalPushMessageContentChecklist(data json.RawMessage) (*PushMessageContentChecklist, error) { + var resp PushMessageContentChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentVideo(data json.RawMessage) (*PushMessageContentVideo, error) { var resp PushMessageContentVideo @@ -19293,6 +19421,22 @@ func UnmarshalPushMessageContentProximityAlertTriggered(data json.RawMessage) (* return &resp, err } +func UnmarshalPushMessageContentChecklistTasksAdded(data json.RawMessage) (*PushMessageContentChecklistTasksAdded, error) { + var resp PushMessageContentChecklistTasksAdded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChecklistTasksDone(data json.RawMessage) (*PushMessageContentChecklistTasksDone, error) { + var resp PushMessageContentChecklistTasksDone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentMessageForwards(data json.RawMessage) (*PushMessageContentMessageForwards, error) { var resp PushMessageContentMessageForwards @@ -23253,6 +23397,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePollTypeQuiz: return UnmarshalPollTypeQuiz(data) + case TypeChecklistTask: + return UnmarshalChecklistTask(data) + + case TypeInputChecklistTask: + return UnmarshalInputChecklistTask(data) + + case TypeChecklist: + return UnmarshalChecklist(data) + + case TypeInputChecklist: + return UnmarshalInputChecklist(data) + case TypeAnimation: return UnmarshalAnimation(data) @@ -23301,6 +23457,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAlternativeVideo: return UnmarshalAlternativeVideo(data) + case TypeVideoStoryboard: + return UnmarshalVideoStoryboard(data) + case TypeBackground: return UnmarshalBackground(data) @@ -24153,8 +24312,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSourceOther: return UnmarshalMessageSourceOther(data) - case TypeMessageSponsor: - return UnmarshalMessageSponsor(data) + case TypeAdvertisementSponsor: + return UnmarshalAdvertisementSponsor(data) case TypeSponsoredMessage: return UnmarshalSponsoredMessage(data) @@ -24168,6 +24327,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSponsoredChats: return UnmarshalSponsoredChats(data) + case TypeVideoMessageAdvertisement: + return UnmarshalVideoMessageAdvertisement(data) + + case TypeVideoMessageAdvertisements: + return UnmarshalVideoMessageAdvertisements(data) + case TypeReportOption: return UnmarshalReportOption(data) @@ -25173,6 +25338,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageStory: return UnmarshalMessageStory(data) + case TypeMessageChecklist: + return UnmarshalMessageChecklist(data) + case TypeMessageInvoice: return UnmarshalMessageInvoice(data) @@ -25317,6 +25485,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageDirectMessagePriceChanged: return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageChecklistTasksDone: + return UnmarshalMessageChecklistTasksDone(data) + + case TypeMessageChecklistTasksAdded: + return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -25500,6 +25674,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessageStory: return UnmarshalInputMessageStory(data) + case TypeInputMessageChecklist: + return UnmarshalInputMessageChecklist(data) + case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) @@ -26541,6 +26718,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureMessageEffects: return UnmarshalPremiumFeatureMessageEffects(data) + case TypePremiumFeatureChecklists: + return UnmarshalPremiumFeatureChecklists(data) + case TypeBusinessFeatureLocation: return UnmarshalBusinessFeatureLocation(data) @@ -26898,6 +27078,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentText: return UnmarshalPushMessageContentText(data) + case TypePushMessageContentChecklist: + return UnmarshalPushMessageContentChecklist(data) + case TypePushMessageContentVideo: return UnmarshalPushMessageContentVideo(data) @@ -26952,6 +27135,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentProximityAlertTriggered: return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentChecklistTasksAdded: + return UnmarshalPushMessageContentChecklistTasksAdded(data) + + case TypePushMessageContentChecklistTasksDone: + return UnmarshalPushMessageContentChecklistTasksDone(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) diff --git a/data/td_api.tl b/data/td_api.tl index 5b4847b..29d016b 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -388,6 +388,35 @@ pollTypeRegular allow_multiple_answers:Bool = PollType; pollTypeQuiz correct_option_id:int32 explanation:formattedText = PollType; +//@description Describes a task in a checklist +//@id Unique identifier of the task +//@text Text of the task; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Url, EmailAddress, Mention, Hashtag, Cashtag and PhoneNumber entities +//@completed_by_user_id Identifier of the user that completed the task; 0 if the task isn't completed +//@completion_date Point in time (Unix timestamp) when the task was completed; 0 if the task isn't completed +checklistTask id:int32 text:formattedText completed_by_user_id:int53 completion_date:int32 = ChecklistTask; + +//@description Describes a task in a checklist to be sent +//@id Unique identifier of the task; must be positive +//@text Text of the task; 1-getOption("checklist_task_text_length_max") characters without line feeds. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +inputChecklistTask id:int32 text:formattedText = InputChecklistTask; + +//@description Describes a checklist +//@title Title of the checklist; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +//@tasks List of tasks in the checklist +//@others_can_add_tasks True, if users other than creator of the list can add tasks to the list +//@can_add_tasks True, if the current user can add tasks to the list if they have Telegram Premium subscription +//@others_can_mark_tasks_as_done True, if users other than creator of the list can mark tasks as done or not done. If true, then the checklist is called "group checklist" +//@can_mark_tasks_as_done True, if the current user can mark tasks as done or not done if they have Telegram Premium subscription +checklist title:formattedText tasks:vector others_can_add_tasks:Bool can_add_tasks:Bool others_can_mark_tasks_as_done:Bool can_mark_tasks_as_done:Bool = Checklist; + +//@description Describes a checklist to be sent +//@title Title of the checklist; 1-getOption("checklist_title_length_max") characters. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +//@tasks List of tasks in the checklist; 1-getOption("checklist_task_count_max") tasks +//@others_can_add_tasks True, if other users can add tasks to the list +//@others_can_mark_tasks_as_done True, if other users can mark tasks as done or not done +inputChecklist title:formattedText tasks:vector others_can_add_tasks:Bool others_can_mark_tasks_as_done:Bool = InputChecklist; + + //@description Describes an animation file. The animation must be encoded in GIF or MPEG4 format //@duration Duration of the animation, in seconds; as defined by the sender //@width Width of the animation @@ -541,6 +570,13 @@ poll id:int64 question:formattedText options:vector total_voter_coun //@video File containing the video alternativeVideo id:int64 width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; +//@description Describes a storyboard for a video +//@storyboard_file A JPEG file that contains tiled previews of video +//@width Width of a tile +//@height Height of a tile +//@map_file File that describes mapping of position in the video to a tile in the JPEG file +videoStoryboard storyboard_file:file width:int32 height:int32 map_file:file = VideoStoryboard; + //@description Describes a chat background //@id Unique background identifier @@ -825,7 +861,7 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; //@can_send_videos True, if the user can send videos //@can_send_video_notes True, if the user can send video notes //@can_send_voice_notes True, if the user can send voice notes -//@can_send_polls True, if the user can send polls +//@can_send_polls True, if the user can send polls and checklists //@can_send_stickers True, if the user can send stickers. Implies can_send_messages permissions //@can_send_animations True, if the user can send animations. Implies can_send_messages permissions //@can_send_games True, if the user can send games. Implies can_send_messages permissions @@ -1906,6 +1942,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@gift_count Number of saved to profile gifts for channels without can_post_messages administrator right, otherwise, the total number of received gifts //@my_boost_count Number of times the current user boosted the supergroup or channel //@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified +//@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the supergroup //@sticker_set_id Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none //@custom_emoji_sticker_set_id Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none //@location Location to which the supergroup is connected; may be null if none @@ -1914,7 +1951,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 direct_messages_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 direct_messages_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 outgoing_paid_message_star_count:int53 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -2164,9 +2201,9 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. -//-Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, -//-messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, -//-messageVideoNote, or messageVoiceNote +//-Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, +//-messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, +//-messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message @story_poster_chat_id The identifier of the poster of the story @story_id The identifier of the story @@ -2303,11 +2340,11 @@ messageSourceScreenshot = MessageSource; messageSourceOther = MessageSource; -//@description Information about the sponsor of a message -//@url URL of the sponsor to be opened when the message is clicked +//@description Information about the sponsor of an advertisement +//@url URL of the sponsor to be opened when the advertisement is clicked //@photo Photo of the sponsor; may be null if must not be shown -//@info Additional optional information about the sponsor to be shown along with the message -messageSponsor url:string photo:photo info:string = MessageSponsor; +//@info Additional optional information about the sponsor to be shown along with the advertisement +advertisementSponsor url:string photo:photo info:string = AdvertisementSponsor; //@description Describes a sponsored message //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages @@ -2320,7 +2357,7 @@ messageSponsor url:string photo:photo info:string = MessageSponsor; //@accent_color_id Identifier of the accent color for title, button text and message background //@background_custom_emoji_id Identifier of a custom emoji to be shown on the message background; 0 if none //@additional_info If non-empty, additional information about the sponsored message to be shown along with the message -sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:messageSponsor title:string button_text:string accent_color_id:int32 background_custom_emoji_id:int64 additional_info:string = SponsoredMessage; +sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:advertisementSponsor title:string button_text:string accent_color_id:int32 background_custom_emoji_id:int64 additional_info:string = SponsoredMessage; //@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; @@ -2335,6 +2372,23 @@ sponsoredChat unique_id:int53 chat_id:int53 sponsor_info:string additional_info: //@description Contains a list of sponsored chats @chats List of sponsored chats sponsoredChats chats:vector = SponsoredChats; +//@description Describes an advertisent to be shown while a video from a message is watched +//@unique_id Unique identifier of this result +//@text Text of the advertisement +//@min_display_duration The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds +//@max_display_duration The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds +//@can_be_reported True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement +//@sponsor Information about the sponsor of the advertisement +//@title Title of the sponsored message +//@additional_info If non-empty, additional information about the sponsored message to be shown along with the message +videoMessageAdvertisement unique_id:int53 text:string min_display_duration:int32 max_display_duration:int32 can_be_reported:Bool sponsor:advertisementSponsor title:string additional_info:string = VideoMessageAdvertisement; + +//@description Contains a list of advertisements to be shown while a video from a message is watched +//@advertisements List of advertisements +//@start_delay Delay before the first advertisement is shown, in seconds +//@between_delay Delay between consecutive advertisements, in seconds +videoMessageAdvertisements advertisements:vector start_delay:int32 between_delay:int32 = VideoMessageAdvertisements; + //@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; @@ -2917,6 +2971,7 @@ savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int //@id Unique topic identifier //@sender_id Identifier of the user or chat that sends the messages to the topic //@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order +//@can_send_unpaid_messages True, if the other party can send unpaid messages even if the chat has paid messages enabled //@is_marked_as_unread True, if the forum topic is marked as unread //@unread_count Number of unread messages in the chat //@last_read_inbox_message_id Identifier of the last read incoming message @@ -2924,7 +2979,7 @@ savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int //@unread_reaction_count Number of messages with unread reactions in the chat //@last_message Last message in the topic; may be null if none or unknown //@draft_message A draft of a message in the topic; may be null if none -directMessagesChatTopic chat_id:int53 id:int53 sender_id:MessageSender order:int64 is_marked_as_unread:Bool unread_count:int53 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_reaction_count:int53 last_message:message draft_message:draftMessage = DirectMessagesChatTopic; +directMessagesChatTopic chat_id:int53 id:int53 sender_id:MessageSender order:int64 can_send_unpaid_messages:Bool is_marked_as_unread:Bool unread_count:int53 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_reaction_count:int53 last_message:message draft_message:draftMessage = DirectMessagesChatTopic; //@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none @@ -3987,13 +4042,14 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent; //@description A video message //@video The video description //@alternative_videos Alternative qualities of the video +//@storyboards Available storyboards for the video //@cover Cover of the video; may be null if none //@start_timestamp Timestamp from which the video playing must start, in seconds //@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 alternative_videos:vector cover:photo start_timestamp:int32 caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; +messageVideo video:video alternative_videos:vector storyboards:vector cover:photo start_timestamp:int32 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; @@ -4050,6 +4106,9 @@ messagePoll poll:poll = MessageContent; //@via_mention True, if the story was automatically forwarded because of a mention of the user messageStory story_poster_chat_id:int53 story_id:int32 via_mention:Bool = MessageContent; +//@description A message with a checklist @list The checklist description +messageChecklist list:checklist = MessageContent; + //@description A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice //@product_info Information about the product //@currency Currency for the product price @@ -4329,6 +4388,17 @@ messagePaidMessagePriceChanged paid_message_star_count:int53 = MessageContent; //-0 if the direct messages group was disabled or the messages are free messageDirectMessagePriceChanged is_enabled:Bool paid_message_star_count:int53 = MessageContent; +//@description Some tasks from a checklist were marked as done or not done +//@checklist_message_id Identifier of the message with the checklist; can be 0 if the message was deleted +//@marked_as_done_task_ids Identifiers of tasks that were marked as done +//@marked_as_not_done_task_ids Identifiers of tasks that were marked as not done +messageChecklistTasksDone checklist_message_id:int53 marked_as_done_task_ids:vector marked_as_not_done_task_ids:vector = MessageContent; + +//@description Some tasks were added to a checklist +//@checklist_message_id Identifier of the message with the checklist; can be 0 if the message was deleted +//@tasks List of tasks added to the checklist +messageChecklistTasksAdded checklist_message_id:int53 tasks:vector = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4652,6 +4722,10 @@ inputMessagePoll question:formattedText options:vector is_anonymo //@story_id Story identifier inputMessageStory story_poster_chat_id:int53 story_id:int32 = InputMessageContent; +//@description A message with a checklist. Checklists can't be sent to secret chats, channel chats and channel direct messages chats; for Telegram Premium users only +//@checklist The checklist to send +inputMessageChecklist checklist:inputChecklist = InputMessageContent; + //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from //@message_id Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded @@ -4663,12 +4737,13 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_add_tasks True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription //@can_be_copied True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. -//-For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message +//-For live location, poll, and checklist messages this fields shows whether editMessageLiveLocation, stopPoll, or editMessageChecklist respectively can be used with this message //@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options //@can_be_paid True, if the message can be paid using inputInvoiceMessage //@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage @@ -4685,14 +4760,16 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory //@can_get_read_date True, if read date of the message can be received through getMessageReadDate //@can_get_statistics True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards +//@can_get_video_advertisements True, if advertisements for video of the message can be received though getVideoMessageAdvertisements //@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers +//@can_mark_tasks_as_done True, if tasks can be marked as done or not done in the message's checklist using markChecklistTasksAsDone if the current user has Telegram Premium subscription //@can_recognize_speech True, if speech can be recognized for the message through recognizeSpeech //@can_report_chat True, if the message can be reported using reportChat //@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_add_tasks:Bool can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_video_advertisements:Bool can_get_viewers:Bool can_mark_tasks_as_done:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -6445,6 +6522,9 @@ premiumFeatureBusiness = PremiumFeature; //@description The ability to use all available message effects premiumFeatureMessageEffects = PremiumFeature; +//@description The ability to create and use checklist messages +premiumFeatureChecklists = PremiumFeature; + //@class BusinessFeature @description Describes a feature available to Business user accounts @@ -6956,6 +7036,11 @@ pushMessageContentStory is_mention:Bool is_pinned:Bool = PushMessageContent; //@description A text message @text Message text @is_pinned True, if the message is a pinned message with the specified content pushMessageContentText text:string is_pinned:Bool = PushMessageContent; +//@description A message with a checklist +//@title Checklist title +//@is_pinned True, if the message is a pinned message with the specified content +pushMessageContentChecklist title:string is_pinned:Bool = PushMessageContent; + //@description A video message //@video Message content; may be null //@caption Video caption @@ -7021,6 +7106,12 @@ pushMessageContentSuggestProfilePhoto = PushMessageContent; //@description A user in the chat came within proximity alert range from the current user @distance The distance to the user pushMessageContentProximityAlertTriggered distance:int32 = PushMessageContent; +//@description Some tasks were added to a checklist @task_count Number of added tasks +pushMessageContentChecklistTasksAdded task_count:int32 = PushMessageContent; + +//@description Some tasks from a checklist were marked as done or not done @task_count Number of changed tasks +pushMessageContentChecklistTasksDone task_count:int32 = PushMessageContent; + //@description A forwarded messages @total_count Number of forwarded messages pushMessageContentMessageForwards total_count:int32 = PushMessageContent; @@ -9313,8 +9404,8 @@ getMessage chat_id:int53 message_id:int53 = Message; 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. +//-the message with a previously set same background, the giveaway message, the checklist message, and the topic creation message for messages of the types +//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, 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 @@ -9517,6 +9608,18 @@ unpinAllDirectMessagesChatTopicMessages chat_id:int53 topic_id:int53 = Ok; //@topic_id Topic identifier readAllDirectMessagesChatTopicReactions chat_id:int53 topic_id:int53 = Ok; +//@description Returns the total number of Telegram Stars received by the channel chat for direct messages from the given topic +//@chat_id Chat identifier of the channel direct messages chat administered by the current user +//@topic_id Identifier of the topic +getDirectMessagesChatTopicRevenue chat_id:int53 topic_id:int53 = StarCount; + +//@description Allows to send unpaid messages to the given topic of the channel direct messages chat administered by the current user +//@chat_id Chat identifier +//@topic_id Identifier of the topic +//@can_send_unpaid_messages Pass true to allow unpaid messages; pass false to disallow unpaid messages +//@refund_payments Pass true to refund the user previously paid messages +toggleDirectMessagesChatTopicCanSendUnpaidMessages chat_id:int53 topic_id:int53 can_send_unpaid_messages:Bool refund_payments:Bool = Ok; + //@description Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded //@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached @@ -9757,6 +9860,22 @@ openSponsoredChat sponsored_chat_unique_id:int53 = Ok; //@option_id Option identifier chosen by the user; leave empty for the initial request reportSponsoredChat sponsored_chat_unique_id:int53 option_id:bytes = ReportSponsoredResult; +//@description Returns advertisements to be shown while a video from a message is watched. Available only if messageProperties.can_get_video_advertisements +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message +getVideoMessageAdvertisements chat_id:int53 message_id:int53 = VideoMessageAdvertisements; + +//@description Informs TDLib that the user viewed a video message advertisement @advertisement_unique_id Unique identifier of the advertisement +viewVideoMessageAdvertisement advertisement_unique_id:int53 = Ok; + +//@description Informs TDLib that the user clicked a video message advertisement @advertisement_unique_id Unique identifier of the advertisement +clickVideoMessageAdvertisement advertisement_unique_id:int53 = Ok; + +//@description Reports a video message advertisement to Telegram moderators +//@advertisement_unique_id Unique identifier of the advertisement +//@option_id Option identifier chosen by the user; leave empty for the initial request +reportVideoMessageAdvertisement advertisement_unique_id:int53 option_id:bytes = ReportSponsoredResult; + //@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user @notification_group_id Identifier of notification group to which the notification belongs @notification_id Identifier of removed notification removeNotification notification_group_id:int32 notification_id:int32 = Ok; @@ -9924,6 +10043,13 @@ editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_me //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Message; +//@description Edits the message content of a checklist. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to +//@message_id Identifier of the message. 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 +//@checklist The new checklist. If some tasks were completed, this information will be kept +editMessageChecklist chat_id:int53 message_id:int53 reply_markup:ReplyMarkup checklist:inputChecklist = Message; + //@description Edits the media content of a message, including message caption. If only the caption needs to be edited, use editMessageCaption instead. //-The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to @@ -10036,6 +10162,14 @@ editBusinessMessageText business_connection_id:string chat_id:int53 message_id:i //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editBusinessMessageLiveLocation business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = BusinessMessage; +//@description Edits the content of a checklist in a message sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +//@reply_markup The new message reply markup; pass null if none +//@checklist The new checklist. If some tasks were completed, this information will be kept +editBusinessMessageChecklist business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup checklist:inputChecklist = BusinessMessage; + //@description Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only //@business_connection_id Unique identifier of business connection on behalf of which the message was sent //@chat_id The chat the message belongs to @@ -10163,7 +10297,7 @@ deleteQuickReplyShortcutMessages shortcut_id:int32 message_ids:vector = O //-The shortcut must not contain more than getOption("quick_reply_shortcut_message_count_max") messages after adding the new message. Returns the added message //@shortcut_name Name of the target shortcut //@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none -//@input_message_content The content of the message to be added; inputMessagePoll, inputMessageForwarded and inputMessageLocation with live_period aren't supported +//@input_message_content The content of the message to be added; inputMessagePaidMedia, inputMessageForwarded and inputMessageLocation with live_period aren't supported addQuickReplyShortcutMessage shortcut_name:string reply_to_message_id:int53 input_message_content:InputMessageContent = QuickReplyMessage; //@description Adds a message to a quick reply shortcut via inline bot. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. @@ -10189,10 +10323,11 @@ addQuickReplyShortcutMessageAlbum shortcut_name:string reply_to_message_id:int53 readdQuickReplyShortcutMessages shortcut_name:string message_ids:vector = QuickReplyMessages; //@description Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. -//-Media message can be edited only to a media message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +//-Media message can be edited only to a media message. Checklist messages can be edited only to a checklist message. +//-The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa //@shortcut_id Unique identifier of the quick reply shortcut with the message //@message_id Identifier of the message -//@input_message_content New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo +//@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageChecklist, inputMessageDocument, inputMessagePhoto, inputMessageText, or inputMessageVideo editQuickReplyMessage shortcut_id:int32 message_id:int53 input_message_content:InputMessageContent = Ok; @@ -10412,6 +10547,20 @@ getPollVoters chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit: stopPoll chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; +//@description Adds tasks to a checklist in a message +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message containing the checklist. Use messageProperties.can_add_tasks to check whether the tasks can be added +//@tasks List of added tasks +addChecklistTasks chat_id:int53 message_id:int53 tasks:vector = Ok; + +//@description Adds tasks of a checklist in a message as done or not done +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message containing the checklist. Use messageProperties.can_mark_tasks_as_done to check whether the tasks can be marked as done or not done +//@marked_as_done_task_ids Identifiers of tasks that were marked as done +//@marked_as_not_done_task_ids Identifiers of tasks that were marked as not done +markChecklistTasksAsDone chat_id:int53 message_id:int53 marked_as_done_task_ids:vector marked_as_not_done_task_ids:vector = Ok; + + //@description Hides a suggested action @action Suggested action to hide hideSuggestedAction action:SuggestedAction = Ok; From 5c5078ec427b2444302480aa3526ea4c30332970 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 2 Sep 2025 18:58:30 +0800 Subject: [PATCH 22/29] Fix command parser --- client/extra.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/client/extra.go b/client/extra.go index c786893..9b32fc9 100644 --- a/client/extra.go +++ b/client/extra.go @@ -23,22 +23,18 @@ func IsCommand(text string) bool { func CheckCommand(text string, entities []*TextEntity) string { if IsCommand(text) { - var cmd string + cmd := text // e.g. ["/hello 123", "/hell o 123"] // Result: "/hello", "/hell" - if i := strings.Index(text, " "); i != -1 { - cmd = text[:i] + if i := strings.Index(cmd, " "); i != -1 { + cmd = cmd[:i] } // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] // Result: "/hello" - if i := strings.Index(text, "@"); i != -1 { - cmd = text[:i] - } - - if cmd == "" { - return text + if i := strings.Index(cmd, "@"); i != -1 { + cmd = cmd[:i] } return cmd From 14418433a409d1f0003bf6dbaa6f5445865d5b6e Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 2 Sep 2025 19:11:19 +0800 Subject: [PATCH 23/29] Update to TDLib 1.8.52 --- client/function.go | 205 +++++-- client/type.go | 1230 ++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 616 +++++++++++++++++++-- data/td_api.tl | 352 +++++++++--- 4 files changed, 2174 insertions(+), 229 deletions(-) diff --git a/client/function.go b/client/function.go index c2e9384..63ba51e 100755 --- a/client/function.go +++ b/client/function.go @@ -1429,7 +1429,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, the checklist message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, and topic messages without non-bundled replied message respectively. Returns a 404 error if the message doesn't exist +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message for messagePinMessage, the game message for messageGameScore, the invoice message for messagePaymentSuccessful, the message with a previously set same background for messageChatSetBackground, the giveaway message for messageGiveawayCompleted, the checklist message for messageChecklistTasksDone, messageChecklistTasksAdded, the message with suggested post information for messageSuggestedPostApprovalFailed, messageSuggestedPostApproved, messageSuggestedPostDeclined, messageSuggestedPostPaid, messageSuggestedPostRefunded, the message with the regular gift that was upgraded for messageUpgradedGift with origin of the type upgradedGiftOriginUpgrade, and the topic creation message for topic messages without non-bundled replied message. 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{ @@ -2519,9 +2519,9 @@ type GetDirectMessagesChatTopicHistoryRequest struct { TopicId int64 `json:"topic_id"` // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -2863,9 +2863,9 @@ type GetSavedMessagesTopicHistoryRequest struct { SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -3072,9 +3072,9 @@ type GetChatHistoryRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` // Pass true to get only messages that are available without sending network requests OnlyLocal bool `json:"only_local"` @@ -3112,9 +3112,9 @@ type GetMessageThreadHistoryRequest struct { MessageId int64 `json:"message_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -3212,9 +3212,9 @@ type SearchChatMessagesRequest struct { SenderId MessageSender `json:"sender_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` // Additional filter for messages to search; pass null to search for all messages Filter SearchMessagesFilter `json:"filter"` @@ -3342,9 +3342,9 @@ type SearchSavedMessagesRequest struct { Query string `json:"query"` // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -6071,7 +6071,7 @@ type SetBusinessAccountProfilePhotoRequest struct { BusinessConnectionId string `json:"business_connection_id"` // Profile photo to set; pass null to remove the photo Photo InputChatPhoto `json:"photo"` - // Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings + // Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings IsPublic bool `json:"is_public"` } @@ -6624,7 +6624,7 @@ type EditForumTopicRequest struct { IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` } -// Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +// Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic func (client *Client) EditForumTopic(req *EditForumTopicRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6789,7 +6789,7 @@ type ToggleForumTopicIsClosedRequest struct { IsClosed bool `json:"is_closed"` } -// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic func (client *Client) ToggleForumTopicIsClosed(req *ToggleForumTopicIsClosedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6819,7 +6819,7 @@ type ToggleGeneralForumTopicIsHiddenRequest struct { IsHidden bool `json:"is_hidden"` } -// Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics right in the supergroup +// Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup func (client *Client) ToggleGeneralForumTopicIsHidden(req *ToggleGeneralForumTopicIsHiddenRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6850,7 +6850,7 @@ type ToggleForumTopicIsPinnedRequest struct { IsPinned bool `json:"is_pinned"` } -// Changes the pinned state of a forum topic; requires can_manage_topics right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics +// Changes the pinned state of a forum topic; requires can_manage_topics administrator right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics func (client *Client) ToggleForumTopicIsPinned(req *ToggleForumTopicIsPinnedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6880,7 +6880,7 @@ type SetPinnedForumTopicsRequest struct { MessageThreadIds []int64 `json:"message_thread_ids"` } -// Changes the order of pinned forum topics; requires can_manage_topics right in the supergroup +// Changes the order of pinned forum topics; requires can_manage_topics administrator right in the supergroup func (client *Client) SetPinnedForumTopics(req *SetPinnedForumTopicsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -9163,7 +9163,7 @@ type ViewMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // Source of the message view; pass null to guess the source based on chat open state Source MessageSource `json:"source"` - // Pass true to mark as read the specified messages even the chat is closed + // Pass true to mark as read the specified messages even if the chat is closed ForceRead bool `json:"force_read"` } @@ -9383,6 +9383,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeMyStars: return UnmarshalInternalLinkTypeMyStars(result.Data) + case TypeInternalLinkTypeMyToncoins: + return UnmarshalInternalLinkTypeMyToncoins(result.Data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(result.Data) @@ -11189,7 +11192,7 @@ type SetChatSlowModeDelayRequest struct { SlowModeDelay int32 `json:"slow_mode_delay"` } -// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right +// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members administrator right func (client *Client) SetChatSlowModeDelay(req *SetChatSlowModeDelayRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -12087,7 +12090,7 @@ type CanPostStoryRequest struct { ChatId int64 `json:"chat_id"` } -// Checks whether the current user can post a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +// Checks whether the current user can post a story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats func (client *Client) CanPostStory(req *CanPostStoryRequest) (CanPostStoryResult, error) { result, err := client.Send(Request{ meta: meta{ @@ -12150,7 +12153,7 @@ type PostStoryRequest struct { ProtectContent bool `json:"protect_content"` } -// Posts a new story on behalf of a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story +// Posts a new story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats. Returns a temporary story func (client *Client) PostStory(req *PostStoryRequest) (*Story, error) { result, err := client.Send(Request{ meta: meta{ @@ -12480,7 +12483,7 @@ type GetChatArchivedStoriesRequest struct { Limit int32 `json:"limit"` } -// Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +// Returns the list of all stories posted by the given chat; requires can_edit_stories administrator right in the chat. The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib func (client *Client) GetChatArchivedStories(req *GetChatArchivedStoriesRequest) (*Stories, error) { result, err := client.Send(Request{ meta: meta{ @@ -12510,7 +12513,7 @@ type SetChatPinnedStoriesRequest struct { StoryIds []int32 `json:"story_ids"` } -// Changes the list of pinned stories on a chat page; requires can_edit_stories right in the chat +// Changes the list of pinned stories on a chat page; requires can_edit_stories administrator right in the chat func (client *Client) SetChatPinnedStories(req *SetChatPinnedStoriesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -13273,7 +13276,7 @@ func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatusCustomEmojis, e return UnmarshalEmojiStatusCustomEmojis(result.Data) } -// Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true +// Returns the list of emoji statuses, which can't be used as chat emoji status, even if they are from a sticker set with is_allowed_as_chat_emoji_status == true func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ @@ -14484,6 +14487,102 @@ func (client *Client) ProcessChatJoinRequests(req *ProcessChatJoinRequestsReques return UnmarshalOk(result.Data) } +type ApproveSuggestedPostRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message with the suggested post. Use messageProperties.can_be_approved to check whether the suggested post can be approved + MessageId int64 `json:"message_id"` + // Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date has already been chosen. If specified, then the date must be in the future, but at most getOption("suggested_post_send_delay_max") seconds in the future + SendDate int32 `json:"send_date"` +} + +// Approves a suggested post in a channel direct messages chat +func (client *Client) ApproveSuggestedPost(req *ApproveSuggestedPostRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "approveSuggestedPost", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "send_date": req.SendDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeclineSuggestedPostRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message with the suggested post. Use messageProperties.can_be_declined to check whether the suggested post can be declined + MessageId int64 `json:"message_id"` + // Comment for the creator of the suggested post; 0-128 characters + Comment string `json:"comment"` +} + +// Declines a suggested post in a channel direct messages chat +func (client *Client) DeclineSuggestedPost(req *DeclineSuggestedPostRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "declineSuggestedPost", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "comment": req.Comment, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddOfferRequest struct { + // Identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message in the chat which will be sent as suggested post. Use messageProperties.can_add_offer to check whether an offer can be added or messageProperties.can_edit_suggested_post_info to check whether price or time of sending of the post can be changed + MessageId int64 `json:"message_id"` + // Options to be used to send the message. New information about the suggested post must always be specified + Options *MessageSendOptions `json:"options"` +} + +// Sent a suggested post based on a previously sent message in a channel direct messages chat. Can be also used to suggest price or time change for an existing suggested post. Returns the sent message +func (client *Client) AddOffer(req *AddOfferRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addOffer", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "options": req.Options, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + type CreateCallRequest struct { // Identifier of the user to be called UserId int64 `json:"user_id"` @@ -17576,7 +17675,7 @@ func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) ( type SetProfilePhotoRequest struct { // Profile photo to set Photo InputChatPhoto `json:"photo"` - // Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings + // Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings IsPublic bool `json:"is_public"` } @@ -20481,7 +20580,7 @@ type SellGiftRequest struct { ReceivedGiftId string `json:"received_gift_id"` } -// Sells a gift for Telegram Stars +// Sells a gift for Telegram Stars; requires owner privileges for gifts owned by a chat func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -20894,7 +20993,7 @@ type SearchGiftsForResaleRequest struct { Limit int32 `json:"limit"` } -// Returns upgraded gifts that can be bought from other owners +// Returns upgraded gifts that can be bought from other owners using sendResoldGift func (client *Client) SearchGiftsForResale(req *SearchGiftsForResaleRequest) (*GiftsForResale, error) { result, err := client.Send(Request{ meta: meta{ @@ -22206,9 +22305,9 @@ func (client *Client) GetChatRevenueWithdrawalUrl(req *GetChatRevenueWithdrawalU type GetChatRevenueTransactionsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Number of transactions to skip - Offset int32 `json:"offset"` - // The maximum number of transactions to be returned; up to 200 + // Offset of the first transaction 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 transactions to be returned; up to 100 Limit int32 `json:"limit"` } @@ -22235,6 +22334,38 @@ func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactions return UnmarshalChatRevenueTransactions(result.Data) } +type GetTonTransactionsRequest struct { + // Direction of the transactions to receive; pass null to get all transactions + Direction TransactionDirection `json:"direction"` + // Offset of the first transaction 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 transactions to return + Limit int32 `json:"limit"` +} + +// Returns the list of Toncoin transactions of the current user +func (client *Client) GetTonTransactions(req *GetTonTransactionsRequest) (*TonTransactions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonTransactions", + }, + Data: map[string]interface{}{ + "direction": req.Direction, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTonTransactions(result.Data) +} + type GetStarRevenueStatisticsRequest struct { // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` @@ -22267,7 +22398,7 @@ func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequ type GetStarWithdrawalUrlRequest struct { // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat OwnerId MessageSender `json:"owner_id"` - // The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") + // The number of Telegram Stars to withdraw; must be between getOption("star_withdrawal_count_min") and getOption("star_withdrawal_count_max") StarCount int64 `json:"star_count"` // The 2-step verification password of the current user Password string `json:"password"` @@ -24271,7 +24402,7 @@ type GetStarTransactionsRequest struct { // If non-empty, only transactions related to the Star Subscription will be returned SubscriptionId string `json:"subscription_id"` // Direction of the transactions to receive; pass null to get all transactions - Direction StarTransactionDirection `json:"direction"` + Direction TransactionDirection `json:"direction"` // Offset of the first transaction 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 transactions to return @@ -25970,6 +26101,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(result.Data) + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(result.Data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(result.Data) @@ -26315,6 +26449,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(result.Data) + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(result.Data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(result.Data) diff --git a/client/type.go b/client/type.go index 9f487c5..a98e665 100755 --- a/client/type.go +++ b/client/type.go @@ -23,14 +23,19 @@ const ( ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" + ClassSuggestedPostPrice = "SuggestedPostPrice" + ClassSuggestedPostState = "SuggestedPostState" + ClassSuggestedPostRefundReason = "SuggestedPostRefundReason" ClassStarSubscriptionType = "StarSubscriptionType" ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassUpgradedGiftOrigin = "UpgradedGiftOrigin" ClassUpgradedGiftAttributeId = "UpgradedGiftAttributeId" ClassGiftForResaleOrder = "GiftForResaleOrder" ClassSentGift = "SentGift" - ClassStarTransactionDirection = "StarTransactionDirection" + ClassTransactionDirection = "TransactionDirection" ClassStarTransactionType = "StarTransactionType" + ClassTonTransactionType = "TonTransactionType" ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" ClassGiveawayInfo = "GiveawayInfo" ClassGiveawayPrize = "GiveawayPrize" @@ -256,6 +261,8 @@ const ( ClassChatPhotos = "ChatPhotos" ClassChatPermissions = "ChatPermissions" ClassChatAdministratorRights = "ChatAdministratorRights" + ClassSuggestedPostInfo = "SuggestedPostInfo" + ClassInputSuggestedPostInfo = "InputSuggestedPostInfo" ClassStarAmount = "StarAmount" ClassStarSubscriptionPricing = "StarSubscriptionPricing" ClassStarSubscription = "StarSubscription" @@ -302,6 +309,8 @@ const ( ClassGiftUpgradePreview = "GiftUpgradePreview" ClassStarTransaction = "StarTransaction" ClassStarTransactions = "StarTransactions" + ClassTonTransaction = "TonTransaction" + ClassTonTransactions = "TonTransactions" ClassAccentColor = "AccentColor" ClassProfileAccentColors = "ProfileAccentColors" ClassProfileAccentColor = "ProfileAccentColor" @@ -780,6 +789,15 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeSuggestedPostPriceStar = "suggestedPostPriceStar" + TypeSuggestedPostPriceTon = "suggestedPostPriceTon" + TypeSuggestedPostStatePending = "suggestedPostStatePending" + TypeSuggestedPostStateApproved = "suggestedPostStateApproved" + TypeSuggestedPostStateDeclined = "suggestedPostStateDeclined" + TypeSuggestedPostInfo = "suggestedPostInfo" + TypeInputSuggestedPostInfo = "inputSuggestedPostInfo" + TypeSuggestedPostRefundReasonPostDeleted = "suggestedPostRefundReasonPostDeleted" + TypeSuggestedPostRefundReasonPaymentRefunded = "suggestedPostRefundReasonPaymentRefunded" TypeStarAmount = "starAmount" TypeStarSubscriptionTypeChannel = "starSubscriptionTypeChannel" TypeStarSubscriptionTypeBot = "starSubscriptionTypeBot" @@ -814,6 +832,9 @@ const ( TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" TypeAcceptedGiftTypes = "acceptedGiftTypes" TypeGiftSettings = "giftSettings" + TypeUpgradedGiftOriginUpgrade = "upgradedGiftOriginUpgrade" + TypeUpgradedGiftOriginTransfer = "upgradedGiftOriginTransfer" + TypeUpgradedGiftOriginResale = "upgradedGiftOriginResale" TypeUpgradedGiftModel = "upgradedGiftModel" TypeUpgradedGiftSymbol = "upgradedGiftSymbol" TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" @@ -840,8 +861,8 @@ const ( TypeReceivedGift = "receivedGift" TypeReceivedGifts = "receivedGifts" TypeGiftUpgradePreview = "giftUpgradePreview" - TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" - TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" + TypeTransactionDirectionIncoming = "transactionDirectionIncoming" + TypeTransactionDirectionOutgoing = "transactionDirectionOutgoing" TypeStarTransactionTypePremiumBotDeposit = "starTransactionTypePremiumBotDeposit" TypeStarTransactionTypeAppStoreDeposit = "starTransactionTypeAppStoreDeposit" TypeStarTransactionTypeGooglePlayDeposit = "starTransactionTypeGooglePlayDeposit" @@ -872,12 +893,19 @@ const ( TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" TypeStarTransactionTypePaidMessageSend = "starTransactionTypePaidMessageSend" TypeStarTransactionTypePaidMessageReceive = "starTransactionTypePaidMessageReceive" + TypeStarTransactionTypeSuggestedPostPaymentSend = "starTransactionTypeSuggestedPostPaymentSend" + TypeStarTransactionTypeSuggestedPostPaymentReceive = "starTransactionTypeSuggestedPostPaymentReceive" TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" TypeStarTransactionTypeBusinessBotTransferSend = "starTransactionTypeBusinessBotTransferSend" TypeStarTransactionTypeBusinessBotTransferReceive = "starTransactionTypeBusinessBotTransferReceive" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" + TypeTonTransactionTypeFragmentDeposit = "tonTransactionTypeFragmentDeposit" + TypeTonTransactionTypeSuggestedPostPayment = "tonTransactionTypeSuggestedPostPayment" + TypeTonTransactionTypeUnsupported = "tonTransactionTypeUnsupported" + TypeTonTransaction = "tonTransaction" + TypeTonTransactions = "tonTransactions" TypeGiveawayParticipantStatusEligible = "giveawayParticipantStatusEligible" TypeGiveawayParticipantStatusParticipating = "giveawayParticipantStatusParticipating" TypeGiveawayParticipantStatusAlreadyWasMember = "giveawayParticipantStatusAlreadyWasMember" @@ -1400,6 +1428,7 @@ const ( TypeMessageGiveawayCompleted = "messageGiveawayCompleted" TypeMessageGiveawayWinners = "messageGiveawayWinners" TypeMessageGiftedStars = "messageGiftedStars" + TypeMessageGiftedTon = "messageGiftedTon" TypeMessageGiveawayPrizeStars = "messageGiveawayPrizeStars" TypeMessageGift = "messageGift" TypeMessageUpgradedGift = "messageUpgradedGift" @@ -1409,6 +1438,11 @@ const ( TypeMessageDirectMessagePriceChanged = "messageDirectMessagePriceChanged" TypeMessageChecklistTasksDone = "messageChecklistTasksDone" TypeMessageChecklistTasksAdded = "messageChecklistTasksAdded" + TypeMessageSuggestedPostApprovalFailed = "messageSuggestedPostApprovalFailed" + TypeMessageSuggestedPostApproved = "messageSuggestedPostApproved" + TypeMessageSuggestedPostDeclined = "messageSuggestedPostDeclined" + TypeMessageSuggestedPostPaid = "messageSuggestedPostPaid" + TypeMessageSuggestedPostRefunded = "messageSuggestedPostRefunded" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -2087,6 +2121,7 @@ const ( TypeInternalLinkTypeMessage = "internalLinkTypeMessage" TypeInternalLinkTypeMessageDraft = "internalLinkTypeMessageDraft" TypeInternalLinkTypeMyStars = "internalLinkTypeMyStars" + TypeInternalLinkTypeMyToncoins = "internalLinkTypeMyToncoins" TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" @@ -2231,9 +2266,11 @@ const ( TypeRevenueWithdrawalStatePending = "revenueWithdrawalStatePending" TypeRevenueWithdrawalStateSucceeded = "revenueWithdrawalStateSucceeded" TypeRevenueWithdrawalStateFailed = "revenueWithdrawalStateFailed" - TypeChatRevenueTransactionTypeEarnings = "chatRevenueTransactionTypeEarnings" - TypeChatRevenueTransactionTypeWithdrawal = "chatRevenueTransactionTypeWithdrawal" - TypeChatRevenueTransactionTypeRefund = "chatRevenueTransactionTypeRefund" + TypeChatRevenueTransactionTypeUnsupported = "chatRevenueTransactionTypeUnsupported" + TypeChatRevenueTransactionTypeSponsoredMessageEarnings = "chatRevenueTransactionTypeSponsoredMessageEarnings" + TypeChatRevenueTransactionTypeSuggestedPostEarnings = "chatRevenueTransactionTypeSuggestedPostEarnings" + TypeChatRevenueTransactionTypeFragmentWithdrawal = "chatRevenueTransactionTypeFragmentWithdrawal" + TypeChatRevenueTransactionTypeFragmentRefund = "chatRevenueTransactionTypeFragmentRefund" TypeChatRevenueTransaction = "chatRevenueTransaction" TypeChatRevenueTransactions = "chatRevenueTransactions" TypeStarRevenueStatus = "starRevenueStatus" @@ -2264,6 +2301,7 @@ const ( TypeUpdateMessageMentionRead = "updateMessageMentionRead" TypeUpdateMessageUnreadReactions = "updateMessageUnreadReactions" TypeUpdateMessageFactCheck = "updateMessageFactCheck" + TypeUpdateMessageSuggestedPostInfo = "updateMessageSuggestedPostInfo" TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" TypeUpdateVideoPublished = "updateVideoPublished" TypeUpdateNewChat = "updateNewChat" @@ -2379,6 +2417,7 @@ const ( TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" TypeUpdateActiveLiveLocationMessages = "updateActiveLiveLocationMessages" TypeUpdateOwnedStarCount = "updateOwnedStarCount" + TypeUpdateOwnedTonCount = "updateOwnedTonCount" TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" TypeUpdateStarRevenueStatus = "updateStarRevenueStatus" TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" @@ -2506,6 +2545,21 @@ type InputChatPhoto interface { InputChatPhotoType() string } +// Describes price of a suggested post +type SuggestedPostPrice interface { + SuggestedPostPriceType() string +} + +// Describes state of a suggested post +type SuggestedPostState interface { + SuggestedPostStateType() string +} + +// Describes reason for refund of the payment for a suggested post +type SuggestedPostRefundReason interface { + SuggestedPostRefundReasonType() string +} + // Describes type of subscription paid in Telegram Stars type StarSubscriptionType interface { StarSubscriptionTypeType() string @@ -2521,6 +2575,11 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Describes origin from which the upgraded gift was obtained +type UpgradedGiftOrigin interface { + UpgradedGiftOriginType() string +} + // Contains identifier of an upgraded gift attribute to search for type UpgradedGiftAttributeId interface { UpgradedGiftAttributeIdType() string @@ -2536,9 +2595,9 @@ type SentGift interface { SentGiftType() string } -// Describes direction of a transaction with Telegram Stars -type StarTransactionDirection interface { - StarTransactionDirectionType() string +// Describes direction of transactions in a transaction list +type TransactionDirection interface { + TransactionDirectionType() string } // Describes type of transaction with Telegram Stars @@ -2546,6 +2605,11 @@ type StarTransactionType interface { StarTransactionTypeType() string } +// Describes type of transaction with Toncoins +type TonTransactionType interface { + TonTransactionTypeType() string +} + // Contains information about status of a user in a giveaway type GiveawayParticipantStatus interface { GiveawayParticipantStatusType() string @@ -7558,7 +7622,7 @@ type ChatPhoto struct { Sizes []*PhotoSize `json:"sizes"` // A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null Animation *AnimatedChatPhoto `json:"animation"` - // A small (160x160) animated variant of the photo in MPEG4 format; may be null even the big animation is available + // A small (160x160) animated variant of the photo in MPEG4 format; may be null even if the big animation is available SmallAnimation *AnimatedChatPhoto `json:"small_animation"` // Sticker-based version of the chat photo; may be null Sticker *ChatPhotoSticker `json:"sticker"` @@ -7812,7 +7876,7 @@ type ChatAdministratorRights struct { CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` - // True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only + // True, if the administrator can create channel posts, approve suggested channel posts, or view channel statistics; applicable to channels only CanPostMessages bool `json:"can_post_messages"` // True, if the administrator can edit messages of other users and pin messages; applicable to channels only CanEditMessages bool `json:"can_edit_messages"` @@ -7836,6 +7900,8 @@ type ChatAdministratorRights struct { CanEditStories bool `json:"can_edit_stories"` // True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only CanDeleteStories bool `json:"can_delete_stories"` + // True, if the administrator can answer to channel direct messages; applicable to channels only + CanManageDirectMessages bool `json:"can_manage_direct_messages"` // True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only IsAnonymous bool `json:"is_anonymous"` } @@ -7856,6 +7922,287 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes price of a suggested post in Telegram Stars +type SuggestedPostPriceStar struct { + meta + // The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") + StarCount int64 `json:"star_count"` +} + +func (entity *SuggestedPostPriceStar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostPriceStar + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostPriceStar) GetClass() string { + return ClassSuggestedPostPrice +} + +func (*SuggestedPostPriceStar) GetType() string { + return TypeSuggestedPostPriceStar +} + +func (*SuggestedPostPriceStar) SuggestedPostPriceType() string { + return TypeSuggestedPostPriceStar +} + +// Describes price of a suggested post in Toncoins +type SuggestedPostPriceTon struct { + meta + // The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") + ToncoinCentCount int64 `json:"toncoin_cent_count"` +} + +func (entity *SuggestedPostPriceTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostPriceTon + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostPriceTon) GetClass() string { + return ClassSuggestedPostPrice +} + +func (*SuggestedPostPriceTon) GetType() string { + return TypeSuggestedPostPriceTon +} + +func (*SuggestedPostPriceTon) SuggestedPostPriceType() string { + return TypeSuggestedPostPriceTon +} + +// The post must be approved or declined +type SuggestedPostStatePending struct{ + meta +} + +func (entity *SuggestedPostStatePending) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStatePending + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStatePending) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStatePending) GetType() string { + return TypeSuggestedPostStatePending +} + +func (*SuggestedPostStatePending) SuggestedPostStateType() string { + return TypeSuggestedPostStatePending +} + +// The post was approved +type SuggestedPostStateApproved struct{ + meta +} + +func (entity *SuggestedPostStateApproved) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStateApproved + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStateApproved) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStateApproved) GetType() string { + return TypeSuggestedPostStateApproved +} + +func (*SuggestedPostStateApproved) SuggestedPostStateType() string { + return TypeSuggestedPostStateApproved +} + +// The post was declined +type SuggestedPostStateDeclined struct{ + meta +} + +func (entity *SuggestedPostStateDeclined) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStateDeclined + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStateDeclined) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStateDeclined) GetType() string { + return TypeSuggestedPostStateDeclined +} + +func (*SuggestedPostStateDeclined) SuggestedPostStateType() string { + return TypeSuggestedPostStateDeclined +} + +// Contains information about a suggested post. If the post can be approved or declined, then changes to the post can be also suggested. Use sendMessage with reply to the message and suggested post information to suggest message changes. Use addOffer to suggest price or time changes +type SuggestedPostInfo struct { + meta + // Price of the suggested post; may be null if the post is non-paid + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published; 0 if the specific date isn't set yet + SendDate int32 `json:"send_date"` + // State of the post + State SuggestedPostState `json:"state"` + // True, if the suggested post can be approved by the current user using approveSuggestedPost; updates aren't sent when value of this field changes + CanBeApproved bool `json:"can_be_approved"` + // True, if the suggested post can be declined by the current user using declineSuggestedPost; updates aren't sent when value of this field changes + CanBeDeclined bool `json:"can_be_declined"` +} + +func (entity *SuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostInfo) GetClass() string { + return ClassSuggestedPostInfo +} + +func (*SuggestedPostInfo) GetType() string { + return TypeSuggestedPostInfo +} + +func (suggestedPostInfo *SuggestedPostInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + State json.RawMessage `json:"state"` + CanBeApproved bool `json:"can_be_approved"` + CanBeDeclined bool `json:"can_be_declined"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + suggestedPostInfo.SendDate = tmp.SendDate + suggestedPostInfo.CanBeApproved = tmp.CanBeApproved + suggestedPostInfo.CanBeDeclined = tmp.CanBeDeclined + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + suggestedPostInfo.Price = fieldPrice + + fieldState, _ := UnmarshalSuggestedPostState(tmp.State) + suggestedPostInfo.State = fieldState + + return nil +} + +// Contains information about a post to suggest +type InputSuggestedPostInfo struct { + meta + // Price of the suggested post; pass null to suggest a post without payment. If the current user isn't an administrator of the channel direct messages chat and has no enough funds to pay for the post, then the error "BALANCE_TOO_LOW" will be returned immediately + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date isn't restricted. If specified, then the date must be getOption("suggested_post_send_delay_min")-getOption("suggested_post_send_delay_max") seconds in the future + SendDate int32 `json:"send_date"` +} + +func (entity *InputSuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputSuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*InputSuggestedPostInfo) GetClass() string { + return ClassInputSuggestedPostInfo +} + +func (*InputSuggestedPostInfo) GetType() string { + return TypeInputSuggestedPostInfo +} + +func (inputSuggestedPostInfo *InputSuggestedPostInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputSuggestedPostInfo.SendDate = tmp.SendDate + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + inputSuggestedPostInfo.Price = fieldPrice + + return nil +} + +// The post was refunded, because it was deleted by channel administrators in less than getOption("suggested_post_lifetime_min") seconds +type SuggestedPostRefundReasonPostDeleted struct{ + meta +} + +func (entity *SuggestedPostRefundReasonPostDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostRefundReasonPostDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostRefundReasonPostDeleted) GetClass() string { + return ClassSuggestedPostRefundReason +} + +func (*SuggestedPostRefundReasonPostDeleted) GetType() string { + return TypeSuggestedPostRefundReasonPostDeleted +} + +func (*SuggestedPostRefundReasonPostDeleted) SuggestedPostRefundReasonType() string { + return TypeSuggestedPostRefundReasonPostDeleted +} + +// The post was refunded, because the payment for the post was refunded +type SuggestedPostRefundReasonPaymentRefunded struct{ + meta +} + +func (entity *SuggestedPostRefundReasonPaymentRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostRefundReasonPaymentRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostRefundReasonPaymentRefunded) GetClass() string { + return ClassSuggestedPostRefundReason +} + +func (*SuggestedPostRefundReasonPaymentRefunded) GetType() string { + return TypeSuggestedPostRefundReasonPaymentRefunded +} + +func (*SuggestedPostRefundReasonPaymentRefunded) SuggestedPostRefundReasonType() string { + return TypeSuggestedPostRefundReasonPaymentRefunded +} + // Describes a possibly non-integer amount of Telegram Stars type StarAmount struct { meta @@ -8897,6 +9244,85 @@ func (*GiftSettings) GetType() string { return TypeGiftSettings } +// The gift was obtained by upgrading of a previously received gift +type UpgradedGiftOriginUpgrade struct { + meta + // Identifier of the message with the regular gift that was upgraded; can be 0 or an identifier of a deleted message + GiftMessageId int64 `json:"gift_message_id"` +} + +func (entity *UpgradedGiftOriginUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginUpgrade) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginUpgrade) GetType() string { + return TypeUpgradedGiftOriginUpgrade +} + +func (*UpgradedGiftOriginUpgrade) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginUpgrade +} + +// The gift was transferred from another owner +type UpgradedGiftOriginTransfer struct{ + meta +} + +func (entity *UpgradedGiftOriginTransfer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginTransfer + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginTransfer) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginTransfer) GetType() string { + return TypeUpgradedGiftOriginTransfer +} + +func (*UpgradedGiftOriginTransfer) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginTransfer +} + +// The gift was bought from another user +type UpgradedGiftOriginResale struct { + meta + // Number of Telegram Stars that were paid by the sender for the gift + StarCount int64 `json:"star_count"` +} + +func (entity *UpgradedGiftOriginResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginResale + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginResale) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginResale) GetType() string { + return TypeUpgradedGiftOriginResale +} + +func (*UpgradedGiftOriginResale) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginResale +} + // Describes a model of an upgraded gift type UpgradedGiftModel struct { meta @@ -9068,6 +9494,8 @@ type Gift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` + // Identifier of the chat that published the gift; 0 if none + PublisherChatId int64 `json:"publisher_chat_id"` // The sticker representing the gift Sticker *Sticker `json:"sticker"` // Number of Telegram Stars that must be paid for the gift @@ -9109,6 +9537,8 @@ type UpgradedGift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` + // Identifier of the chat that published the gift; 0 if none + PublisherChatId int64 `json:"publisher_chat_id"` // The title of the upgraded gift Title string `json:"title"` // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift @@ -9158,6 +9588,7 @@ func (*UpgradedGift) GetType() string { func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { var tmp struct { Id JsonInt64 `json:"id"` + PublisherChatId int64 `json:"publisher_chat_id"` Title string `json:"title"` Name string `json:"name"` Number int32 `json:"number"` @@ -9180,6 +9611,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { } upgradedGift.Id = tmp.Id + upgradedGift.PublisherChatId = tmp.PublisherChatId upgradedGift.Title = tmp.Title upgradedGift.Name = tmp.Name upgradedGift.Number = tmp.Number @@ -9794,54 +10226,54 @@ func (*GiftUpgradePreview) GetType() string { return TypeGiftUpgradePreview } -// The transaction is incoming and increases the number of owned Telegram Stars -type StarTransactionDirectionIncoming struct{ +// The transaction is incoming and increases the amount of owned currency +type TransactionDirectionIncoming struct{ meta } -func (entity *StarTransactionDirectionIncoming) MarshalJSON() ([]byte, error) { +func (entity *TransactionDirectionIncoming) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionDirectionIncoming + type stub TransactionDirectionIncoming return json.Marshal((*stub)(entity)) } -func (*StarTransactionDirectionIncoming) GetClass() string { - return ClassStarTransactionDirection +func (*TransactionDirectionIncoming) GetClass() string { + return ClassTransactionDirection } -func (*StarTransactionDirectionIncoming) GetType() string { - return TypeStarTransactionDirectionIncoming +func (*TransactionDirectionIncoming) GetType() string { + return TypeTransactionDirectionIncoming } -func (*StarTransactionDirectionIncoming) StarTransactionDirectionType() string { - return TypeStarTransactionDirectionIncoming +func (*TransactionDirectionIncoming) TransactionDirectionType() string { + return TypeTransactionDirectionIncoming } -// The transaction is outgoing and decreases the number of owned Telegram Stars -type StarTransactionDirectionOutgoing struct{ +// The transaction is outgoing and decreases the amount of owned currency +type TransactionDirectionOutgoing struct{ meta } -func (entity *StarTransactionDirectionOutgoing) MarshalJSON() ([]byte, error) { +func (entity *TransactionDirectionOutgoing) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionDirectionOutgoing + type stub TransactionDirectionOutgoing return json.Marshal((*stub)(entity)) } -func (*StarTransactionDirectionOutgoing) GetClass() string { - return ClassStarTransactionDirection +func (*TransactionDirectionOutgoing) GetClass() string { + return ClassTransactionDirection } -func (*StarTransactionDirectionOutgoing) GetType() string { - return TypeStarTransactionDirectionOutgoing +func (*TransactionDirectionOutgoing) GetType() string { + return TypeTransactionDirectionOutgoing } -func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { - return TypeStarTransactionDirectionOutgoing +func (*TransactionDirectionOutgoing) TransactionDirectionType() string { + return TypeTransactionDirectionOutgoing } // The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only @@ -10877,6 +11309,60 @@ func (starTransactionTypePaidMessageReceive *StarTransactionTypePaidMessageRecei return nil } +// The transaction is a payment for a suggested post; for regular users only +type StarTransactionTypeSuggestedPostPaymentSend struct { + meta + // Identifier of the channel chat that posted the post + ChatId int64 `json:"chat_id"` +} + +func (entity *StarTransactionTypeSuggestedPostPaymentSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeSuggestedPostPaymentSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) GetType() string { + return TypeStarTransactionTypeSuggestedPostPaymentSend +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) StarTransactionTypeType() string { + return TypeStarTransactionTypeSuggestedPostPaymentSend +} + +// The transaction is a receiving of a payment for a suggested post by the channel chat; for channel chats only +type StarTransactionTypeSuggestedPostPaymentReceive struct { + meta + // Identifier of the user that paid for the suggested post + UserId int64 `json:"user_id"` +} + +func (entity *StarTransactionTypeSuggestedPostPaymentReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeSuggestedPostPaymentReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) GetType() string { + return TypeStarTransactionTypeSuggestedPostPaymentReceive +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypeSuggestedPostPaymentReceive +} + // The transaction is a purchase of Telegram Premium subscription; for regular users and bots only type StarTransactionTypePremiumPurchase struct { meta @@ -11070,6 +11556,170 @@ func (*StarTransactions) GetType() string { return TypeStarTransactions } +// The transaction is a deposit of Toncoins from Fragment +type TonTransactionTypeFragmentDeposit struct { + meta + // True, if the transaction is a gift from another user + IsGift bool `json:"is_gift"` + // The sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *TonTransactionTypeFragmentDeposit) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeFragmentDeposit + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeFragmentDeposit) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeFragmentDeposit) GetType() string { + return TypeTonTransactionTypeFragmentDeposit +} + +func (*TonTransactionTypeFragmentDeposit) TonTransactionTypeType() string { + return TypeTonTransactionTypeFragmentDeposit +} + +// The transaction is a payment for a suggested post +type TonTransactionTypeSuggestedPostPayment struct { + meta + // Identifier of the channel chat that posted the post + ChatId int64 `json:"chat_id"` +} + +func (entity *TonTransactionTypeSuggestedPostPayment) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeSuggestedPostPayment + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeSuggestedPostPayment) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeSuggestedPostPayment) GetType() string { + return TypeTonTransactionTypeSuggestedPostPayment +} + +func (*TonTransactionTypeSuggestedPostPayment) TonTransactionTypeType() string { + return TypeTonTransactionTypeSuggestedPostPayment +} + +// The transaction is a transaction of an unsupported type +type TonTransactionTypeUnsupported struct{ + meta +} + +func (entity *TonTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUnsupported) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUnsupported) GetType() string { + return TypeTonTransactionTypeUnsupported +} + +func (*TonTransactionTypeUnsupported) TonTransactionTypeType() string { + return TypeTonTransactionTypeUnsupported +} + +// Represents a transaction changing the amount of owned Toncoins +type TonTransaction struct { + meta + // Unique identifier of the transaction + Id string `json:"id"` + // The amount of added owned Toncoins; negative for outgoing transactions + TonAmount int64 `json:"ton_amount"` + // True, if the transaction is a refund of a previous transaction + IsRefund bool `json:"is_refund"` + // Point in time (Unix timestamp) when the transaction was completed + Date int32 `json:"date"` + // Type of the transaction + Type TonTransactionType `json:"type"` +} + +func (entity *TonTransaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransaction + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransaction) GetClass() string { + return ClassTonTransaction +} + +func (*TonTransaction) GetType() string { + return TypeTonTransaction +} + +func (tonTransaction *TonTransaction) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + TonAmount int64 `json:"ton_amount"` + IsRefund bool `json:"is_refund"` + Date int32 `json:"date"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + tonTransaction.Id = tmp.Id + tonTransaction.TonAmount = tmp.TonAmount + tonTransaction.IsRefund = tmp.IsRefund + tonTransaction.Date = tmp.Date + + fieldType, _ := UnmarshalTonTransactionType(tmp.Type) + tonTransaction.Type = fieldType + + return nil +} + +// Represents a list of Toncoin transactions +type TonTransactions struct { + meta + // The total amount of owned Toncoins + TonAmount int64 `json:"ton_amount"` + // List of Toncoin transactions + Transactions []*TonTransaction `json:"transactions"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *TonTransactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactions + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactions) GetClass() string { + return ClassTonTransactions +} + +func (*TonTransactions) GetType() string { + return TypeTonTransactions +} + // The user is eligible for the giveaway type GiveawayParticipantStatusEligible struct{ meta @@ -13335,7 +13985,7 @@ type Supergroup struct { SignMessages bool `json:"sign_messages"` // True, if messages sent to the channel have information about the sender user. This field is only applicable to channels ShowMessageSender bool `json:"show_message_sender"` - // True, if users need to join the supergroup before they can send messages. Always true for channels and non-discussion supergroups + // True, if users need to join the supergroup before they can send messages. May be false only for discussion supergroups and channel direct messages groups JoinToSendMessages bool `json:"join_to_send_messages"` // True, if all users directly joining the supergroup need to be approved by supergroup administrators. Always false for channels and supergroups without username, location, or a linked chat JoinByRequest bool `json:"join_by_request"` @@ -15037,6 +15687,8 @@ type MessageReplyToMessage struct { MessageId int64 `json:"message_id"` // Chosen quote from the replied message; may be null if none Quote *TextQuote `json:"quote"` + // Identifier of the checklist task in the original message that was replied; 0 if none + ChecklistTaskId int32 `json:"checklist_task_id"` // Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat @@ -15070,6 +15722,7 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e ChatId int64 `json:"chat_id"` MessageId int64 `json:"message_id"` Quote *TextQuote `json:"quote"` + ChecklistTaskId int32 `json:"checklist_task_id"` Origin json.RawMessage `json:"origin"` OriginSendDate int32 `json:"origin_send_date"` Content json.RawMessage `json:"content"` @@ -15083,6 +15736,7 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e messageReplyToMessage.ChatId = tmp.ChatId messageReplyToMessage.MessageId = tmp.MessageId messageReplyToMessage.Quote = tmp.Quote + messageReplyToMessage.ChecklistTaskId = tmp.ChecklistTaskId messageReplyToMessage.OriginSendDate = tmp.OriginSendDate fieldOrigin, _ := UnmarshalMessageOrigin(tmp.Origin) @@ -15130,6 +15784,8 @@ type InputMessageReplyToMessage struct { MessageId int64 `json:"message_id"` // Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats Quote *InputTextQuote `json:"quote"` + // Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message + ChecklistTaskId int32 `json:"checklist_task_id"` } func (entity *InputMessageReplyToMessage) MarshalJSON() ([]byte, error) { @@ -15161,6 +15817,8 @@ type InputMessageReplyToExternalMessage struct { MessageId int64 `json:"message_id"` // Quote from the message to be replied; pass null if none Quote *InputTextQuote `json:"quote"` + // Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message + ChecklistTaskId int32 `json:"checklist_task_id"` } func (entity *InputMessageReplyToExternalMessage) MarshalJSON() ([]byte, error) { @@ -15262,6 +15920,10 @@ type Message struct { HasTimestampedMedia bool `json:"has_timestamped_media"` // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts IsChannelPost bool `json:"is_channel_post"` + // True, if the message is a suggested channel post which was paid in Telegram Stars; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending + IsPaidStarSuggestedPost bool `json:"is_paid_star_suggested_post"` + // True, if the message is a suggested channel post which was paid in Toncoins; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending + IsPaidTonSuggestedPost bool `json:"is_paid_ton_suggested_post"` // True, if the message contains an unread mention for the current user ContainsUnreadMention bool `json:"contains_unread_mention"` // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages @@ -15278,6 +15940,8 @@ type Message struct { UnreadReactions []*UnreadReaction `json:"unread_reactions"` // Information about fact-check added to the message; may be null if none FactCheck *FactCheck `json:"fact_check"` + // Information about the suggested post; may be null if the message isn't a suggested post + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` // Information about the message or the story this message is replying to; may be null if none ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs @@ -15343,6 +16007,8 @@ func (message *Message) UnmarshalJSON(data []byte) error { CanBeSaved bool `json:"can_be_saved"` HasTimestampedMedia bool `json:"has_timestamped_media"` IsChannelPost bool `json:"is_channel_post"` + IsPaidStarSuggestedPost bool `json:"is_paid_star_suggested_post"` + IsPaidTonSuggestedPost bool `json:"is_paid_ton_suggested_post"` ContainsUnreadMention bool `json:"contains_unread_mention"` Date int32 `json:"date"` EditDate int32 `json:"edit_date"` @@ -15351,6 +16017,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { InteractionInfo *MessageInteractionInfo `json:"interaction_info"` UnreadReactions []*UnreadReaction `json:"unread_reactions"` FactCheck *FactCheck `json:"fact_check"` + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` TopicId json.RawMessage `json:"topic_id"` @@ -15383,6 +16050,8 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.CanBeSaved = tmp.CanBeSaved message.HasTimestampedMedia = tmp.HasTimestampedMedia message.IsChannelPost = tmp.IsChannelPost + message.IsPaidStarSuggestedPost = tmp.IsPaidStarSuggestedPost + message.IsPaidTonSuggestedPost = tmp.IsPaidTonSuggestedPost message.ContainsUnreadMention = tmp.ContainsUnreadMention message.Date = tmp.Date message.EditDate = tmp.EditDate @@ -15391,6 +16060,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.InteractionInfo = tmp.InteractionInfo message.UnreadReactions = tmp.UnreadReactions message.FactCheck = tmp.FactCheck + message.SuggestedPostInfo = tmp.SuggestedPostInfo message.MessageThreadId = tmp.MessageThreadId message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn @@ -16122,9 +16792,9 @@ type VideoMessageAdvertisement struct { UniqueId int64 `json:"unique_id"` // Text of the advertisement Text string `json:"text"` - // The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds + // The minimum amount of time the advertisement must be displayed before it can be hidden by the user, in seconds MinDisplayDuration int32 `json:"min_display_duration"` - // The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds + // The maximum amount of time the advertisement must be displayed before it must be automatically hidden, in seconds MaxDisplayDuration int32 `json:"max_display_duration"` // True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement CanBeReported bool `json:"can_be_reported"` @@ -16725,6 +17395,8 @@ type DraftMessage struct { InputMessageText InputMessageContent `json:"input_message_text"` // Identifier of the effect to apply to the message when it is sent; 0 if none EffectId JsonInt64 `json:"effect_id"` + // Information about the suggested post; may be null if none + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` } func (entity *DraftMessage) MarshalJSON() ([]byte, error) { @@ -16749,6 +17421,7 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { Date int32 `json:"date"` InputMessageText json.RawMessage `json:"input_message_text"` EffectId JsonInt64 `json:"effect_id"` + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` } err := json.Unmarshal(data, &tmp) @@ -16758,6 +17431,7 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { draftMessage.Date = tmp.Date draftMessage.EffectId = tmp.EffectId + draftMessage.SuggestedPostInfo = tmp.SuggestedPostInfo fieldReplyTo, _ := UnmarshalInputMessageReplyTo(tmp.ReplyTo) draftMessage.ReplyTo = fieldReplyTo @@ -17636,7 +18310,7 @@ type Chat struct { LastMessage *Message `json:"last_message"` // Positions of the chat in chat lists Positions []*ChatPosition `json:"positions"` - // Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even it doesn't belong to the chat list and have no position in a chat list even it belongs to the chat list + // Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even if it doesn't belong to the chat list and have no position in a chat list even if it belongs to the chat list ChatLists []ChatList `json:"chat_lists"` // Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender MessageSenderId MessageSender `json:"message_sender_id"` @@ -19520,7 +20194,7 @@ type ForumTopicInfo struct { IsGeneral bool `json:"is_general"` // True, if the topic was created by the current user IsOutgoing bool `json:"is_outgoing"` - // True, if the topic is closed + // True, if the topic is closed. If the topic is closed, then the user must have can_manage_topics administrator right in the supergroup or must be the creator of the topic to send messages there IsClosed bool `json:"is_closed"` // True, if the topic is hidden above the topic list and closed; for General topic only IsHidden bool `json:"is_hidden"` @@ -23064,6 +23738,8 @@ type LinkPreviewTypeVideoChat struct { Photo *ChatPhoto `json:"photo"` // True, if the video chat is expected to be a live stream in a channel or a broadcast group IsLiveStream bool `json:"is_live_stream"` + // True, if the user can use the link to join the video chat without being muted by administrators + JoinsAsSpeaker bool `json:"joins_as_speaker"` } func (entity *LinkPreviewTypeVideoChat) MarshalJSON() ([]byte, error) { @@ -24482,7 +25158,7 @@ func (*PaidMediaUnsupported) PaidMediaType() string { // Describes parameters of a giveaway type GiveawayParameters struct { meta - // Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, or for the specified time. If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup + // Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, or for the specified time. If the chat is a channel, then can_post_messages administrator right is required in the channel, otherwise, the user must be an administrator in the supergroup BoostedChatId int64 `json:"boosted_chat_id"` // Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats AdditionalChatIds []int64 `json:"additional_chat_ids"` @@ -28884,6 +29560,41 @@ func (*MessageGiftedStars) MessageContentType() string { return TypeMessageGiftedStars } +// Toncoins were gifted to a user +type MessageGiftedTon struct { + meta + // The identifier of a user that gifted Toncoins; 0 if the gift was anonymous or is outgoing + GifterUserId int64 `json:"gifter_user_id"` + // The identifier of a user that received Toncoins; 0 if the gift is incoming + ReceiverUserId int64 `json:"receiver_user_id"` + // The received amount of Toncoins, in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` + // Identifier of the transaction for Toncoin credit; for receiver only + TransactionId string `json:"transaction_id"` + // A sticker to be shown in the message; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageGiftedTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGiftedTon + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGiftedTon) GetClass() string { + return ClassMessageContent +} + +func (*MessageGiftedTon) GetType() string { + return TypeMessageGiftedTon +} + +func (*MessageGiftedTon) MessageContentType() string { + return TypeMessageGiftedTon +} + // A Telegram Stars were received by the current user from a giveaway type MessageGiveawayPrizeStars struct { meta @@ -29028,18 +29739,16 @@ type MessageUpgradedGift struct { SenderId MessageSender `json:"sender_id"` // Receiver of the gift ReceiverId MessageSender `json:"receiver_id"` + // Origin of the upgraded gift + Origin UpgradedGiftOrigin `json:"origin"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift - IsUpgrade bool `json:"is_upgrade"` // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` // True, if the gift can be transferred to another owner; only for the receiver of the gift CanBeTransferred bool `json:"can_be_transferred"` - // True, if the gift was transferred to another owner; only for the receiver of the gift + // True, if the gift has already been transferred to another owner; only for the receiver of the gift WasTransferred bool `json:"was_transferred"` - // Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred - LastResaleStarCount int64 `json:"last_resale_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift @@ -29075,12 +29784,11 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error Gift *UpgradedGift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` ReceiverId json.RawMessage `json:"receiver_id"` + Origin json.RawMessage `json:"origin"` ReceivedGiftId string `json:"received_gift_id"` - IsUpgrade bool `json:"is_upgrade"` IsSaved bool `json:"is_saved"` CanBeTransferred bool `json:"can_be_transferred"` WasTransferred bool `json:"was_transferred"` - LastResaleStarCount int64 `json:"last_resale_star_count"` TransferStarCount int64 `json:"transfer_star_count"` NextTransferDate int32 `json:"next_transfer_date"` NextResaleDate int32 `json:"next_resale_date"` @@ -29094,11 +29802,9 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error messageUpgradedGift.Gift = tmp.Gift messageUpgradedGift.ReceivedGiftId = tmp.ReceivedGiftId - messageUpgradedGift.IsUpgrade = tmp.IsUpgrade messageUpgradedGift.IsSaved = tmp.IsSaved messageUpgradedGift.CanBeTransferred = tmp.CanBeTransferred messageUpgradedGift.WasTransferred = tmp.WasTransferred - messageUpgradedGift.LastResaleStarCount = tmp.LastResaleStarCount messageUpgradedGift.TransferStarCount = tmp.TransferStarCount messageUpgradedGift.NextTransferDate = tmp.NextTransferDate messageUpgradedGift.NextResaleDate = tmp.NextResaleDate @@ -29110,6 +29816,9 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) messageUpgradedGift.ReceiverId = fieldReceiverId + fieldOrigin, _ := UnmarshalUpgradedGiftOrigin(tmp.Origin) + messageUpgradedGift.Origin = fieldOrigin + return nil } @@ -29316,6 +30025,214 @@ func (*MessageChecklistTasksAdded) MessageContentType() string { return TypeMessageChecklistTasksAdded } +// Approval of suggested post has failed, because the user which proposed the post had no enough funds +type MessageSuggestedPostApprovalFailed struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Price of the suggested post + Price SuggestedPostPrice `json:"price"` +} + +func (entity *MessageSuggestedPostApprovalFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostApprovalFailed + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostApprovalFailed) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostApprovalFailed) GetType() string { + return TypeMessageSuggestedPostApprovalFailed +} + +func (*MessageSuggestedPostApprovalFailed) MessageContentType() string { + return TypeMessageSuggestedPostApprovalFailed +} + +func (messageSuggestedPostApprovalFailed *MessageSuggestedPostApprovalFailed) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostApprovalFailed.SuggestedPostMessageId = tmp.SuggestedPostMessageId + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + messageSuggestedPostApprovalFailed.Price = fieldPrice + + return nil +} + +// A suggested post was approved +type MessageSuggestedPostApproved struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Price of the suggested post; may be null if the post is non-paid + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published + SendDate int32 `json:"send_date"` +} + +func (entity *MessageSuggestedPostApproved) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostApproved + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostApproved) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostApproved) GetType() string { + return TypeMessageSuggestedPostApproved +} + +func (*MessageSuggestedPostApproved) MessageContentType() string { + return TypeMessageSuggestedPostApproved +} + +func (messageSuggestedPostApproved *MessageSuggestedPostApproved) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostApproved.SuggestedPostMessageId = tmp.SuggestedPostMessageId + messageSuggestedPostApproved.SendDate = tmp.SendDate + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + messageSuggestedPostApproved.Price = fieldPrice + + return nil +} + +// A suggested post was declined +type MessageSuggestedPostDeclined struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Comment added by administrator of the channel when the post was declined + Comment string `json:"comment"` +} + +func (entity *MessageSuggestedPostDeclined) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostDeclined + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostDeclined) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostDeclined) GetType() string { + return TypeMessageSuggestedPostDeclined +} + +func (*MessageSuggestedPostDeclined) MessageContentType() string { + return TypeMessageSuggestedPostDeclined +} + +// A suggested post was published for getOption("suggested_post_lifetime_min") seconds and payment for the post was received +type MessageSuggestedPostPaid struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // The amount of received Telegram Stars + StarAmount *StarAmount `json:"star_amount"` + // The amount of received Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` +} + +func (entity *MessageSuggestedPostPaid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostPaid + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostPaid) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostPaid) GetType() string { + return TypeMessageSuggestedPostPaid +} + +func (*MessageSuggestedPostPaid) MessageContentType() string { + return TypeMessageSuggestedPostPaid +} + +// A suggested post was refunded +type MessageSuggestedPostRefunded struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Reason of the refund + Reason SuggestedPostRefundReason `json:"reason"` +} + +func (entity *MessageSuggestedPostRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostRefunded) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostRefunded) GetType() string { + return TypeMessageSuggestedPostRefunded +} + +func (*MessageSuggestedPostRefunded) MessageContentType() string { + return TypeMessageSuggestedPostRefunded +} + +func (messageSuggestedPostRefunded *MessageSuggestedPostRefunded) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Reason json.RawMessage `json:"reason"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostRefunded.SuggestedPostMessageId = tmp.SuggestedPostMessageId + + fieldReason, _ := UnmarshalSuggestedPostRefundReason(tmp.Reason) + messageSuggestedPostRefunded.Reason = fieldReason + + return nil +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -30536,6 +31453,8 @@ type MessageSendOptions struct { meta // Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` + // Information about the suggested post; pass null if none. For messages to channel direct messages chat only. Applicable only to sendMessage and addOffer + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` // Pass true to disable notification for the message DisableNotification bool `json:"disable_notification"` // Pass true if the message is sent from the background @@ -30577,6 +31496,7 @@ func (*MessageSendOptions) GetType() string { func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { var tmp struct { DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` DisableNotification bool `json:"disable_notification"` FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` @@ -30595,6 +31515,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { } messageSendOptions.DirectMessagesChatTopicId = tmp.DirectMessagesChatTopicId + messageSendOptions.SuggestedPostInfo = tmp.SuggestedPostInfo messageSendOptions.DisableNotification = tmp.DisableNotification messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent @@ -31620,12 +32541,18 @@ func (*InputMessageForwarded) InputMessageContentType() string { // Contains properties of a message and describes actions that can be done with the message right now type MessageProperties struct { meta + // True, if an offer can be added to the message using addOffer + CanAddOffer bool `json:"can_add_offer"` // True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription CanAddTasks bool `json:"can_add_tasks"` + // True, if the message is a suggested post that can be approved by the user using approveSuggestedPost + CanBeApproved bool `json:"can_be_approved"` // True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options CanBeCopied bool `json:"can_be_copied"` // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options CanBeCopiedToSecretChat bool `json:"can_be_copied_to_secret_chat"` + // True, if the message is a suggested post that can be declined by the user using declineSuggestedPost + CanBeDeclined bool `json:"can_be_declined"` // True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` // True, if the message can be deleted for all users using the method deleteMessages with revoke == true @@ -31650,6 +32577,8 @@ type MessageProperties struct { CanEditMedia bool `json:"can_edit_media"` // True, if scheduling state of the message can be edited CanEditSchedulingState bool `json:"can_edit_scheduling_state"` + // True, if another price or post send time can be suggested using addOffer + CanEditSuggestedPostInfo bool `json:"can_edit_suggested_post_info"` // True, if author of the message sent on behalf of a chat can be received through getMessageAuthor CanGetAuthor bool `json:"can_get_author"` // True, if code for message embedding can be received using getMessageEmbeddingCode @@ -42854,7 +43783,7 @@ func (*PremiumFeatureMessagePrivacy) PremiumFeatureType() string { return TypePremiumFeatureMessagePrivacy } -// The ability to view last seen and read times of other users even they can't view last seen or read time for the current user +// The ability to view last seen and read times of other users even if they can't view last seen or read time for the current user type PremiumFeatureLastSeenTimes struct{ meta } @@ -50661,6 +51590,31 @@ func (*InternalLinkTypeMyStars) InternalLinkTypeType() string { return TypeInternalLinkTypeMyStars } +// The link is a link to the screen with information about Toncoin balance and transactions of the current user +type InternalLinkTypeMyToncoins struct{ + meta +} + +func (entity *InternalLinkTypeMyToncoins) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeMyToncoins + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeMyToncoins) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeMyToncoins) GetType() string { + return TypeInternalLinkTypeMyToncoins +} + +func (*InternalLinkTypeMyToncoins) InternalLinkTypeType() string { + return TypeInternalLinkTypeMyToncoins +} + // The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it type InternalLinkTypePassportDataRequest struct { meta @@ -54970,8 +55924,33 @@ func (*RevenueWithdrawalStateFailed) RevenueWithdrawalStateType() string { return TypeRevenueWithdrawalStateFailed } +// Describes an unsupported transaction +type ChatRevenueTransactionTypeUnsupported struct{ + meta +} + +func (entity *ChatRevenueTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeUnsupported) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeUnsupported) GetType() string { + return TypeChatRevenueTransactionTypeUnsupported +} + +func (*ChatRevenueTransactionTypeUnsupported) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeUnsupported +} + // Describes earnings from sponsored messages in a chat in some time frame -type ChatRevenueTransactionTypeEarnings struct { +type ChatRevenueTransactionTypeSponsoredMessageEarnings struct { meta // Point in time (Unix timestamp) when the earnings started StartDate int32 `json:"start_date"` @@ -54979,61 +55958,85 @@ type ChatRevenueTransactionTypeEarnings struct { EndDate int32 `json:"end_date"` } -func (entity *ChatRevenueTransactionTypeEarnings) MarshalJSON() ([]byte, error) { +func (entity *ChatRevenueTransactionTypeSponsoredMessageEarnings) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueTransactionTypeEarnings + type stub ChatRevenueTransactionTypeSponsoredMessageEarnings return json.Marshal((*stub)(entity)) } -func (*ChatRevenueTransactionTypeEarnings) GetClass() string { +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) GetClass() string { return ClassChatRevenueTransactionType } -func (*ChatRevenueTransactionTypeEarnings) GetType() string { - return TypeChatRevenueTransactionTypeEarnings +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) GetType() string { + return TypeChatRevenueTransactionTypeSponsoredMessageEarnings } -func (*ChatRevenueTransactionTypeEarnings) ChatRevenueTransactionTypeType() string { - return TypeChatRevenueTransactionTypeEarnings +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeSponsoredMessageEarnings } -// Describes a withdrawal of earnings -type ChatRevenueTransactionTypeWithdrawal struct { +// Describes earnings from a published suggested post +type ChatRevenueTransactionTypeSuggestedPostEarnings struct { + meta + // Identifier of the user that paid for the suggested post + UserId int64 `json:"user_id"` +} + +func (entity *ChatRevenueTransactionTypeSuggestedPostEarnings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeSuggestedPostEarnings + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) GetType() string { + return TypeChatRevenueTransactionTypeSuggestedPostEarnings +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeSuggestedPostEarnings +} + +// Describes a withdrawal of earnings through Fragment +type ChatRevenueTransactionTypeFragmentWithdrawal struct { meta // Point in time (Unix timestamp) when the earnings withdrawal started WithdrawalDate int32 `json:"withdrawal_date"` - // Name of the payment provider - Provider string `json:"provider"` // State of the withdrawal State RevenueWithdrawalState `json:"state"` } -func (entity *ChatRevenueTransactionTypeWithdrawal) MarshalJSON() ([]byte, error) { +func (entity *ChatRevenueTransactionTypeFragmentWithdrawal) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueTransactionTypeWithdrawal + type stub ChatRevenueTransactionTypeFragmentWithdrawal return json.Marshal((*stub)(entity)) } -func (*ChatRevenueTransactionTypeWithdrawal) GetClass() string { +func (*ChatRevenueTransactionTypeFragmentWithdrawal) GetClass() string { return ClassChatRevenueTransactionType } -func (*ChatRevenueTransactionTypeWithdrawal) GetType() string { - return TypeChatRevenueTransactionTypeWithdrawal +func (*ChatRevenueTransactionTypeFragmentWithdrawal) GetType() string { + return TypeChatRevenueTransactionTypeFragmentWithdrawal } -func (*ChatRevenueTransactionTypeWithdrawal) ChatRevenueTransactionTypeType() string { - return TypeChatRevenueTransactionTypeWithdrawal +func (*ChatRevenueTransactionTypeFragmentWithdrawal) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeFragmentWithdrawal } -func (chatRevenueTransactionTypeWithdrawal *ChatRevenueTransactionTypeWithdrawal) UnmarshalJSON(data []byte) error { +func (chatRevenueTransactionTypeFragmentWithdrawal *ChatRevenueTransactionTypeFragmentWithdrawal) UnmarshalJSON(data []byte) error { var tmp struct { WithdrawalDate int32 `json:"withdrawal_date"` - Provider string `json:"provider"` State json.RawMessage `json:"state"` } @@ -55042,42 +56045,39 @@ func (chatRevenueTransactionTypeWithdrawal *ChatRevenueTransactionTypeWithdrawal return err } - chatRevenueTransactionTypeWithdrawal.WithdrawalDate = tmp.WithdrawalDate - chatRevenueTransactionTypeWithdrawal.Provider = tmp.Provider + chatRevenueTransactionTypeFragmentWithdrawal.WithdrawalDate = tmp.WithdrawalDate fieldState, _ := UnmarshalRevenueWithdrawalState(tmp.State) - chatRevenueTransactionTypeWithdrawal.State = fieldState + chatRevenueTransactionTypeFragmentWithdrawal.State = fieldState return nil } -// Describes a refund for failed withdrawal of earnings -type ChatRevenueTransactionTypeRefund struct { +// Describes a refund for failed withdrawal of earnings through Fragment +type ChatRevenueTransactionTypeFragmentRefund struct { meta // Point in time (Unix timestamp) when the transaction was refunded RefundDate int32 `json:"refund_date"` - // Name of the payment provider - Provider string `json:"provider"` } -func (entity *ChatRevenueTransactionTypeRefund) MarshalJSON() ([]byte, error) { +func (entity *ChatRevenueTransactionTypeFragmentRefund) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueTransactionTypeRefund + type stub ChatRevenueTransactionTypeFragmentRefund return json.Marshal((*stub)(entity)) } -func (*ChatRevenueTransactionTypeRefund) GetClass() string { +func (*ChatRevenueTransactionTypeFragmentRefund) GetClass() string { return ClassChatRevenueTransactionType } -func (*ChatRevenueTransactionTypeRefund) GetType() string { - return TypeChatRevenueTransactionTypeRefund +func (*ChatRevenueTransactionTypeFragmentRefund) GetType() string { + return TypeChatRevenueTransactionTypeFragmentRefund } -func (*ChatRevenueTransactionTypeRefund) ChatRevenueTransactionTypeType() string { - return TypeChatRevenueTransactionTypeRefund +func (*ChatRevenueTransactionTypeFragmentRefund) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeFragmentRefund } // Contains a chat revenue transactions @@ -55131,10 +56131,12 @@ func (chatRevenueTransaction *ChatRevenueTransaction) UnmarshalJSON(data []byte) // Contains a list of chat revenue transactions type ChatRevenueTransactions struct { meta - // Total number of transactions - TotalCount int32 `json:"total_count"` + // The amount of owned Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` // List of transactions Transactions []*ChatRevenueTransaction `json:"transactions"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` } func (entity *ChatRevenueTransactions) MarshalJSON() ([]byte, error) { @@ -56028,6 +57030,37 @@ func (*UpdateMessageFactCheck) UpdateType() string { return TypeUpdateMessageFactCheck } +// Information about suggested post of a message was changed +type UpdateMessageSuggestedPostInfo struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // The new information about the suggested post + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` +} + +func (entity *UpdateMessageSuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageSuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageSuggestedPostInfo) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageSuggestedPostInfo) GetType() string { + return TypeUpdateMessageSuggestedPostInfo +} + +func (*UpdateMessageSuggestedPostInfo) UpdateType() string { + return TypeUpdateMessageSuggestedPostInfo +} + // 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 @@ -58511,7 +59544,7 @@ type UpdateGroupCallParticipants struct { meta // Identifier of the group call GroupCallId int32 `json:"group_call_id"` - // New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. The participants must be shown in the list of group call participants even there is no information about them + // New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. The participants must be shown in the list of group call participants even if there is no information about them ParticipantUserIds []JsonInt64 `json:"participant_user_ids"` } @@ -59837,6 +60870,33 @@ func (*UpdateOwnedStarCount) UpdateType() string { return TypeUpdateOwnedStarCount } +// The number of Toncoins owned by the current user has changed +type UpdateOwnedTonCount struct { + meta + // The new amount of owned Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` +} + +func (entity *UpdateOwnedTonCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateOwnedTonCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateOwnedTonCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateOwnedTonCount) GetType() string { + return TypeUpdateOwnedTonCount +} + +func (*UpdateOwnedTonCount) UpdateType() string { + return TypeUpdateOwnedTonCount +} + // The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions type UpdateChatRevenueAmount struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 5991657..829ea95 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -662,6 +662,111 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } +func UnmarshalSuggestedPostPrice(data json.RawMessage) (SuggestedPostPrice, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostPriceStar: + return UnmarshalSuggestedPostPriceStar(data) + + case TypeSuggestedPostPriceTon: + return UnmarshalSuggestedPostPriceTon(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostPrice(dataList []json.RawMessage) ([]SuggestedPostPrice, error) { + list := []SuggestedPostPrice{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostPrice(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSuggestedPostState(data json.RawMessage) (SuggestedPostState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostStatePending: + return UnmarshalSuggestedPostStatePending(data) + + case TypeSuggestedPostStateApproved: + return UnmarshalSuggestedPostStateApproved(data) + + case TypeSuggestedPostStateDeclined: + return UnmarshalSuggestedPostStateDeclined(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostState(dataList []json.RawMessage) ([]SuggestedPostState, error) { + list := []SuggestedPostState{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSuggestedPostRefundReason(data json.RawMessage) (SuggestedPostRefundReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostRefundReasonPostDeleted: + return UnmarshalSuggestedPostRefundReasonPostDeleted(data) + + case TypeSuggestedPostRefundReasonPaymentRefunded: + return UnmarshalSuggestedPostRefundReasonPaymentRefunded(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostRefundReason(dataList []json.RawMessage) ([]SuggestedPostRefundReason, error) { + list := []SuggestedPostRefundReason{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostRefundReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarSubscriptionType(data json.RawMessage) (StarSubscriptionType, error) { var meta meta @@ -770,6 +875,43 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalUpgradedGiftOrigin(data json.RawMessage) (UpgradedGiftOrigin, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUpgradedGiftOriginUpgrade: + return UnmarshalUpgradedGiftOriginUpgrade(data) + + case TypeUpgradedGiftOriginTransfer: + return UnmarshalUpgradedGiftOriginTransfer(data) + + case TypeUpgradedGiftOriginResale: + return UnmarshalUpgradedGiftOriginResale(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUpgradedGiftOrigin(dataList []json.RawMessage) ([]UpgradedGiftOrigin, error) { + list := []UpgradedGiftOrigin{} + + for _, data := range dataList { + entity, err := UnmarshalUpgradedGiftOrigin(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUpgradedGiftAttributeId(data json.RawMessage) (UpgradedGiftAttributeId, error) { var meta meta @@ -878,7 +1020,7 @@ func UnmarshalListOfSentGift(dataList []json.RawMessage) ([]SentGift, error) { return list, nil } -func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { +func UnmarshalTransactionDirection(data json.RawMessage) (TransactionDirection, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -887,22 +1029,22 @@ func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDir } switch meta.Type { - case TypeStarTransactionDirectionIncoming: - return UnmarshalStarTransactionDirectionIncoming(data) + case TypeTransactionDirectionIncoming: + return UnmarshalTransactionDirectionIncoming(data) - case TypeStarTransactionDirectionOutgoing: - return UnmarshalStarTransactionDirectionOutgoing(data) + case TypeTransactionDirectionOutgoing: + return UnmarshalTransactionDirectionOutgoing(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfStarTransactionDirection(dataList []json.RawMessage) ([]StarTransactionDirection, error) { - list := []StarTransactionDirection{} +func UnmarshalListOfTransactionDirection(dataList []json.RawMessage) ([]TransactionDirection, error) { + list := []TransactionDirection{} for _, data := range dataList { - entity, err := UnmarshalStarTransactionDirection(data) + entity, err := UnmarshalTransactionDirection(data) if err != nil { return nil, err } @@ -1011,6 +1153,12 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypePaidMessageReceive: return UnmarshalStarTransactionTypePaidMessageReceive(data) + case TypeStarTransactionTypeSuggestedPostPaymentSend: + return UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data) + + case TypeStarTransactionTypeSuggestedPostPaymentReceive: + return UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data) + case TypeStarTransactionTypePremiumPurchase: return UnmarshalStarTransactionTypePremiumPurchase(data) @@ -1042,6 +1190,43 @@ func UnmarshalListOfStarTransactionType(dataList []json.RawMessage) ([]StarTrans return list, nil } +func UnmarshalTonTransactionType(data json.RawMessage) (TonTransactionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTonTransactionTypeFragmentDeposit: + return UnmarshalTonTransactionTypeFragmentDeposit(data) + + case TypeTonTransactionTypeSuggestedPostPayment: + return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + + case TypeTonTransactionTypeUnsupported: + return UnmarshalTonTransactionTypeUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTonTransactionType(dataList []json.RawMessage) ([]TonTransactionType, error) { + list := []TonTransactionType{} + + for _, data := range dataList { + entity, err := UnmarshalTonTransactionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalGiveawayParticipantStatus(data json.RawMessage) (GiveawayParticipantStatus, error) { var meta meta @@ -3633,6 +3818,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageGiftedStars: return UnmarshalMessageGiftedStars(data) + case TypeMessageGiftedTon: + return UnmarshalMessageGiftedTon(data) + case TypeMessageGiveawayPrizeStars: return UnmarshalMessageGiveawayPrizeStars(data) @@ -3660,6 +3848,21 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageChecklistTasksAdded: return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageSuggestedPostApprovalFailed: + return UnmarshalMessageSuggestedPostApprovalFailed(data) + + case TypeMessageSuggestedPostApproved: + return UnmarshalMessageSuggestedPostApproved(data) + + case TypeMessageSuggestedPostDeclined: + return UnmarshalMessageSuggestedPostDeclined(data) + + case TypeMessageSuggestedPostPaid: + return UnmarshalMessageSuggestedPostPaid(data) + + case TypeMessageSuggestedPostRefunded: + return UnmarshalMessageSuggestedPostRefunded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -7384,6 +7587,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeMyStars: return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypeMyToncoins: + return UnmarshalInternalLinkTypeMyToncoins(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -8147,14 +8353,20 @@ func UnmarshalChatRevenueTransactionType(data json.RawMessage) (ChatRevenueTrans } switch meta.Type { - case TypeChatRevenueTransactionTypeEarnings: - return UnmarshalChatRevenueTransactionTypeEarnings(data) + case TypeChatRevenueTransactionTypeUnsupported: + return UnmarshalChatRevenueTransactionTypeUnsupported(data) - case TypeChatRevenueTransactionTypeWithdrawal: - return UnmarshalChatRevenueTransactionTypeWithdrawal(data) + case TypeChatRevenueTransactionTypeSponsoredMessageEarnings: + return UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data) - case TypeChatRevenueTransactionTypeRefund: - return UnmarshalChatRevenueTransactionTypeRefund(data) + case TypeChatRevenueTransactionTypeSuggestedPostEarnings: + return UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data) + + case TypeChatRevenueTransactionTypeFragmentWithdrawal: + return UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data) + + case TypeChatRevenueTransactionTypeFragmentRefund: + return UnmarshalChatRevenueTransactionTypeFragmentRefund(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) @@ -8343,6 +8555,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(data) + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) @@ -8688,6 +8903,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(data) + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(data) @@ -10005,6 +10223,78 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalSuggestedPostPriceStar(data json.RawMessage) (*SuggestedPostPriceStar, error) { + var resp SuggestedPostPriceStar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostPriceTon(data json.RawMessage) (*SuggestedPostPriceTon, error) { + var resp SuggestedPostPriceTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStatePending(data json.RawMessage) (*SuggestedPostStatePending, error) { + var resp SuggestedPostStatePending + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStateApproved(data json.RawMessage) (*SuggestedPostStateApproved, error) { + var resp SuggestedPostStateApproved + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStateDeclined(data json.RawMessage) (*SuggestedPostStateDeclined, error) { + var resp SuggestedPostStateDeclined + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostInfo(data json.RawMessage) (*SuggestedPostInfo, error) { + var resp SuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputSuggestedPostInfo(data json.RawMessage) (*InputSuggestedPostInfo, error) { + var resp InputSuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostRefundReasonPostDeleted(data json.RawMessage) (*SuggestedPostRefundReasonPostDeleted, error) { + var resp SuggestedPostRefundReasonPostDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostRefundReasonPaymentRefunded(data json.RawMessage) (*SuggestedPostRefundReasonPaymentRefunded, error) { + var resp SuggestedPostRefundReasonPaymentRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarAmount(data json.RawMessage) (*StarAmount, error) { var resp StarAmount @@ -10277,6 +10567,30 @@ func UnmarshalGiftSettings(data json.RawMessage) (*GiftSettings, error) { return &resp, err } +func UnmarshalUpgradedGiftOriginUpgrade(data json.RawMessage) (*UpgradedGiftOriginUpgrade, error) { + var resp UpgradedGiftOriginUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginTransfer(data json.RawMessage) (*UpgradedGiftOriginTransfer, error) { + var resp UpgradedGiftOriginTransfer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginResale(data json.RawMessage) (*UpgradedGiftOriginResale, error) { + var resp UpgradedGiftOriginResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { var resp UpgradedGiftModel @@ -10485,16 +10799,16 @@ func UnmarshalGiftUpgradePreview(data json.RawMessage) (*GiftUpgradePreview, err return &resp, err } -func UnmarshalStarTransactionDirectionIncoming(data json.RawMessage) (*StarTransactionDirectionIncoming, error) { - var resp StarTransactionDirectionIncoming +func UnmarshalTransactionDirectionIncoming(data json.RawMessage) (*TransactionDirectionIncoming, error) { + var resp TransactionDirectionIncoming err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionDirectionOutgoing(data json.RawMessage) (*StarTransactionDirectionOutgoing, error) { - var resp StarTransactionDirectionOutgoing +func UnmarshalTransactionDirectionOutgoing(data json.RawMessage) (*TransactionDirectionOutgoing, error) { + var resp TransactionDirectionOutgoing err := json.Unmarshal(data, &resp) @@ -10741,6 +11055,22 @@ func UnmarshalStarTransactionTypePaidMessageReceive(data json.RawMessage) (*Star return &resp, err } +func UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data json.RawMessage) (*StarTransactionTypeSuggestedPostPaymentSend, error) { + var resp StarTransactionTypeSuggestedPostPaymentSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data json.RawMessage) (*StarTransactionTypeSuggestedPostPaymentReceive, error) { + var resp StarTransactionTypeSuggestedPostPaymentReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypePremiumPurchase(data json.RawMessage) (*StarTransactionTypePremiumPurchase, error) { var resp StarTransactionTypePremiumPurchase @@ -10789,6 +11119,46 @@ func UnmarshalStarTransactions(data json.RawMessage) (*StarTransactions, error) return &resp, err } +func UnmarshalTonTransactionTypeFragmentDeposit(data json.RawMessage) (*TonTransactionTypeFragmentDeposit, error) { + var resp TonTransactionTypeFragmentDeposit + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeSuggestedPostPayment(data json.RawMessage) (*TonTransactionTypeSuggestedPostPayment, error) { + var resp TonTransactionTypeSuggestedPostPayment + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeUnsupported(data json.RawMessage) (*TonTransactionTypeUnsupported, error) { + var resp TonTransactionTypeUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransaction(data json.RawMessage) (*TonTransaction, error) { + var resp TonTransaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactions(data json.RawMessage) (*TonTransactions, error) { + var resp TonTransactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalGiveawayParticipantStatusEligible(data json.RawMessage) (*GiveawayParticipantStatusEligible, error) { var resp GiveawayParticipantStatusEligible @@ -14965,6 +15335,14 @@ func UnmarshalMessageGiftedStars(data json.RawMessage) (*MessageGiftedStars, err return &resp, err } +func UnmarshalMessageGiftedTon(data json.RawMessage) (*MessageGiftedTon, error) { + var resp MessageGiftedTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageGiveawayPrizeStars(data json.RawMessage) (*MessageGiveawayPrizeStars, error) { var resp MessageGiveawayPrizeStars @@ -15037,6 +15415,46 @@ func UnmarshalMessageChecklistTasksAdded(data json.RawMessage) (*MessageChecklis return &resp, err } +func UnmarshalMessageSuggestedPostApprovalFailed(data json.RawMessage) (*MessageSuggestedPostApprovalFailed, error) { + var resp MessageSuggestedPostApprovalFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostApproved(data json.RawMessage) (*MessageSuggestedPostApproved, error) { + var resp MessageSuggestedPostApproved + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostDeclined(data json.RawMessage) (*MessageSuggestedPostDeclined, error) { + var resp MessageSuggestedPostDeclined + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostPaid(data json.RawMessage) (*MessageSuggestedPostPaid, error) { + var resp MessageSuggestedPostPaid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostRefunded(data json.RawMessage) (*MessageSuggestedPostRefunded, error) { + var resp MessageSuggestedPostRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -20461,6 +20879,14 @@ func UnmarshalInternalLinkTypeMyStars(data json.RawMessage) (*InternalLinkTypeMy return &resp, err } +func UnmarshalInternalLinkTypeMyToncoins(data json.RawMessage) (*InternalLinkTypeMyToncoins, error) { + var resp InternalLinkTypeMyToncoins + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypePassportDataRequest(data json.RawMessage) (*InternalLinkTypePassportDataRequest, error) { var resp InternalLinkTypePassportDataRequest @@ -21613,24 +22039,40 @@ func UnmarshalRevenueWithdrawalStateFailed(data json.RawMessage) (*RevenueWithdr return &resp, err } -func UnmarshalChatRevenueTransactionTypeEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeEarnings, error) { - var resp ChatRevenueTransactionTypeEarnings +func UnmarshalChatRevenueTransactionTypeUnsupported(data json.RawMessage) (*ChatRevenueTransactionTypeUnsupported, error) { + var resp ChatRevenueTransactionTypeUnsupported err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatRevenueTransactionTypeWithdrawal(data json.RawMessage) (*ChatRevenueTransactionTypeWithdrawal, error) { - var resp ChatRevenueTransactionTypeWithdrawal +func UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeSponsoredMessageEarnings, error) { + var resp ChatRevenueTransactionTypeSponsoredMessageEarnings err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatRevenueTransactionTypeRefund(data json.RawMessage) (*ChatRevenueTransactionTypeRefund, error) { - var resp ChatRevenueTransactionTypeRefund +func UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeSuggestedPostEarnings, error) { + var resp ChatRevenueTransactionTypeSuggestedPostEarnings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data json.RawMessage) (*ChatRevenueTransactionTypeFragmentWithdrawal, error) { + var resp ChatRevenueTransactionTypeFragmentWithdrawal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeFragmentRefund(data json.RawMessage) (*ChatRevenueTransactionTypeFragmentRefund, error) { + var resp ChatRevenueTransactionTypeFragmentRefund err := json.Unmarshal(data, &resp) @@ -21877,6 +22319,14 @@ func UnmarshalUpdateMessageFactCheck(data json.RawMessage) (*UpdateMessageFactCh return &resp, err } +func UnmarshalUpdateMessageSuggestedPostInfo(data json.RawMessage) (*UpdateMessageSuggestedPostInfo, error) { + var resp UpdateMessageSuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateMessageLiveLocationViewed(data json.RawMessage) (*UpdateMessageLiveLocationViewed, error) { var resp UpdateMessageLiveLocationViewed @@ -22797,6 +23247,14 @@ func UnmarshalUpdateOwnedStarCount(data json.RawMessage) (*UpdateOwnedStarCount, return &resp, err } +func UnmarshalUpdateOwnedTonCount(data json.RawMessage) (*UpdateOwnedTonCount, error) { + var resp UpdateOwnedTonCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatRevenueAmount(data json.RawMessage) (*UpdateChatRevenueAmount, error) { var resp UpdateChatRevenueAmount @@ -23604,6 +24062,33 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeSuggestedPostPriceStar: + return UnmarshalSuggestedPostPriceStar(data) + + case TypeSuggestedPostPriceTon: + return UnmarshalSuggestedPostPriceTon(data) + + case TypeSuggestedPostStatePending: + return UnmarshalSuggestedPostStatePending(data) + + case TypeSuggestedPostStateApproved: + return UnmarshalSuggestedPostStateApproved(data) + + case TypeSuggestedPostStateDeclined: + return UnmarshalSuggestedPostStateDeclined(data) + + case TypeSuggestedPostInfo: + return UnmarshalSuggestedPostInfo(data) + + case TypeInputSuggestedPostInfo: + return UnmarshalInputSuggestedPostInfo(data) + + case TypeSuggestedPostRefundReasonPostDeleted: + return UnmarshalSuggestedPostRefundReasonPostDeleted(data) + + case TypeSuggestedPostRefundReasonPaymentRefunded: + return UnmarshalSuggestedPostRefundReasonPaymentRefunded(data) + case TypeStarAmount: return UnmarshalStarAmount(data) @@ -23706,6 +24191,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftSettings: return UnmarshalGiftSettings(data) + case TypeUpgradedGiftOriginUpgrade: + return UnmarshalUpgradedGiftOriginUpgrade(data) + + case TypeUpgradedGiftOriginTransfer: + return UnmarshalUpgradedGiftOriginTransfer(data) + + case TypeUpgradedGiftOriginResale: + return UnmarshalUpgradedGiftOriginResale(data) + case TypeUpgradedGiftModel: return UnmarshalUpgradedGiftModel(data) @@ -23784,11 +24278,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftUpgradePreview: return UnmarshalGiftUpgradePreview(data) - case TypeStarTransactionDirectionIncoming: - return UnmarshalStarTransactionDirectionIncoming(data) + case TypeTransactionDirectionIncoming: + return UnmarshalTransactionDirectionIncoming(data) - case TypeStarTransactionDirectionOutgoing: - return UnmarshalStarTransactionDirectionOutgoing(data) + case TypeTransactionDirectionOutgoing: + return UnmarshalTransactionDirectionOutgoing(data) case TypeStarTransactionTypePremiumBotDeposit: return UnmarshalStarTransactionTypePremiumBotDeposit(data) @@ -23880,6 +24374,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypePaidMessageReceive: return UnmarshalStarTransactionTypePaidMessageReceive(data) + case TypeStarTransactionTypeSuggestedPostPaymentSend: + return UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data) + + case TypeStarTransactionTypeSuggestedPostPaymentReceive: + return UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data) + case TypeStarTransactionTypePremiumPurchase: return UnmarshalStarTransactionTypePremiumPurchase(data) @@ -23898,6 +24398,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactions: return UnmarshalStarTransactions(data) + case TypeTonTransactionTypeFragmentDeposit: + return UnmarshalTonTransactionTypeFragmentDeposit(data) + + case TypeTonTransactionTypeSuggestedPostPayment: + return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + + case TypeTonTransactionTypeUnsupported: + return UnmarshalTonTransactionTypeUnsupported(data) + + case TypeTonTransaction: + return UnmarshalTonTransaction(data) + + case TypeTonTransactions: + return UnmarshalTonTransactions(data) + case TypeGiveawayParticipantStatusEligible: return UnmarshalGiveawayParticipantStatusEligible(data) @@ -25464,6 +25979,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageGiftedStars: return UnmarshalMessageGiftedStars(data) + case TypeMessageGiftedTon: + return UnmarshalMessageGiftedTon(data) + case TypeMessageGiveawayPrizeStars: return UnmarshalMessageGiveawayPrizeStars(data) @@ -25491,6 +26009,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageChecklistTasksAdded: return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageSuggestedPostApprovalFailed: + return UnmarshalMessageSuggestedPostApprovalFailed(data) + + case TypeMessageSuggestedPostApproved: + return UnmarshalMessageSuggestedPostApproved(data) + + case TypeMessageSuggestedPostDeclined: + return UnmarshalMessageSuggestedPostDeclined(data) + + case TypeMessageSuggestedPostPaid: + return UnmarshalMessageSuggestedPostPaid(data) + + case TypeMessageSuggestedPostRefunded: + return UnmarshalMessageSuggestedPostRefunded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -27525,6 +28058,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeMyStars: return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypeMyToncoins: + return UnmarshalInternalLinkTypeMyToncoins(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -27957,14 +28493,20 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeRevenueWithdrawalStateFailed: return UnmarshalRevenueWithdrawalStateFailed(data) - case TypeChatRevenueTransactionTypeEarnings: - return UnmarshalChatRevenueTransactionTypeEarnings(data) + case TypeChatRevenueTransactionTypeUnsupported: + return UnmarshalChatRevenueTransactionTypeUnsupported(data) - case TypeChatRevenueTransactionTypeWithdrawal: - return UnmarshalChatRevenueTransactionTypeWithdrawal(data) + case TypeChatRevenueTransactionTypeSponsoredMessageEarnings: + return UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data) - case TypeChatRevenueTransactionTypeRefund: - return UnmarshalChatRevenueTransactionTypeRefund(data) + case TypeChatRevenueTransactionTypeSuggestedPostEarnings: + return UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data) + + case TypeChatRevenueTransactionTypeFragmentWithdrawal: + return UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data) + + case TypeChatRevenueTransactionTypeFragmentRefund: + return UnmarshalChatRevenueTransactionTypeFragmentRefund(data) case TypeChatRevenueTransaction: return UnmarshalChatRevenueTransaction(data) @@ -28056,6 +28598,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(data) + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) @@ -28401,6 +28946,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(data) + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(data) diff --git a/data/td_api.tl b/data/td_api.tl index 29d016b..deb1b8f 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -828,7 +828,7 @@ animatedChatPhoto length:int32 file:file main_frame_timestamp:double = AnimatedC //@minithumbnail Photo minithumbnail; may be null //@sizes Available variants of the photo in JPEG format, in different size //@animation A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null -//@small_animation A small (160x160) animated variant of the photo in MPEG4 format; may be null even the big animation is available +//@small_animation A small (160x160) animated variant of the photo in MPEG4 format; may be null even if the big animation is available //@sticker Sticker-based version of the chat photo; may be null chatPhoto id:int64 added_date:int32 minithumbnail:minithumbnail sizes:vector animation:animatedChatPhoto small_animation:animatedChatPhoto sticker:chatPhotoSticker = ChatPhoto; @@ -877,7 +877,7 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum //@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, //-ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only //@can_change_info True, if the administrator can change the chat title, photo, and other settings -//@can_post_messages True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only +//@can_post_messages True, if the administrator can create channel posts, approve suggested channel posts, or view channel statistics; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only //@can_delete_messages True, if the administrator can delete messages of other users //@can_invite_users True, if the administrator can invite new users to the chat @@ -889,8 +889,58 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum //@can_post_stories True, if the administrator can create new chat stories, or edit and delete posted stories; applicable to supergroups and channels only //@can_edit_stories True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access story archive; applicable to supergroups and channels only //@can_delete_stories True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only +//@can_manage_direct_messages True, if the administrator can answer to channel direct messages; applicable to channels only //@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only -chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; +chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool can_manage_direct_messages:Bool is_anonymous:Bool = ChatAdministratorRights; + + +//@class SuggestedPostPrice @description Describes price of a suggested post + +//@description Describes price of a suggested post in Telegram Stars +//@star_count The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") +suggestedPostPriceStar star_count:int53 = SuggestedPostPrice; + +//@description Describes price of a suggested post in Toncoins +//@toncoin_cent_count The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") +suggestedPostPriceTon toncoin_cent_count:int53 = SuggestedPostPrice; + + +//@class SuggestedPostState @description Describes state of a suggested post + +//@description The post must be approved or declined +suggestedPostStatePending = SuggestedPostState; + +//@description The post was approved +suggestedPostStateApproved = SuggestedPostState; + +//@description The post was declined +suggestedPostStateDeclined = SuggestedPostState; + + +//@description Contains information about a suggested post. If the post can be approved or declined, then changes to the post can be also suggested. Use sendMessage with reply to the message +//-and suggested post information to suggest message changes. Use addOffer to suggest price or time changes +//@price Price of the suggested post; may be null if the post is non-paid +//@send_date Point in time (Unix timestamp) when the post is expected to be published; 0 if the specific date isn't set yet +//@state State of the post +//@can_be_approved True, if the suggested post can be approved by the current user using approveSuggestedPost; updates aren't sent when value of this field changes +//@can_be_declined True, if the suggested post can be declined by the current user using declineSuggestedPost; updates aren't sent when value of this field changes +suggestedPostInfo price:SuggestedPostPrice send_date:int32 state:SuggestedPostState can_be_approved:Bool can_be_declined:Bool = SuggestedPostInfo; + +//@description Contains information about a post to suggest +//@price Price of the suggested post; pass null to suggest a post without payment. If the current user isn't an administrator of the channel direct messages chat +//-and has no enough funds to pay for the post, then the error "BALANCE_TOO_LOW" will be returned immediately +//@send_date Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date isn't restricted. If specified, +//-then the date must be getOption("suggested_post_send_delay_min")-getOption("suggested_post_send_delay_max") seconds in the future +inputSuggestedPostInfo price:SuggestedPostPrice send_date:int32 = InputSuggestedPostInfo; + + +//@class SuggestedPostRefundReason @description Describes reason for refund of the payment for a suggested post + +//@description The post was refunded, because it was deleted by channel administrators in less than getOption("suggested_post_lifetime_min") seconds +suggestedPostRefundReasonPostDeleted = SuggestedPostRefundReason; + +//@description The post was refunded, because the payment for the post was refunded +suggestedPostRefundReasonPaymentRefunded = SuggestedPostRefundReason; //@description Describes a possibly non-integer amount of Telegram Stars @@ -1110,6 +1160,20 @@ acceptedGiftTypes unlimited_gifts:Bool limited_gifts:Bool upgraded_gifts:Bool pr //@accepted_gift_types Types of gifts accepted by the user; for Telegram Premium users only giftSettings show_gift_button:Bool accepted_gift_types:acceptedGiftTypes = GiftSettings; + +//@class UpgradedGiftOrigin @description Describes origin from which the upgraded gift was obtained + +//@description The gift was obtained by upgrading of a previously received gift +//@gift_message_id Identifier of the message with the regular gift that was upgraded; can be 0 or an identifier of a deleted message +upgradedGiftOriginUpgrade gift_message_id:int53 = UpgradedGiftOrigin; + +//@description The gift was transferred from another owner +upgradedGiftOriginTransfer = UpgradedGiftOrigin; + +//@description The gift was bought from another user @star_count Number of Telegram Stars that were paid by the sender for the gift +upgradedGiftOriginResale star_count:int53 = UpgradedGiftOrigin; + + //@description Describes a model of an upgraded gift //@name Name of the model //@sticker The sticker representing the upgraded gift @@ -1145,6 +1209,7 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@description Describes a gift that can be sent to another user or channel chat //@id Unique identifier of the gift +//@publisher_chat_id Identifier of the chat that published the gift; 0 if none //@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 regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed @@ -1154,10 +1219,11 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@total_count Number of total times the gift can be purchased; 0 if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; //@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift +//@publisher_chat_id Identifier of the chat that published the gift; 0 if none //@title The title of the upgraded gift //@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift @@ -1172,7 +1238,7 @@ gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upg //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown //@resale_star_count Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible -upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; +upgradedGift id:int64 publisher_chat_id:int53 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1288,13 +1354,13 @@ receivedGifts total_count:int32 gifts:vector are_notifications_ena giftUpgradePreview models:vector symbols:vector backdrops:vector = GiftUpgradePreview; -//@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars +//@class TransactionDirection @description Describes direction of transactions in a transaction list -//@description The transaction is incoming and increases the number of owned Telegram Stars -starTransactionDirectionIncoming = StarTransactionDirection; +//@description The transaction is incoming and increases the amount of owned currency +transactionDirectionIncoming = TransactionDirection; -//@description The transaction is outgoing and decreases the number of owned Telegram Stars -starTransactionDirectionOutgoing = StarTransactionDirection; +//@description The transaction is outgoing and decreases the amount of owned currency +transactionDirectionOutgoing = TransactionDirection; //@class StarTransactionType @description Describes type of transaction with Telegram Stars @@ -1437,6 +1503,14 @@ starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTrans //@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds starTransactionTypePaidMessageReceive sender_id:MessageSender message_count:int32 commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; +//@description The transaction is a payment for a suggested post; for regular users only +//@chat_id Identifier of the channel chat that posted the post +starTransactionTypeSuggestedPostPaymentSend chat_id:int53 = StarTransactionType; + +//@description The transaction is a receiving of a payment for a suggested post by the channel chat; for channel chats only +//@user_id Identifier of the user that paid for the suggested post +starTransactionTypeSuggestedPostPaymentReceive user_id:int53 = StarTransactionType; + //@description The transaction is a purchase of Telegram Premium subscription; for regular users and bots only //@user_id Identifier of the user that received the Telegram Premium subscription //@month_count Number of months the Telegram Premium subscription will be active @@ -1468,6 +1542,35 @@ starTransaction id:string star_amount:starAmount is_refund:Bool date:int32 type: starTransactions star_amount:starAmount transactions:vector next_offset:string = StarTransactions; +//@class TonTransactionType @description Describes type of transaction with Toncoins + +//@description The transaction is a deposit of Toncoins from Fragment +//@is_gift True, if the transaction is a gift from another user +//@sticker The sticker to be shown in the transaction information; may be null if unknown +tonTransactionTypeFragmentDeposit is_gift:Bool sticker:sticker = TonTransactionType; + +//@description The transaction is a payment for a suggested post @chat_id Identifier of the channel chat that posted the post +tonTransactionTypeSuggestedPostPayment chat_id:int53 = TonTransactionType; + +//@description The transaction is a transaction of an unsupported type +tonTransactionTypeUnsupported = TonTransactionType; + + +//@description Represents a transaction changing the amount of owned Toncoins +//@id Unique identifier of the transaction +//@ton_amount The amount of added owned Toncoins; negative for outgoing transactions +//@is_refund True, if the transaction is a refund of a previous transaction +//@date Point in time (Unix timestamp) when the transaction was completed +//@type Type of the transaction +tonTransaction id:string ton_amount:int53 is_refund:Bool date:int32 type:TonTransactionType = TonTransaction; + +//@description Represents a list of Toncoin transactions +//@ton_amount The total amount of owned Toncoins +//@transactions List of Toncoin transactions +//@next_offset The offset for the next request. If empty, then there are no more results +tonTransactions ton_amount:int53 transactions:vector next_offset:string = TonTransactions; + + //@class GiveawayParticipantStatus @description Contains information about status of a user in a giveaway //@description The user is eligible for the giveaway @@ -1892,7 +1995,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup //@sign_messages True, if messages sent to the channel contains name of the sender. This field is only applicable to channels //@show_message_sender True, if messages sent to the channel have information about the sender user. This field is only applicable to channels -//@join_to_send_messages True, if users need to join the supergroup before they can send messages. Always true for channels and non-discussion supergroups +//@join_to_send_messages True, if users need to join the supergroup before they can send messages. May be false only for discussion supergroups and channel direct messages groups //@join_by_request True, if all users directly joining the supergroup need to be approved by supergroup administrators. Always false for channels and supergroups without username, location, or a linked chat //@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup //@is_channel True, if the supergroup is a channel @@ -2198,13 +2301,14 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //@chat_id The identifier of the chat to which the message belongs; may be 0 if the replied message is in unknown chat //@message_id The identifier of the message; may be 0 if the replied message is in unknown chat //@quote Chosen quote from the replied message; may be null if none +//@checklist_task_id Identifier of the checklist task in the original message that was replied; 0 if none //@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. //-Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, //-messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, //-messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote -messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; +messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote checklist_task_id:int32 origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message @story_poster_chat_id The identifier of the poster of the story @story_id The identifier of the story messageReplyToStory story_poster_chat_id:int53 story_id:int32 = MessageReplyTo; @@ -2215,13 +2319,15 @@ messageReplyToStory story_poster_chat_id:int53 story_id:int32 = MessageReplyTo; //@description Describes a message to be replied in the same chat and forum topic //@message_id The identifier of the message to be replied in the same chat and forum topic. A message can be replied in the same chat and forum topic only if messageProperties.can_be_replied //@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats -inputMessageReplyToMessage message_id:int53 quote:inputTextQuote = InputMessageReplyTo; +//@checklist_task_id Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message +inputMessageReplyToMessage message_id:int53 quote:inputTextQuote checklist_task_id:int32 = InputMessageReplyTo; //@description Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats //@chat_id The identifier of the chat to which the message to be replied belongs //@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or forum topic only if messageProperties.can_be_replied_in_another_chat //@quote Quote from the message to be replied; pass null if none -inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; +//@checklist_task_id Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message +inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote checklist_task_id:int32 = InputMessageReplyTo; //@description Describes a story to be replied //@story_poster_chat_id The identifier of the poster of the story. Currently, stories can be replied only in the chat that posted the story; channel stories can't be replied @@ -2247,6 +2353,8 @@ factCheck text:formattedText country_code:string = FactCheck; //@can_be_saved True, if content of the message can be saved locally //@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_paid_star_suggested_post True, if the message is a suggested channel post which was paid in Telegram Stars; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending +//@is_paid_ton_suggested_post True, if the message is a suggested channel post which was paid in Toncoins; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending //@contains_unread_mention True, if the message contains an unread mention for the current user //@date Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages //@edit_date Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages @@ -2255,6 +2363,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@interaction_info Information about interactions with the message; may be null if none //@unread_reactions Information about unread reactions added to the message //@fact_check Information about fact-check added to the message; may be null if none +//@suggested_post_info Information about the suggested post; may be null if the message isn't a suggested post //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs //@topic_id Identifier of the topic within the chat to which the message belongs; may be null if none @@ -2272,7 +2381,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_paid_star_suggested_post:Bool is_paid_ton_suggested_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck suggested_post_info:suggestedPostInfo reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2375,8 +2484,8 @@ sponsoredChats chats:vector = SponsoredChats; //@description Describes an advertisent to be shown while a video from a message is watched //@unique_id Unique identifier of this result //@text Text of the advertisement -//@min_display_duration The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds -//@max_display_duration The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds +//@min_display_duration The minimum amount of time the advertisement must be displayed before it can be hidden by the user, in seconds +//@max_display_duration The maximum amount of time the advertisement must be displayed before it must be automatically hidden, in seconds //@can_be_reported True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement //@sponsor Information about the sponsor of the advertisement //@title Title of the sponsored message @@ -2502,7 +2611,8 @@ reactionNotificationSettings message_reaction_source:ReactionNotificationSource //@date Point in time (Unix timestamp) when the draft was created //@input_message_text Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote //@effect_id Identifier of the effect to apply to the message when it is sent; 0 if none -draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent effect_id:int64 = DraftMessage; +//@suggested_post_info Information about the suggested post; may be null if none +draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent effect_id:int64 suggested_post_info:inputSuggestedPostInfo = DraftMessage; //@class ChatType @description Describes the type of chat @@ -2663,7 +2773,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@permissions Actions that non-administrator chat members are allowed to take in the chat //@last_message Last message in the chat; may be null if none or unknown //@positions Positions of the chat in chat lists -//@chat_lists Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even it doesn't belong to the chat list and have no position in a chat list even it belongs to the chat list +//@chat_lists Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even if it doesn't belong to the chat list and have no position in a chat list even if it belongs to the chat list //@message_sender_id Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender //@block_list Block list to which the chat is added; may be null if none //@has_protected_content True, if chat content can't be saved locally, forwarded, or copied @@ -2995,7 +3105,7 @@ forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@creator_id Identifier of the creator of the topic //@is_general True, if the topic is the General topic list //@is_outgoing True, if the topic was created by the current user -//@is_closed True, if the topic is closed +//@is_closed True, if the topic is closed. If the topic is closed, then the user must have can_manage_topics administrator right in the supergroup or must be the creator of the topic to send messages there //@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only forumTopicInfo chat_id:int53 forum_topic_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; @@ -3447,7 +3557,8 @@ linkPreviewTypeVideo video:video cover:photo start_timestamp:int32 = LinkPreview //@description The link is a link to a video chat //@photo Photo of the chat with the video chat; may be null if none //@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group -linkPreviewTypeVideoChat photo:chatPhoto is_live_stream:Bool = LinkPreviewType; +//@joins_as_speaker True, if the user can use the link to join the video chat without being muted by administrators +linkPreviewTypeVideoChat photo:chatPhoto is_live_stream:Bool joins_as_speaker:Bool = LinkPreviewType; //@description The link is a link to a video note message @video_note The video note linkPreviewTypeVideoNote video_note:videoNote = LinkPreviewType; @@ -3708,7 +3819,7 @@ paidMediaUnsupported = PaidMedia; //@description Describes parameters of a giveaway //@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, -//-or for the specified time. If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup +//-or for the specified time. If the chat is a channel, then can_post_messages administrator right is required in the channel, otherwise, the user must be an administrator in the supergroup //@additional_chat_ids Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats //@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways //@only_new_members True, if only new members of the chats will be eligible for the giveaway @@ -4327,6 +4438,14 @@ 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 Toncoins were gifted to a user +//@gifter_user_id The identifier of a user that gifted Toncoins; 0 if the gift was anonymous or is outgoing +//@receiver_user_id The identifier of a user that received Toncoins; 0 if the gift is incoming +//@ton_amount The received amount of Toncoins, in the smallest units of the cryptocurrency +//@transaction_id Identifier of the transaction for Toncoin credit; for receiver only +//@sticker A sticker to be shown in the message; may be null if unknown +messageGiftedTon gifter_user_id:int53 receiver_user_id:int53 ton_amount:int53 transaction_id:string sticker:sticker = MessageContent; + //@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 @@ -4357,17 +4476,16 @@ messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received //@gift The gift //@sender_id Sender of the gift; may be null for anonymous gifts //@receiver_id Receiver of the gift +//@origin Origin of the upgraded gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift //@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift -//@was_transferred True, if the gift was transferred to another owner; only for the receiver of the gift -//@last_resale_star_count Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred +//@was_transferred True, if the gift has already been transferred to another owner; only for the receiver of the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift //@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift //@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; +messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender origin:UpgradedGiftOrigin received_gift_id:string is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded //@gift The gift @@ -4399,6 +4517,33 @@ messageChecklistTasksDone checklist_message_id:int53 marked_as_done_task_ids:vec //@tasks List of tasks added to the checklist messageChecklistTasksAdded checklist_message_id:int53 tasks:vector = MessageContent; +//@description Approval of suggested post has failed, because the user which proposed the post had no enough funds +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@price Price of the suggested post +messageSuggestedPostApprovalFailed suggested_post_message_id:int53 price:SuggestedPostPrice = MessageContent; + +//@description A suggested post was approved +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@price Price of the suggested post; may be null if the post is non-paid +//@send_date Point in time (Unix timestamp) when the post is expected to be published +messageSuggestedPostApproved suggested_post_message_id:int53 price:SuggestedPostPrice send_date:int32 = MessageContent; + +//@description A suggested post was declined +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@comment Comment added by administrator of the channel when the post was declined +messageSuggestedPostDeclined suggested_post_message_id:int53 comment:string = MessageContent; + +//@description A suggested post was published for getOption("suggested_post_lifetime_min") seconds and payment for the post was received +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@star_amount The amount of received Telegram Stars +//@ton_amount The amount of received Toncoins; in the smallest units of the cryptocurrency +messageSuggestedPostPaid suggested_post_message_id:int53 star_amount:starAmount ton_amount:int53 = MessageContent; + +//@description A suggested post was refunded +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@reason Reason of the refund +messageSuggestedPostRefunded suggested_post_message_id:int53 reason:SuggestedPostRefundReason = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4553,6 +4698,7 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@description Options to be used when a message is sent //@direct_messages_chat_topic_id Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user +//@suggested_post_info Information about the suggested post; pass null if none. For messages to channel direct messages chat only. Applicable only to sendMessage and addOffer //@disable_notification Pass true to disable notification for the message //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only @@ -4564,7 +4710,7 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions direct_messages_chat_topic_id:int53 disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions direct_messages_chat_topic_id:int53 suggested_post_info:inputSuggestedPostInfo disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. @@ -4737,9 +4883,12 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_add_offer True, if an offer can be added to the message using addOffer //@can_add_tasks True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription +//@can_be_approved True, if the message is a suggested post that can be approved by the user using approveSuggestedPost //@can_be_copied True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options +//@can_be_declined True, if the message is a suggested post that can be declined by the user using declineSuggestedPost //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. @@ -4753,6 +4902,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage //@can_edit_media True, if the message can be edited using the method editMessageMedia //@can_edit_scheduling_state True, if scheduling state of the message can be edited +//@can_edit_suggested_post_info True, if another price or post send time can be suggested using addOffer //@can_get_author True, if author of the message sent on behalf of a chat can be received through getMessageAuthor //@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode //@can_get_link True, if a link can be generated for the message using getMessageLink @@ -4769,7 +4919,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_add_tasks:Bool can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_video_advertisements:Bool can_get_viewers:Bool can_mark_tasks_as_done:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_add_offer:Bool can_add_tasks:Bool can_be_approved:Bool can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_declined:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_edit_suggested_post_info:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_video_advertisements:Bool can_get_viewers:Bool can_mark_tasks_as_done:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -6513,7 +6663,7 @@ premiumFeatureSavedMessagesTags = PremiumFeature; //-and to restrict incoming messages from non-contacts using setNewChatPrivacySettings premiumFeatureMessagePrivacy = PremiumFeature; -//@description The ability to view last seen and read times of other users even they can't view last seen or read time for the current user +//@description The ability to view last seen and read times of other users even if they can't view last seen or read time for the current user premiumFeatureLastSeenTimes = PremiumFeature; //@description The ability to use Business features @@ -7663,6 +7813,9 @@ internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLin //@description The link is a link to the screen with information about Telegram Star balance and transactions of the current user internalLinkTypeMyStars = InternalLinkType; +//@description The link is a link to the screen with information about Toncoin balance and transactions of the current user +internalLinkTypeMyToncoins = InternalLinkType; + //@description The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it //@bot_user_id User identifier of the service's bot; the corresponding user may be unknown yet //@scope Telegram Passport element types requested by the service @@ -8339,21 +8492,26 @@ revenueWithdrawalStateFailed = RevenueWithdrawalState; //@class ChatRevenueTransactionType @description Describes type of transaction for revenue earned from sponsored messages in a chat +//@description Describes an unsupported transaction +chatRevenueTransactionTypeUnsupported = ChatRevenueTransactionType; + //@description Describes earnings from sponsored messages in a chat in some time frame //@start_date Point in time (Unix timestamp) when the earnings started //@end_date Point in time (Unix timestamp) when the earnings ended -chatRevenueTransactionTypeEarnings start_date:int32 end_date:int32 = ChatRevenueTransactionType; +chatRevenueTransactionTypeSponsoredMessageEarnings start_date:int32 end_date:int32 = ChatRevenueTransactionType; -//@description Describes a withdrawal of earnings +//@description Describes earnings from a published suggested post @user_id Identifier of the user that paid for the suggested post +chatRevenueTransactionTypeSuggestedPostEarnings user_id:int53 = ChatRevenueTransactionType; + +//@description Describes a withdrawal of earnings through Fragment //@withdrawal_date Point in time (Unix timestamp) when the earnings withdrawal started -//@provider Name of the payment provider //@state State of the withdrawal -chatRevenueTransactionTypeWithdrawal withdrawal_date:int32 provider:string state:RevenueWithdrawalState = ChatRevenueTransactionType; +chatRevenueTransactionTypeFragmentWithdrawal withdrawal_date:int32 state:RevenueWithdrawalState = ChatRevenueTransactionType; -//@description Describes a refund for failed withdrawal of earnings +//@description Describes a refund for failed withdrawal of earnings through Fragment //@refund_date Point in time (Unix timestamp) when the transaction was refunded -//@provider Name of the payment provider -chatRevenueTransactionTypeRefund refund_date:int32 provider:string = ChatRevenueTransactionType; +chatRevenueTransactionTypeFragmentRefund refund_date:int32 = ChatRevenueTransactionType; + //@description Contains a chat revenue transactions //@cryptocurrency Cryptocurrency in which revenue is calculated @@ -8361,8 +8519,11 @@ chatRevenueTransactionTypeRefund refund_date:int32 provider:string = ChatRevenue //@type Type of the transaction chatRevenueTransaction cryptocurrency:string cryptocurrency_amount:int64 type:ChatRevenueTransactionType = ChatRevenueTransaction; -//@description Contains a list of chat revenue transactions @total_count Total number of transactions @transactions List of transactions -chatRevenueTransactions total_count:int32 transactions:vector = ChatRevenueTransactions; +//@description Contains a list of chat revenue transactions +//@ton_amount The amount of owned Toncoins; in the smallest units of the cryptocurrency +//@transactions List of transactions +//@next_offset The offset for the next request. If empty, then there are no more results +chatRevenueTransactions ton_amount:int53 transactions:vector next_offset:string = ChatRevenueTransactions; //@description Contains information about Telegram Stars earned by a bot or a chat @@ -8491,6 +8652,12 @@ 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 Information about suggested post of a message was changed +//@chat_id Chat identifier +//@message_id Message identifier +//@suggested_post_info The new information about the suggested post +updateMessageSuggestedPostInfo chat_id:int53 message_id:int53 suggested_post_info:suggestedPostInfo = Update; + //@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 @@ -8809,7 +8976,7 @@ updateGroupCallParticipant group_call_id:int32 participant:groupCallParticipant //@description The list of group call participants that can send and receive encrypted call data has changed; for group calls not bound to a chat only //@group_call_id Identifier of the group call //@participant_user_ids New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. -//-The participants must be shown in the list of group call participants even there is no information about them +//-The participants must be shown in the list of group call participants even if there is no information about them updateGroupCallParticipants group_call_id:int32 participant_user_ids:vector = Update; //@description The verification state of an encrypted group call has changed; for group calls not bound to a chat only @@ -8958,6 +9125,9 @@ updateActiveLiveLocationMessages messages:vector = Update; //@description The number of Telegram Stars owned by the current user has changed @star_amount The new amount of owned Telegram Stars updateOwnedStarCount star_amount:starAmount = Update; +//@description The number of Toncoins owned by the current user has changed @ton_amount The new amount of owned Toncoins; in the smallest units of the cryptocurrency +updateOwnedTonCount ton_amount:int53 = Update; + //@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions //@chat_id Identifier of the chat //@revenue_amount New amount of earned revenue @@ -9403,10 +9573,12 @@ getMessage chat_id:int53 message_id:int53 = Message; //@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, the checklist message, and the topic creation message for messages of the types -//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, and topic messages without non-bundled replied message respectively. -//-Returns a 404 error if the message doesn't exist +//@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message for messagePinMessage, +//-the game message for messageGameScore, the invoice message for messagePaymentSuccessful, the message with a previously set same background for messageChatSetBackground, +//-the giveaway message for messageGiveawayCompleted, the checklist message for messageChecklistTasksDone, messageChecklistTasksAdded, the message with suggested post information +//-for messageSuggestedPostApprovalFailed, messageSuggestedPostApproved, messageSuggestedPostDeclined, messageSuggestedPostPaid, messageSuggestedPostRefunded, +//-the message with the regular gift that was upgraded for messageUpgradedGift with origin of the type upgradedGiftOriginUpgrade, +//-and the topic creation message for topic messages without non-bundled replied 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 reply message getRepliedMessage chat_id:int53 message_id:int53 = Message; @@ -9563,8 +9735,8 @@ getDirectMessagesChatTopic chat_id:int53 topic_id:int53 = DirectMessagesChatTopi //@chat_id Chat identifier of the channel direct messages chat //@topic_id Identifier of the topic which messages will be fetched //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getDirectMessagesChatTopicHistory chat_id:int53 topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; @@ -9628,8 +9800,8 @@ loadSavedMessagesTopics limit:int32 = Ok; //@description Returns messages in a Saved Messages topic. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) //@saved_messages_topic_id Identifier of Saved Messages topic which messages will be fetched //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getSavedMessagesTopicHistory saved_messages_topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; @@ -9667,8 +9839,8 @@ getGroupsInCommon user_id:int53 offset_chat_id:int53 limit:int32 = Chats; //-For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true //@chat_id Chat identifier //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@only_local Pass true to get only messages that are available without sending network requests getChatHistory chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only_local:Bool = Messages; @@ -9678,8 +9850,8 @@ getChatHistory chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only //@chat_id Chat identifier //@message_id Message identifier, which thread history needs to be returned //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getMessageThreadHistory chat_id:int53 message_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; @@ -9702,8 +9874,8 @@ deleteChat chat_id:int53 = Ok; //@query Query to search for //@sender_id Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages searchChatMessages chat_id:int53 topic_id:MessageTopic query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter = FoundChatMessages; @@ -9735,8 +9907,8 @@ searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter //@tag Tag to search for; pass null to return all suitable messages //@query Query to search for //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit searchSavedMessages saved_messages_topic_id:int53 tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; @@ -10247,7 +10419,7 @@ setBusinessAccountBio business_connection_id:string bio:string = Ok; //@description Changes a profile photo of a business account; for bots only //@business_connection_id Unique identifier of business connection //@photo Profile photo to set; pass null to remove the photo -//@is_public Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings +//@is_public Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings setBusinessAccountProfilePhoto business_connection_id:string photo:InputChatPhoto is_public:Bool = Ok; //@description Changes the editable username of a business account; for bots only @@ -10340,7 +10512,7 @@ getForumTopicDefaultIcons = Stickers; //@icon Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, other users can use only a custom emoji returned by getForumTopicDefaultIcons createForumTopic chat_id:int53 name:string icon:forumTopicIcon = ForumTopicInfo; -//@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +//@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic //@chat_id Identifier of the chat //@message_thread_id Message thread identifier of the forum topic //@name New name of the topic; 0-128 characters. If empty, the previous topic name is kept @@ -10369,24 +10541,24 @@ getForumTopics chat_id:int53 query:string offset_date:int32 offset_message_id:in //@notification_settings New notification settings for the forum topic. If the topic is muted for more than 366 days, it is considered to be muted forever setForumTopicNotificationSettings chat_id:int53 message_thread_id:int53 notification_settings:chatNotificationSettings = Ok; -//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic //@chat_id Identifier of the chat //@message_thread_id Message thread identifier of the forum topic //@is_closed Pass true to close the topic; pass false to reopen it toggleForumTopicIsClosed chat_id:int53 message_thread_id:int53 is_closed:Bool = Ok; -//@description Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics right in the supergroup +//@description Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup //@chat_id Identifier of the chat //@is_hidden Pass true to hide and close the General topic; pass false to unhide it toggleGeneralForumTopicIsHidden chat_id:int53 is_hidden:Bool = Ok; -//@description Changes the pinned state of a forum topic; requires can_manage_topics right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics +//@description Changes the pinned state of a forum topic; requires can_manage_topics administrator right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics //@chat_id Chat identifier //@message_thread_id Message thread identifier of the forum topic //@is_pinned Pass true to pin the topic; pass false to unpin it toggleForumTopicIsPinned chat_id:int53 message_thread_id:int53 is_pinned:Bool = Ok; -//@description Changes the order of pinned forum topics; requires can_manage_topics right in the supergroup @chat_id Chat identifier @message_thread_ids The new list of pinned forum topics +//@description Changes the order of pinned forum topics; requires can_manage_topics administrator right in the supergroup @chat_id Chat identifier @message_thread_ids The new list of pinned forum topics setPinnedForumTopics chat_id:int53 message_thread_ids:vector = Ok; //@description Deletes all messages in a forum topic; requires can_delete_messages administrator right in the supergroup unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages @@ -10773,7 +10945,7 @@ closeChat chat_id:int53 = Ok; //@chat_id Chat identifier //@message_ids The identifiers of the messages being viewed //@source Source of the message view; pass null to guess the source based on chat open state -//@force_read Pass true to mark as read the specified messages even the chat is closed +//@force_read Pass true to mark as read the specified messages even if the chat is closed viewMessages chat_id:int53 message_ids:vector source:MessageSource force_read:Bool = Ok; //@description Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). @@ -11041,7 +11213,7 @@ setChatDirectMessagesGroup chat_id:int53 is_enabled:Bool paid_message_star_count //@description Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use @chat_id Chat identifier @location New location for the chat; must be valid and not null setChatLocation chat_id:int53 location:chatLocation = Ok; -//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right @chat_id Chat identifier @slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 +//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members administrator right @chat_id Chat identifier @slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 setChatSlowModeDelay chat_id:int53 slow_mode_delay:int32 = Ok; //@description Pins a message in a chat. A message can be pinned only if messageProperties.can_be_pinned @@ -11180,11 +11352,11 @@ getStory story_poster_chat_id:int53 story_id:int32 only_local:Bool = Story; //@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canPostStory before actually trying to post a story there getChatsToPostStories = Chats; -//@description Checks whether the current user can post a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +//@description Checks whether the current user can post a story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats //@chat_id Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user canPostStory chat_id:int53 = CanPostStoryResult; -//@description Posts a new story on behalf of a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story +//@description Posts a new story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats. Returns a temporary story //@chat_id Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none @@ -11248,7 +11420,7 @@ getChatActiveStories chat_id:int53 = ChatActiveStories; //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatPostedToChatPageStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; -//@description Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. +//@description Returns the list of all stories posted by the given chat; requires can_edit_stories administrator right in the chat. //-The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib //@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story @@ -11256,7 +11428,7 @@ getChatPostedToChatPageStories chat_id:int53 from_story_id:int32 limit:int32 = S //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatArchivedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; -//@description Changes the list of pinned stories on a chat page; requires can_edit_stories right in the chat +//@description Changes the list of pinned stories on a chat page; requires can_edit_stories administrator right in the chat //@chat_id Identifier of the chat that posted the stories //@story_ids New list of pinned stories. All stories must be posted to the chat page first. There can be up to getOption("pinned_story_count_max") pinned stories on a chat page setChatPinnedStories chat_id:int53 story_ids:vector = Ok; @@ -11391,7 +11563,7 @@ getThemedChatEmojiStatuses = EmojiStatusCustomEmojis; //@description Returns default emoji statuses for chats getDefaultChatEmojiStatuses = EmojiStatusCustomEmojis; -//@description Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true +//@description Returns the list of emoji statuses, which can't be used as chat emoji status, even if they are from a sticker set with is_allowed_as_chat_emoji_status == true getDisallowedChatEmojiStatuses = EmojiStatusCustomEmojis; @@ -11602,6 +11774,28 @@ processChatJoinRequest chat_id:int53 user_id:int53 approve:Bool = Ok; processChatJoinRequests chat_id:int53 invite_link:string approve:Bool = Ok; +//@description Approves a suggested post in a channel direct messages chat +//@chat_id Chat identifier of the channel direct messages chat +//@message_id Identifier of the message with the suggested post. Use messageProperties.can_be_approved to check whether the suggested post can be approved +//@send_date Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date has already been chosen. If specified, +//-then the date must be in the future, but at most getOption("suggested_post_send_delay_max") seconds in the future +approveSuggestedPost chat_id:int53 message_id:int53 send_date:int32 = Ok; + +//@description Declines a suggested post in a channel direct messages chat +//@chat_id Chat identifier of the channel direct messages chat +//@message_id Identifier of the message with the suggested post. Use messageProperties.can_be_declined to check whether the suggested post can be declined +//@comment Comment for the creator of the suggested post; 0-128 characters +declineSuggestedPost chat_id:int53 message_id:int53 comment:string = Ok; + +//@description Sent a suggested post based on a previously sent message in a channel direct messages chat. Can be also used to suggest price or time change for an existing suggested post. +//-Returns the sent message +//@chat_id Identifier of the channel direct messages chat +//@message_id Identifier of the message in the chat which will be sent as suggested post. Use messageProperties.can_add_offer to check whether an offer can be added +//-or messageProperties.can_edit_suggested_post_info to check whether price or time of sending of the post can be changed +//@options Options to be used to send the message. New information about the suggested post must always be specified +addOffer chat_id:int53 message_id:int53 options:messageSendOptions = Message; + + //@description Creates a new call //@user_id Identifier of the user to be called //@protocol The call protocols supported by the application @@ -12078,7 +12272,7 @@ getWebPageInstantView url:string only_local:Bool = WebPageInstantView; //@description Changes a profile photo for the current user //@photo Profile photo to set -//@is_public Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings +//@is_public Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings setProfilePhoto photo:InputChatPhoto is_public:Bool = Ok; //@description Deletes a profile photo @profile_photo_id Identifier of the profile photo to delete @@ -12541,7 +12735,7 @@ getAvailableGifts = AvailableGifts; //@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; -//@description Sells a gift for Telegram Stars +//@description Sells a gift for Telegram Stars; requires owner privileges for gifts owned by a chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@received_gift_id Identifier of the gift sellGift business_connection_id:string received_gift_id:string = Ok; @@ -12615,7 +12809,7 @@ getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; //-The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; -//@description Returns upgraded gifts that can be bought from other owners +//@description Returns upgraded gifts that can be bought from other owners using sendResoldGift //@gift_id Identifier of the regular gift that was upgraded to a unique gift //@order Order in which the results will be sorted //@attributes Attributes used to filter received gifts. If multiple attributes of the same type are specified, then all of them are allowed. @@ -12823,9 +13017,15 @@ getChatRevenueWithdrawalUrl chat_id:int53 password:string = HttpUrl; //@description Returns the list of revenue transactions for a chat. Currently, this method can be used only //-for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true //@chat_id Chat identifier -//@offset Number of transactions to skip -//@limit The maximum number of transactions to be returned; up to 200 -getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueTransactions; +//@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of transactions to be returned; up to 100 +getChatRevenueTransactions chat_id:int53 offset:string limit:int32 = ChatRevenueTransactions; + +//@description Returns the list of Toncoin transactions of the current user +//@direction Direction of the transactions to receive; pass null to get all transactions +//@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of transactions to return +getTonTransactions direction:TransactionDirection offset:string limit:int32 = TonTransactions; //@description Returns detailed Telegram Star revenue statistics @@ -12835,7 +13035,7 @@ getStarRevenueStatistics owner_id:MessageSender is_dark:Bool = StarRevenueStatis //@description Returns a URL for Telegram Star withdrawal //@owner_id Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat -//@star_count The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") +//@star_count The number of Telegram Stars to withdraw; must be between getOption("star_withdrawal_count_min") and getOption("star_withdrawal_count_max") //@password The 2-step verification password of the current user getStarWithdrawalUrl owner_id:MessageSender star_count:int53 password:string = HttpUrl; @@ -13138,7 +13338,7 @@ getStarGiveawayPaymentOptions = StarGiveawayPaymentOptions; //@direction Direction of the transactions to receive; pass null to get all transactions //@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of transactions to return -getStarTransactions owner_id:MessageSender subscription_id:string direction:StarTransactionDirection offset:string limit:int32 = StarTransactions; +getStarTransactions owner_id:MessageSender subscription_id:string direction:TransactionDirection offset:string limit:int32 = StarTransactions; //@description Returns the list of Telegram Star subscriptions for the current user //@only_expiring Pass true to receive only expiring subscriptions for which there are no enough Telegram Stars to extend From 9b94728dda1bfb84c99c68a27ddab439f42318d1 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 19 Sep 2025 19:09:58 +0800 Subject: [PATCH 24/29] Update to TDLib 1.8.54 --- data/td_api.tl | 396 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 350 insertions(+), 46 deletions(-) diff --git a/data/td_api.tl b/data/td_api.tl index deb1b8f..60c5f4f 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -894,14 +894,27 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool can_manage_direct_messages:Bool is_anonymous:Bool = ChatAdministratorRights; +//@class GiftResalePrice @description Describes price of a resold gift + +//@description Describes price of a resold gift in Telegram Stars +//@star_count The amount of Telegram Stars expected to be paid for the gift. Must be in range +//-getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max") for gifts put for resale +giftResalePriceStar star_count:int53 = GiftResalePrice; + +//@description Describes price of a resold gift in Toncoins +//@toncoin_cent_count The amount of 1/100 of Toncoin expected to be paid for the gift. Must be in range +//-getOption("gift_resale_toncoin_cent_count_min")-getOption("gift_resale_toncoin_cent_count_max") +giftResalePriceTon toncoin_cent_count:int53 = GiftResalePrice; + + //@class SuggestedPostPrice @description Describes price of a suggested post //@description Describes price of a suggested post in Telegram Stars -//@star_count The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") +//@star_count The amount of Telegram Stars expected to be paid for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") suggestedPostPriceStar star_count:int53 = SuggestedPostPrice; //@description Describes price of a suggested post in Toncoins -//@toncoin_cent_count The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") +//@toncoin_cent_count The amount of 1/100 of Toncoin expected to be paid for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") suggestedPostPriceTon toncoin_cent_count:int53 = SuggestedPostPrice; @@ -1161,6 +1174,28 @@ acceptedGiftTypes unlimited_gifts:Bool limited_gifts:Bool upgraded_gifts:Bool pr giftSettings show_gift_button:Bool accepted_gift_types:acceptedGiftTypes = GiftSettings; +//@description Describes the maximum number of times that a specific gift can be purchased +//@total_count The maximum number of times the gifts can be purchased +//@remaining_count Number of remaining times the gift can be purchased +giftPurchaseLimits total_count:int32 remaining_count:int32 = GiftPurchaseLimits; + +//@description Describes parameters of a unique gift available for resale +//@star_count Resale price of the gift in Telegram Stars +//@toncoin_cent_count Resale price of the gift in 1/100 of Toncoin +//@toncoin_only True, if the gift can be bought only using Toncoins +giftResaleParameters star_count:int53 toncoin_cent_count:int53 toncoin_only:Bool = GiftResaleParameters; + +//@description Describes collection of gifts +//@id Unique identifier of the collection +//@name Name of the collection +//@icon Icon of the collection; may be null if none +//@gift_count Total number of gifts in the collection +giftCollection id:int32 name:string icon:sticker gift_count:int32 = GiftCollection; + +//@description Contains a list of gift collections @collections List of gift collections +giftCollections collections:vector = GiftCollections; + + //@class UpgradedGiftOrigin @description Describes origin from which the upgraded gift was obtained //@description The gift was obtained by upgrading of a previously received gift @@ -1170,8 +1205,11 @@ upgradedGiftOriginUpgrade gift_message_id:int53 = UpgradedGiftOrigin; //@description The gift was transferred from another owner upgradedGiftOriginTransfer = UpgradedGiftOrigin; -//@description The gift was bought from another user @star_count Number of Telegram Stars that were paid by the sender for the gift -upgradedGiftOriginResale star_count:int53 = UpgradedGiftOrigin; +//@description The gift was bought from another user @price Price paid by the sender for the gift +upgradedGiftOriginResale price:GiftResalePrice = UpgradedGiftOrigin; + +//@description The sender or receiver of the message has paid for upgraid of the gift, which has been completed +upgradedGiftOriginPrepaidUpgrade = UpgradedGiftOrigin; //@description Describes a model of an upgraded gift @@ -1215,20 +1253,23 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed //@upgrade_star_count Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible //@is_for_birthday True, if the gift is a birthday gift -//@remaining_count Number of remaining times the gift can be purchased; 0 if not limited or the gift was sold out -//@total_count Number of total times the gift can be purchased; 0 if not limited +//@is_premium True, if the gift can be bought only by Telegram Premium subscribers +//@user_limits Number of times the gift can be purchased by the current user; may be null if not limited +//@overall_limits Number of times the gift can be purchased all users; may be null if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool is_premium:Bool user_limits:giftPurchaseLimits overall_limits:giftPurchaseLimits first_send_date:int32 last_send_date:int32 = Gift; //@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift +//@regular_gift_id Unique identifier of the regular gift from which the gift was upgraded; may be 0 for short period of time for old gifts from database //@publisher_chat_id Identifier of the chat that published the gift; 0 if none //@title The title of the upgraded gift //@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift //@total_upgraded_count Total number of gifts that were upgraded from the same gift //@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift +//@is_premium True, if the original gift could have been bought only by Telegram Premium subscribers //@owner_id Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown //@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address //@owner_name Name of the owner for the case when owner identifier and address aren't known @@ -1237,8 +1278,27 @@ gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_s //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown -//@resale_star_count Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible -upgradedGift id:int64 publisher_chat_id:int53 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; +//@resale_parameters Resale parameters of the gift; may be null if resale isn't possible +//@value_currency ISO 4217 currency code of the currency in which value of the gift is represented; may be empty if unavailable +//@value_amount Estimated value of the gift; in the smallest units of the currency; 0 if unavailable +upgradedGift id:int64 regular_gift_id:int64 publisher_chat_id:int53 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 is_premium:Bool owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_parameters:giftResaleParameters value_currency:string value_amount:int53 = UpgradedGift; + +//@description Contains information about value of an upgraded gift +//@currency ISO 4217 currency code of the currency in which the prices are represented +//@value Estimated value of the gift; in the smallest units of the currency +//@is_value_average True, if the value is calculated as average value of similar sold gifts. Otherwise, it is based on the sale price of the gift +//@initial_sale_date Point in time (Unix timestamp) when the corresponding regular gift was originally purchased +//@initial_sale_star_count Amount of Telegram Stars that were paid for the gift +//@initial_sale_price Initial price of the gift; in the smallest units of the currency +//@last_sale_date Point in time (Unix timestamp) when the upgraded gift was purchased last time; 0 if never +//@last_sale_price Last purchase price of the gift; in the smallest units of the currency; 0 if the gift has never been resold +//@is_last_sale_on_fragment True, if the last sale was completed on Fragment +//@minimum_price The current minimum price of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there are no such gifts +//@average_sale_price The average sale price in the last month of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there were no such sales +//@telegram_listed_gift_count Number of gifts upgraded from the same gift being resold on Telegram +//@fragment_listed_gift_count Number of gifts upgraded from the same gift being resold on Fragment +//@fragment_url The HTTPS link to the Fragment for the gift; may be empty if there are no such gifts being sold on Fragment +upgradedGiftValueInfo currency:string value:int53 is_value_average:Bool initial_sale_date:int32 initial_sale_star_count:int53 initial_sale_price:int53 last_sale_date:int32 last_sale_price:int53 is_last_sale_on_fragment:Bool minimum_price:int53 average_sale_price:int53 telegram_listed_gift_count:int32 fragment_listed_gift_count:int32 fragment_url:string = UpgradedGiftValueInfo; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1246,15 +1306,15 @@ upgradedGift id:int64 publisher_chat_id:int53 title:string name:string number:in //@is_saved True, if the gift is displayed on the user's or the channel's profile page //@can_be_transferred True, if the gift can be transferred to another owner //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift -//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible -//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = UpgradeGiftResult; //@description Describes a gift that is available for purchase //@gift The gift //@resale_count Number of gifts that are available for resale -//@min_resale_star_count The minimum price for the gifts available for resale; 0 if there are no such gifts +//@min_resale_star_count The minimum price for the gifts available for resale in Telegram Star equivalent; 0 if there are no such gifts //@title The title of the upgraded gift; empty if the gift isn't available for resale availableGift gift:gift resale_count:int32 min_resale_star_count:int53 title:string = AvailableGift; @@ -1311,6 +1371,15 @@ giftForResale gift:upgradedGift received_gift_id:string = GiftForResale; giftsForResale total_count:int32 gifts:vector models:vector symbols:vector backdrops:vector next_offset:string = GiftsForResale; +//@class GiftResaleResult @description Describes result of sending a resold gift + +//@description Operation was successfully completed +giftResaleResultOk = GiftResaleResult; + +//@description Operation has failed, because price has increased. If the price has decreased, then the buying will succeed anyway @price New price for the gift +giftResaleResultPriceIncreased price:GiftResalePrice = GiftResaleResult; + + //@class SentGift @description Represents content of a gift received by a user or a channel chat //@description Regular gift @gift The gift @@ -1332,13 +1401,15 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@was_refunded True, if the gift was refunded and isn't available anymore //@date Point in time (Unix timestamp) when the gift was sent //@gift The gift +//@collection_ids Identifiers of collections to which the gift is added; only for the receiver of the gift //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift -//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = ReceivedGift; +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift +//@prepaid_upgrade_hash If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift collection_ids:vector sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 prepaid_upgrade_hash:string = ReceivedGift; //@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts @@ -1469,14 +1540,18 @@ starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; //@description The transaction is an upgrade of a gift; for regular users only @user_id Identifier of the user that initially sent the gift @gift The upgraded gift starTransactionTypeGiftUpgrade user_id:int53 gift:upgradedGift = StarTransactionType; +//@description The transaction is a purchase of an upgrade of a gift owned by another user or channel; for regular users only @owner_id Owner of the upgraded gift @gift The gift +starTransactionTypeGiftUpgradePurchase owner_id:MessageSender gift:gift = StarTransactionType; + //@description The transaction is a purchase of an upgraded gift for some user or channel; for regular users only @user_id Identifier of the user that sold the gift @gift The gift starTransactionTypeUpgradedGiftPurchase user_id:int53 gift:upgradedGift = StarTransactionType; //@description The transaction is a sale of an upgraded gift; for regular users only //@user_id Identifier of the user that bought the gift //@gift The gift -//@affiliate Information about commission received by Telegram from the transaction -starTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift affiliate:affiliateInfo = StarTransactionType; +//@commission_per_mille The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars received by the seller of the gift +//@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds +starTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat @@ -1523,6 +1598,9 @@ starTransactionTypeBusinessBotTransferSend user_id:int53 = StarTransactionType; //@description The transaction is a transfer of Telegram Stars from a business account; for bots only @user_id Identifier of the user that sent Telegram Stars starTransactionTypeBusinessBotTransferReceive user_id:int53 = StarTransactionType; +//@description The transaction is a payment for search of posts in public Telegram channels; for regular users only +starTransactionTypePublicPostSearch = StarTransactionType; + //@description The transaction is a transaction of an unsupported type starTransactionTypeUnsupported = StarTransactionType; @@ -1552,6 +1630,16 @@ tonTransactionTypeFragmentDeposit is_gift:Bool sticker:sticker = TonTransactionT //@description The transaction is a payment for a suggested post @chat_id Identifier of the channel chat that posted the post tonTransactionTypeSuggestedPostPayment chat_id:int53 = TonTransactionType; +//@description The transaction is a purchase of an upgraded gift for some user or channel; for regular users only @user_id Identifier of the user that sold the gift @gift The gift +tonTransactionTypeUpgradedGiftPurchase user_id:int53 gift:upgradedGift = TonTransactionType; + +//@description The transaction is a sale of an upgraded gift; for regular users only +//@user_id Identifier of the user that bought the gift +//@gift The gift +//@commission_per_mille The number of Toncoins received by the Telegram for each 1000 Toncoins received by the seller of the gift +//@commission_toncoin_amount The amount of Toncoins that were received by the Telegram; in the smallest units of the currency +tonTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift commission_per_mille:int32 commission_toncoin_amount:int53 = TonTransactionType; + //@description The transaction is a transaction of an unsupported type tonTransactionTypeUnsupported = TonTransactionType; @@ -1642,6 +1730,24 @@ profileAccentColors palette_colors:vector background_colors:vector profileAccentColor id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_supergroup_chat_boost_level:int32 min_channel_chat_boost_level:int32 = ProfileAccentColor; +//@description Contains description of user rating +//@level The level of the user; may be negative +//@is_maximum_level_reached True, if the maximum level is reached +//@rating Numerical value of the rating +//@current_level_rating The rating required for the current level +//@next_level_rating The rating required for the next level; 0 if the maximum level is reached +userRating level:int32 is_maximum_level_reached:Bool rating:int53 current_level_rating:int53 next_level_rating:int53 = UserRating; + +//@description Contains information about restrictions that must be applied to a chat or a message +//@restriction_reason A human-readable description of the reason why access to the content must be restricted. If empty, then the content can be accessed, +//-but may be covered by hidden with 18+ spoiler anyway +//@has_sensitive_content True, if media content of the messages must be hidden with 18+ spoiler. +//-Use value of the option "can_ignore_sensitive_content_restrictions" to check whether the current user can ignore the restriction. +//-If age verification parameters were received in updateAgeVerificationParameters, then the user must complete age verification to ignore the restriction. +//-Set the option "ignore_sensitive_content_restrictions" to true if the user passes age verification +restrictionInfo restriction_reason:string has_sensitive_content:Bool = RestrictionInfo; + + //@class EmojiStatusType @description Describes type of emoji status //@description A custom emoji set as emoji status @custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format @@ -1696,7 +1802,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@verification_status Information about verification status of the user; may be null if none //@is_premium True, if the user is a Telegram Premium user //@is_support True, if the user is Telegram support account -//@restriction_reason If non-empty, it contains a human-readable description of the reason why access to this user must be restricted +//@restriction_info Information about restrictions that must be applied to the corresponding private chat; may be null if none //@has_active_stories True, if the user has non-expired stories available to the current user //@has_unread_active_stories True, if the user has unread non-expired stories available to the current user //@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them @@ -1705,7 +1811,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool paid_message_star_count:int53 have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_info:restrictionInfo has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool paid_message_star_count:int53 have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -1759,9 +1865,12 @@ botInfo short_description:string description:string photo:photo animation:animat //@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the user //@gift_settings Settings for gift receiving for the user //@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown +//@rating The current rating of the user; may be null if none +//@pending_rating The rating of the user after the next change; may be null if the user isn't the current user or there are no pending rating changes +//@pending_rating_date Unix timestamp when rating of the user will change to pending_rating; 0 if the user isn't the current user or there are no pending rating changes //@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 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 gift_settings:giftSettings bot_verification:botVerification 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 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 gift_settings:giftSettings bot_verification:botVerification rating:userRating pending_rating:userRating pending_rating_date: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; @@ -2006,12 +2115,11 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@verification_status Information about verification status of the supergroup or channel; may be null if none //@has_direct_messages_group True, if the channel has direct messages group //@has_forum_tabs True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups -//@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler -//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted +//@restriction_info Information about the restrictions that must be applied to the corresponding supergroup or channel chat; may be null if none //@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_direct_messages_group:Bool is_administered_direct_messages_group:Bool verification_status:verificationStatus has_direct_messages_group:Bool has_forum_tabs:Bool has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_direct_messages_group:Bool is_administered_direct_messages_group:Bool verification_status:verificationStatus has_direct_messages_group:Bool has_forum_tabs:Bool restriction_info:restrictionInfo paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -2081,6 +2189,15 @@ secretChatStateClosed = SecretChatState; secretChat id:int32 user_id:int53 state:SecretChatState is_outbound:Bool key_hash:bytes layer:int32 = SecretChat; +//@description Contains information about public post search limits +//@daily_free_query_count Number of queries that can be sent daily for free +//@remaining_free_query_count Number of remaining free queries today +//@next_free_query_in Amount of time till the next free query can be sent; 0 if it can be sent now +//@star_count Number of Telegram Stars that must be paid for each non-free query +//@is_current_query_free True, if the search for the specified query isn't charged +publicPostSearchLimits daily_free_query_count:int32 remaining_free_query_count:int32 next_free_query_in:int32 star_count:int64 is_current_query_free:Bool = PublicPostSearchLimits; + + //@class MessageSender @description Contains information about the sender of a message //@description The message was sent by a known user @user_id Identifier of the user that sent the message @@ -2377,11 +2494,10 @@ factCheck text:formattedText country_code:string = FactCheck; //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums //@effect_id Unique identifier of the effect added to the message; 0 if none -//@has_sensitive_content True, if media content of the message must be hidden with 18+ spoiler -//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted +//@restriction_info Information about the restrictions that must be applied to the message content; may be null if none //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_paid_star_suggested_post:Bool is_paid_ton_suggested_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck suggested_post_info:suggestedPostInfo reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_paid_star_suggested_post:Bool is_paid_ton_suggested_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck suggested_post_info:suggestedPostInfo reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 restriction_info:restrictionInfo content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2393,6 +2509,13 @@ foundMessages total_count:int32 messages:vector next_offset:string = Fo //@description Contains a list of messages found by a search in a given chat @total_count Approximate total number of messages found; -1 if unknown @messages List of messages @next_from_message_id The offset for the next request. If 0, there are no more results foundChatMessages total_count:int32 messages:vector next_from_message_id:int53 = FoundChatMessages; +//@description Contains a list of messages found by a public post search +//@messages List of found public posts +//@next_offset The offset for the next request. If empty, then there are no more results +//@search_limits Updated public post search limits after the query; repeated requests with the same query will be free; may be null if they didn't change +//@are_limits_exceeded True, if the query has failed because search limits are exceeded. In this case search_limits.daily_free_query_count will be equal to 0 +foundPublicPosts messages:vector next_offset:string search_limits:publicPostSearchLimits are_limits_exceeded:Bool = FoundPublicPosts; + //@description Contains information about a message in a specific position @position 0-based message position in the full list of suitable messages @message_id Message identifier @date Point in time (Unix timestamp) when the message was sent messagePosition position:int32 message_id:int53 date:int32 = MessagePosition; @@ -3465,6 +3588,10 @@ linkPreviewTypeChannelBoost photo:chatPhoto = LinkPreviewType; //@creates_join_request True, if the link only creates join request linkPreviewTypeChat type:InviteLinkChatType photo:chatPhoto creates_join_request:Bool = LinkPreviewType; +//@description The link is a link to a direct messages chat of a channel +//@photo Photo of the channel chat; may be null +linkPreviewTypeDirectMessagesChat photo:chatPhoto = LinkPreviewType; + //@description The link is a link to a general file @document The document description linkPreviewTypeDocument document:document = LinkPreviewType; @@ -3506,6 +3633,9 @@ linkPreviewTypeExternalAudio url:string mime_type:string duration:int32 = LinkPr //@duration Duration of the video, in seconds; 0 if unknown linkPreviewTypeExternalVideo url:string mime_type:string width:int32 height:int32 duration:int32 = LinkPreviewType; +//@description The link is a link to a gift collection @icons Icons for some gifts from the collection; may be empty +linkPreviewTypeGiftCollection icons:vector = LinkPreviewType; + //@description The link is a link to a group call that isn't bound to a chat linkPreviewTypeGroupCall = LinkPreviewType; @@ -3533,6 +3663,11 @@ linkPreviewTypeStickerSet stickers:vector = LinkPreviewType; //@description The link is a link to a story. Link preview description is unavailable @story_poster_chat_id The identifier of the chat that posted the story @story_id Story identifier linkPreviewTypeStory story_poster_chat_id:int53 story_id:int32 = LinkPreviewType; +//@description The link is a link to an album of stories +//@photo_icon Icon of the album; may be null if none +//@video_icon Video icon of the album; may be null if none +linkPreviewTypeStoryAlbum photo_icon:photo video_icon:video = LinkPreviewType; + //@description The link is a link to boost a supergroup chat @photo Photo of the chat; may be null linkPreviewTypeSupergroupBoost photo:chatPhoto = LinkPreviewType; @@ -4457,7 +4592,7 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@description A regular gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift -//@sender_id Sender of the gift +//@sender_id Sender of the gift; may be null for outgoing messages about prepaid upgrade of gifts from unknown users //@receiver_id Receiver of the gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@text Message added to the gift @@ -4465,12 +4600,14 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade 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 or the channel's profile page; only for the receiver of the gift +//@is_prepaid_upgrade True, if the message is about prepaid upgrade of the gift by another user //@can_be_upgraded True, if the gift can be upgraded to a unique gift; 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 //@was_upgraded True, if the gift was upgraded to a unique gift //@was_refunded True, if the gift was refunded and isn't available anymore //@upgraded_received_gift_id Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift -messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; +//@prepaid_upgrade_hash If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade +messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool is_prepaid_upgrade:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string prepaid_upgrade_hash:string = MessageContent; //@description An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift @@ -4482,9 +4619,9 @@ messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received //@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift //@was_transferred True, if the gift has already been transferred to another owner; only for the receiver of the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift -//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender origin:UpgradedGiftOrigin received_gift_id:string is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded @@ -5336,6 +5473,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@is_edited True, if the story was edited //@is_posted_to_chat_page True, if the story is saved in the profile of the chat that posted it and will be available there after expiration //@is_visible_only_for_self True, if the story is visible only for the current user +//@can_be_added_to_album True, if the story can be added to an album //@can_be_deleted True, if the story can be deleted //@can_be_edited True, if the story can be edited //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden @@ -5351,7 +5489,8 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story id:int32 poster_chat_id:int53 poster_id:MessageSender date:int32 is_being_posted:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +//@album_ids Identifiers of story albums to which the story is added; only for manageable stories +story id:int32 poster_chat_id:int53 poster_id:MessageSender date:int32 is_being_posted:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_added_to_album:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText album_ids:vector = Story; //@description Represents a list of stories //@total_count Approximate total number of stories found @@ -5362,6 +5501,16 @@ stories total_count:int32 stories:vector pinned_story_ids:vector = //@description Contains a list of stories found by a search @total_count Approximate total number of stories found @stories List of stories @next_offset The offset for the next request. If empty, then there are no more results foundStories total_count:int32 stories:vector next_offset:string = FoundStories; +//@description Describes album of stories +//@id Unique identifier of the album +//@name Name of the album +//@photo_icon Icon of the album; may be null if none +//@video_icon Video icon of the album; may be null if none +storyAlbum id:int32 name:string photo_icon:photo video_icon:video = StoryAlbum; + +//@description Represents a list of story albums @albums List of story albums +storyAlbums albums:vector = StoryAlbums; + //@description Contains identifier of a story along with identifier of the chat that posted it //@poster_chat_id Identifier of the chat that posted the story //@story_id Unique story identifier among stories of the chat @@ -5377,9 +5526,11 @@ storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; //@chat_id Identifier of the chat that posted the stories //@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list //@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order +//@can_be_archived True, if the stories are shown in the main story list and can be archived; otherwise, the stories can be hidden from the main story list +//-only by calling removeTopChat with topChatCategoryUsers and the chat_id. Stories of the current user can't be archived nor hidden using removeTopChat //@max_read_story_id Identifier of the last read active story //@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) -chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; +chatActiveStories chat_id:int53 list:StoryList order:int53 can_be_archived:Bool max_read_story_id:int32 stories:vector = ChatActiveStories; //@class StoryInteractionType @description Describes type of interaction with a story @@ -7759,6 +7910,11 @@ internalLinkTypeChatInvite invite_link:string = InternalLinkType; //@description The link is a link to the default message auto-delete timer settings section of the application settings internalLinkTypeDefaultMessageAutoDeleteTimerSettings = InternalLinkType; +//@description The link is a link to a channel direct messages chat by username of the channel. Call searchPublicChat with the given chat username to process the link. +//-If the chat is found and is channel, open the direct messages chat of the channel +//@channel_username Username of the channel +internalLinkTypeDirectMessagesChat channel_username:string = InternalLinkType; + //@description The link is a link to the edit profile section of the application settings internalLinkTypeEditProfileSettings = InternalLinkType; @@ -7768,6 +7924,12 @@ internalLinkTypeEditProfileSettings = InternalLinkType; //@game_short_name Short name of the game internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkType; +//@description The link is a link to a gift collection. Call searchPublicChat with the given username, then call getReceivedGifts with the received gift owner identifier +//-and the given collection identifier, then show the collection if received +//@gift_owner_username Username of the owner of the gift collection +//@collection_id Gift collection identifier +internalLinkTypeGiftCollection gift_owner_username:string collection_id:int32 = InternalLinkType; + //@description The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. //-Call joinGroupCall with the given invite_link to join the call //@invite_link Internal representation of the invite link @@ -7882,6 +8044,12 @@ internalLinkTypeStickerSet sticker_set_name:string expect_custom_emoji:Bool = In //@story_id Story identifier internalLinkTypeStory story_poster_username:string story_id:int32 = InternalLinkType; +//@description The link is a link to an album of stories. Call searchPublicChat with the given username, then call getStoryAlbumStories with the received chat identifier +//-and the given story album identifier, then show the story album if received +//@story_album_owner_username Username of the owner of the story album +//@story_album_id Story album identifier +internalLinkTypeStoryAlbum story_album_owner_username:string story_album_id:int32 = InternalLinkType; + //@description The link is a link to a cloud theme. TDLib has no theme support yet @theme_name Name of the theme internalLinkTypeTheme theme_name:string = InternalLinkType; @@ -8171,6 +8339,13 @@ connectionStateUpdating = ConnectionState; connectionStateReady = ConnectionState; +//@description Describes parameters for age verification of the current user +//@min_age The minimum age required to view restricted content +//@verification_bot_username Username of the bot which main Web App may be used to verify age of the user +//@country Unique name for the country or region, which legislation required age verification. May be used to get the corresponding localization key +ageVerificationParameters min_age:int32 verification_bot_username:string country:string = AgeVerificationParameters; + + //@class TopChatCategory @description Represents the categories of chats for which a list of frequently used chats can be retrieved //@description A category containing frequently used private chats with non-bot users @@ -8810,7 +8985,7 @@ updateDirectMessagesChatTopic topic:directMessagesChatTopic = Update; //@description Number of messages in a topic has changed; for Saved Messages and channel direct messages chat topics only //@chat_id Identifier of the chat in topic of which the number of messages has changed //@topic_id Identifier of the topic -//@message_count Approximate number of messages in the topics +//@message_count Approximate number of messages in the topic updateTopicMessageCount chat_id:int53 topic_id:MessageTopic message_count:int32 = Update; //@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application @@ -9087,6 +9262,10 @@ updateConnectionState state:ConnectionState = Update; //@appeal_link The link to open to send an appeal to unfreeze the account updateFreezeState is_frozen:Bool freezing_date:int32 deletion_date:int32 appeal_link:string = Update; +//@description The parameters for age verification of the current user's account has changed +//@parameters Parameters for the age verification; may be null if age verification isn't needed +updateAgeVerificationParameters parameters:ageVerificationParameters = Update; + //@description New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" @terms_of_service_id Identifier of the terms of service @terms_of_service The new terms of service updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService = Update; @@ -9923,6 +10102,16 @@ searchCallMessages offset:string limit:int32 only_missed:Bool = FoundMessages; //@limit The maximum number of messages to be returned; up to 100 searchOutgoingDocumentMessages query:string limit:int32 = FoundMessages; +//@description Checks public post search limits without actually performing the search @query Query that will be searched for +getPublicPostSearchLimits query:string = PublicPostSearchLimits; + +//@description Searches for public channel posts using the given query. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@query Query to search for +//@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 messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@star_count The amount of Telegram Stars the user agreed to pay for the search; pass 0 for free searches +searchPublicPosts query:string offset:string limit:int32 star_count:int53 = FoundPublicPosts; + //@description Searches for public channel posts containing the given hashtag or cashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@tag Hashtag or cashtag to search for //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -11362,11 +11551,12 @@ canPostStory chat_id:int53 = CanPostStoryResult; //@areas Clickable rectangle areas to be shown on the story media; pass null if none //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") //@privacy_settings The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats +//@album_ids Identifiers of story albums to which the story will be added upon posting. An album can have up to getOption("story_album_story_count_max") //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@from_story_full_id Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story //@is_posted_to_chat_page Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -postStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; +postStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings album_ids:vector active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; //@description Changes content and caption of a story. Can be called only if story.can_be_edited == true //@story_poster_chat_id Identifier of the chat that posted the story @@ -11491,6 +11681,60 @@ activateStoryStealthMode = Ok; //@limit The maximum number of messages and stories 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 getStoryPublicForwards story_poster_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; +//@description Returns the list of story albums owned by the given chat @chat_id Chat identifier +getChatStoryAlbums chat_id:int53 = StoryAlbums; + +//@description Returns the list of stories added to the given story album. For optimal performance, the number of returned stories is chosen by TDLib +//@chat_id Chat identifier +//@story_album_id Story album identifier +//@offset Offset of the first entry to return; use 0 to get results from the first album story +//@limit The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +getStoryAlbumStories chat_id:int53 story_album_id:int32 offset:int32 limit:int32 = Stories; + +//@description Creates an album of stories; requires can_edit_stories administrator right for supergroup and channel chats +//@story_poster_chat_id Identifier of the chat that posted the stories +//@name Name of the album; 1-12 characters +//@story_ids Identifiers of stories to add to the album; 0-getOption("story_album_story_count_max") identifiers +createStoryAlbum story_poster_chat_id:int53 name:string story_ids:vector = StoryAlbum; + +//@description Changes order of story albums. If the albums are owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +//@chat_id Identifier of the chat that owns the stories +//@story_album_ids New order of story albums +reorderStoryAlbums chat_id:int53 story_album_ids:vector = Ok; + +//@description Deletes a story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +deleteStoryAlbum chat_id:int53 story_album_id:int32 = Ok; + +//@description Changes name of an album of stories. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@name New name of the album; 1-12 characters +setStoryAlbumName chat_id:int53 story_album_id:int32 name:string = StoryAlbum; + +//@description Adds stories to the beginning of a previously created story album. If the album is owned by a supergroup or a channel chat, then +//-requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@story_ids Identifier of the stories to add to the album; 1-getOption("story_album_story_count_max") identifiers. +//-If after addition the album has more than getOption("story_album_story_count_max") stories, then the last one are removed from the album +addStoryAlbumStories chat_id:int53 story_album_id:int32 story_ids:vector = StoryAlbum; + +//@description Removes stories from an album. If the album is owned by a supergroup or a channel chat, then +//-requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@story_ids Identifier of the stories to remove from the album +removeStoryAlbumStories chat_id:int53 story_album_id:int32 story_ids:vector = StoryAlbum; + +//@description Changes order of stories in an album. If the album is owned by a supergroup or a channel chat, then +//-requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@story_ids Identifier of the stories to move to the beginning of the album. All other stories are placed in the current order after the specified stories +reorderStoryAlbumStories chat_id:int53 story_album_id:int32 story_ids:vector = StoryAlbum; + //@description Returns the list of features available on the specific chat boost level. This is an offline method //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups @@ -12728,7 +12972,7 @@ getAvailableGifts = AvailableGifts; //@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send -//@owner_id Identifier of the user or the channel chat that will receive the gift +//@owner_id Identifier of the user or the channel chat that will receive the gift; limited gifts can't be sent to channel chats //@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. //-Must be empty if the receiver enabled paid messages //@is_private Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them @@ -12765,7 +13009,13 @@ getGiftUpgradePreview gift_id:int64 = GiftUpgradePreview; //@star_count The amount of Telegram Stars required to pay for the upgrade. It the gift has prepaid_upgrade_star_count > 0, then pass 0, otherwise, pass gift.upgrade_star_count upgradeGift business_connection_id:string received_gift_id:string keep_original_details:Bool star_count:int53 = UpgradeGiftResult; -//@description Sends an upgraded gift to another user or a channel chat +//@description Pays for upgrade of a regular gift that is owned by another user or channel chat +//@owner_id Identifier of the user or the channel chat that owns the gift +//@prepaid_upgrade_hash Prepaid upgrade hash as received along with the gift +//@star_count The amount of Telegram Stars the user agreed to pay for the upgrade; must be equal to gift.upgrade_star_count +buyGiftUpgrade owner_id:MessageSender prepaid_upgrade_hash:string star_count:int53 = Ok; + +//@description Sends an upgraded gift to another user or channel chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@received_gift_id Identifier of the gift //@new_owner_id Identifier of the user or the channel chat that will receive the gift @@ -12776,21 +13026,23 @@ transferGift business_connection_id:string received_gift_id:string new_owner_id: //-must be transferred using transferGift and can't be passed to the method //@gift_name Name of the upgraded gift to send //@owner_id Identifier of the user or the channel chat that will receive the gift -//@star_count The amount of Telegram Stars required to pay for the gift -sendResoldGift gift_name:string owner_id:MessageSender star_count:int53 = Ok; +//@price The price that the user agreed to pay for the gift +sendResoldGift gift_name:string owner_id:MessageSender price:GiftResalePrice = GiftResaleResult; //@description Returns gifts received by the given user or chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@owner_id Identifier of the gift receiver +//@collection_id Pass collection identifier to get gifts only from the specified collection; pass 0 to get gifts regardless of collections //@exclude_unsaved Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right //@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right //@exclude_unlimited Pass true to exclude gifts that can be purchased unlimited number of times -//@exclude_limited Pass true to exclude gifts that can be purchased limited number of times +//@exclude_upgradable Pass true to exclude gifts that can be purchased limited number of times and can be upgraded +//@exclude_non_upgradable Pass true to exclude gifts that can be purchased limited number of times and can't be upgraded //@exclude_upgraded Pass true to exclude upgraded gifts //@sort_by_price Pass true to sort results by gift price instead of send date //@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 -getReceivedGifts business_connection_id:string owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; +getReceivedGifts business_connection_id:string owner_id:MessageSender collection_id:int32 exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_upgradable:Bool exclude_non_upgradable:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; //@description Returns information about a received gift @received_gift_id Identifier of the gift getReceivedGift received_gift_id:string = ReceivedGift; @@ -12798,6 +13050,9 @@ getReceivedGift received_gift_id:string = ReceivedGift; //@description Returns information about an upgraded gift by its name @name Unique name of the upgraded gift getUpgradedGift name:string = UpgradedGift; +//@description Returns information about value of an upgraded gift by its name @name Unique name of the upgraded gift +getUpgradedGiftValueInfo name:string = UpgradedGiftValueInfo; + //@description Returns a URL for upgraded gift withdrawal in the TON blockchain as an NFT; requires owner privileges for gifts owned by a chat //@received_gift_id Identifier of the gift //@password The 2-step verification password of the current user @@ -12805,9 +13060,10 @@ getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; //@description Changes resale price of a unique gift owned by the current user //@received_gift_id Identifier of the unique gift -//@resale_star_count The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. -//-The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift -setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; +//@price The new price for the unique gift; pass null to disallow gift resale. The current user will receive +//-getOption("gift_resale_star_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift if the gift price is in Telegram Stars or +//-getOption("gift_resale_ton_earnings_per_mille") Toncoins for each 1000 Toncoins paid for the gift if the gift price is in Toncoins +setGiftResalePrice received_gift_id:string price:GiftResalePrice = Ok; //@description Returns upgraded gifts that can be bought from other owners using sendResoldGift //@gift_id Identifier of the regular gift that was upgraded to a unique gift @@ -12818,6 +13074,54 @@ setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; //@limit The maximum number of gifts to return searchGiftsForResale gift_id:int64 order:GiftForResaleOrder attributes:vector offset:string limit:int32 = GiftsForResale; + +//@description Returns collections of gifts owned by the given user or chat +//@owner_id Identifier of the user or the channel chat that received the gifts +getGiftCollections owner_id:MessageSender = GiftCollections; + +//@description Creates a collection from gifts on the current user's or a channel's profile page; requires can_post_messages administrator right in the channel chat. +//-An owner can have up to getOption("gift_collection_count_max") gift collections. The new collection will be added to the end of the gift collection list of the owner. Returns the created collection +//@owner_id Identifier of the user or the channel chat that received the gifts +//@name Name of the collection; 1-12 characters +//@received_gift_ids Identifier of the gifts to add to the collection; 0-getOption("gift_collection_gift_count_max") identifiers +createGiftCollection owner_id:MessageSender name:string received_gift_ids:vector = GiftCollection; + +//@description Changes order of gift collections. If the collections are owned by a channel chat, then requires can_post_messages administrator right in the channel chat +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_ids New order of gift collections +reorderGiftCollections owner_id:MessageSender collection_ids:vector = Ok; + +//@description Deletes a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +deleteGiftCollection owner_id:MessageSender collection_id:int32 = Ok; + +//@description Changes name of a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@name New name of the collection; 1-12 characters +setGiftCollectionName owner_id:MessageSender collection_id:int32 name:string = GiftCollection; + +//@description Adds gifts to the beginning of a previously created collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@received_gift_ids Identifier of the gifts to add to the collection; 1-getOption("gift_collection_gift_count_max") identifiers. +//-If after addition the collection has more than getOption("gift_collection_gift_count_max") gifts, then the last one are removed from the collection +addGiftCollectionGifts owner_id:MessageSender collection_id:int32 received_gift_ids:vector = GiftCollection; + +//@description Removes gifts from a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@received_gift_ids Identifier of the gifts to remove from the collection +removeGiftCollectionGifts owner_id:MessageSender collection_id:int32 received_gift_ids:vector = GiftCollection; + +//@description Changes order of gifts in a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@received_gift_ids Identifier of the gifts to move to the beginning of the collection. All other gifts are placed in the current order after the specified gifts +reorderGiftCollectionGifts owner_id:MessageSender collection_id:int32 received_gift_ids:vector = GiftCollection; + + //@description Creates a link for the given invoice; for bots only //@business_connection_id Unique identifier of business connection on behalf of which to send the request //@invoice Information about the invoice of the type inputMessageInvoice From 926224f7076b1aa73b8c217c70894feb11094b92 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 28 Sep 2025 17:55:16 +0800 Subject: [PATCH 25/29] Update to TDLib 1.8.55 --- client/function.go | 1021 ++++++++++++++++++++- client/type.go | 2033 +++++++++++++++++++++++++++++++++++++++-- client/unmarshaler.go | 907 +++++++++++++++++- data/td_api.tl | 250 ++++- 4 files changed, 4055 insertions(+), 156 deletions(-) diff --git a/client/function.go b/client/function.go index 63ba51e..46bce98 100755 --- a/client/function.go +++ b/client/function.go @@ -3435,6 +3435,67 @@ func (client *Client) SearchOutgoingDocumentMessages(req *SearchOutgoingDocument return UnmarshalFoundMessages(result.Data) } +type GetPublicPostSearchLimitsRequest struct { + // Query that will be searched for + Query string `json:"query"` +} + +// Checks public post search limits without actually performing the search +func (client *Client) GetPublicPostSearchLimits(req *GetPublicPostSearchLimitsRequest) (*PublicPostSearchLimits, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPublicPostSearchLimits", + }, + Data: map[string]interface{}{ + "query": req.Query, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPublicPostSearchLimits(result.Data) +} + +type SearchPublicPostsRequest struct { + // Query to search for + Query string `json:"query"` + // 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 messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` + // The amount of Telegram Stars the user agreed to pay for the search; pass 0 for free searches + StarCount int64 `json:"star_count"` +} + +// Searches for public channel posts using the given query. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicPosts(req *SearchPublicPostsRequest) (*FoundPublicPosts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicPosts", + }, + Data: map[string]interface{}{ + "query": req.Query, + "offset": req.Offset, + "limit": req.Limit, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundPublicPosts(result.Data) +} + type SearchPublicMessagesByTagRequest struct { // Hashtag or cashtag to search for Tag string `json:"tag"` @@ -9350,12 +9411,18 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(result.Data) + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(result.Data) + case TypeInternalLinkTypeEditProfileSettings: return UnmarshalInternalLinkTypeEditProfileSettings(result.Data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(result.Data) + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(result.Data) + case TypeInternalLinkTypeGroupCall: return UnmarshalInternalLinkTypeGroupCall(result.Data) @@ -9425,6 +9492,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(result.Data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(result.Data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(result.Data) @@ -10773,11 +10843,40 @@ func (client *Client) DeleteChatBackground(req *DeleteChatBackgroundRequest) (*O return UnmarshalOk(result.Data) } +type GetGiftChatThemesRequest struct { + // 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 chat themes to return + Limit int32 `json:"limit"` +} + +// Returns available to the current user gift chat themes +func (client *Client) GetGiftChatThemes(req *GetGiftChatThemesRequest) (*GiftChatThemes, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftChatThemes", + }, + Data: map[string]interface{}{ + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftChatThemes(result.Data) +} + type SetChatThemeRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Name of the new chat theme; pass an empty string to return the default theme - ThemeName string `json:"theme_name"` + // New chat theme; pass null to return the default theme + Theme InputChatTheme `json:"theme"` } // Changes the chat theme. Supported only in private and secret chats @@ -10788,7 +10887,7 @@ func (client *Client) SetChatTheme(req *SetChatThemeRequest) (*Ok, error) { }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "theme_name": req.ThemeName, + "theme": req.Theme, }, }) if err != nil { @@ -12143,6 +12242,8 @@ type PostStoryRequest struct { Caption *FormattedText `json:"caption"` // The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats PrivacySettings StoryPrivacySettings `json:"privacy_settings"` + // Identifiers of story albums to which the story will be added upon posting. An album can have up to getOption("story_album_story_count_max") + AlbumIds []int32 `json:"album_ids"` // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise ActivePeriod int32 `json:"active_period"` // Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story @@ -12165,6 +12266,7 @@ func (client *Client) PostStory(req *PostStoryRequest) (*Story, error) { "areas": req.Areas, "caption": req.Caption, "privacy_settings": req.PrivacySettings, + "album_ids": req.AlbumIds, "active_period": req.ActivePeriod, "from_story_full_id": req.FromStoryFullId, "is_posted_to_chat_page": req.IsPostedToChatPage, @@ -12840,6 +12942,285 @@ func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) return UnmarshalPublicForwards(result.Data) } +type GetChatStoryAlbumsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns the list of story albums owned by the given chat +func (client *Client) GetChatStoryAlbums(req *GetChatStoryAlbumsRequest) (*StoryAlbums, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatStoryAlbums", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbums(result.Data) +} + +type GetStoryAlbumStoriesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Story album identifier + StoryAlbumId int32 `json:"story_album_id"` + // Offset of the first entry to return; use 0 to get results from the first album story + Offset int32 `json:"offset"` + // The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns the list of stories added to the given story album. For optimal performance, the number of returned stories is chosen by TDLib +func (client *Client) GetStoryAlbumStories(req *GetStoryAlbumStoriesRequest) (*Stories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStories(result.Data) +} + +type CreateStoryAlbumRequest struct { + // Identifier of the chat that posted the stories + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // Name of the album; 1-12 characters + Name string `json:"name"` + // Identifiers of stories to add to the album; 0-getOption("story_album_story_count_max") identifiers + StoryIds []int32 `json:"story_ids"` +} + +// Creates an album of stories; requires can_edit_stories administrator right for supergroup and channel chats +func (client *Client) CreateStoryAlbum(req *CreateStoryAlbumRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createStoryAlbum", + }, + Data: map[string]interface{}{ + "story_poster_chat_id": req.StoryPosterChatId, + "name": req.Name, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type ReorderStoryAlbumsRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // New order of story albums + StoryAlbumIds []int32 `json:"story_album_ids"` +} + +// Changes order of story albums. If the albums are owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +func (client *Client) ReorderStoryAlbums(req *ReorderStoryAlbumsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderStoryAlbums", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_ids": req.StoryAlbumIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteStoryAlbumRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` +} + +// Deletes a story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +func (client *Client) DeleteStoryAlbum(req *DeleteStoryAlbumRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteStoryAlbum", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStoryAlbumNameRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // New name of the album; 1-12 characters + Name string `json:"name"` +} + +// Changes name of an album of stories. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) SetStoryAlbumName(req *SetStoryAlbumNameRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStoryAlbumName", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type AddStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to add to the album; 1-getOption("story_album_story_count_max") identifiers. If after addition the album has more than getOption("story_album_story_count_max") stories, then the last one are removed from the album + StoryIds []int32 `json:"story_ids"` +} + +// Adds stories to the beginning of a previously created story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) AddStoryAlbumStories(req *AddStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type RemoveStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to remove from the album + StoryIds []int32 `json:"story_ids"` +} + +// Removes stories from an album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) RemoveStoryAlbumStories(req *RemoveStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type ReorderStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to move to the beginning of the album. All other stories are placed in the current order after the specified stories + StoryIds []int32 `json:"story_ids"` +} + +// Changes order of stories in an album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) ReorderStoryAlbumStories(req *ReorderStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + type GetChatBoostLevelFeaturesRequest struct { // Pass true to get the list of features for channels; pass false to get the list of features for supergroups IsChannel bool `json:"is_channel"` @@ -16491,6 +16872,145 @@ func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*C return UnmarshalChatPhotos(result.Data) } +type GetUserProfileAudiosRequest struct { + // User identifier + UserId int64 `json:"user_id"` + // The number of audio files to skip; must be non-negative + Offset int32 `json:"offset"` + // The maximum number of audio files to be returned; up to 100 + Limit int32 `json:"limit"` +} + +// Returns the list of profile audio files of a user +func (client *Client) GetUserProfileAudios(req *GetUserProfileAudiosRequest) (*Audios, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserProfileAudios", + }, + 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 UnmarshalAudios(result.Data) +} + +type IsProfileAudioRequest struct { + // Identifier of the audio file to check + FileId int32 `json:"file_id"` +} + +// Checks whether a file is in the profile audio files of the current user. Returns a 404 error if it isn't +func (client *Client) IsProfileAudio(req *IsProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "isProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddProfileAudioRequest struct { + // Identifier of the audio file to be added. The file must have been uploaded to the server + FileId int32 `json:"file_id"` +} + +// Adds an audio file to the beginning of the profile audio files of the current user +func (client *Client) AddProfileAudio(req *AddProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetProfileAudioPositionRequest struct { + // Identifier of the file from profile audio files, which position will be changed + FileId int32 `json:"file_id"` + // Identifier of the file from profile audio files after which the file will be positioned; pass 0 to move the file to the beginning of the list + AfterFileId int32 `json:"after_file_id"` +} + +// Changes position of an audio file in the profile audio files of the current user +func (client *Client) SetProfileAudioPosition(req *SetProfileAudioPositionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setProfileAudioPosition", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "after_file_id": req.AfterFileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveProfileAudioRequest struct { + // Identifier of the audio file to be removed + FileId int32 `json:"file_id"` +} + +// Removes an audio file from the profile audio files of the current user +func (client *Client) RemoveProfileAudio(req *RemoveProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetStickerOutlineRequest struct { // File identifier of the sticker StickerFileId int32 `json:"sticker_file_id"` @@ -17947,6 +18467,32 @@ func (client *Client) SetBirthdate(req *SetBirthdateRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SetMainProfileTabRequest struct { + // The new value of the main profile tab + MainProfileTab ProfileTab `json:"main_profile_tab"` +} + +// Changes the main profile tab of the current user +func (client *Client) SetMainProfileTab(req *SetMainProfileTabRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMainProfileTab", + }, + Data: map[string]interface{}{ + "main_profile_tab": req.MainProfileTab, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetPersonalChatRequest struct { // Identifier of the new personal chat; pass 0 to remove the chat. Use getSuitablePersonalChats to get suitable chats ChatId int64 `json:"chat_id"` @@ -19830,6 +20376,35 @@ func (client *Client) SetSupergroupUnrestrictBoostCount(req *SetSupergroupUnrest return UnmarshalOk(result.Data) } +type SetSupergroupMainProfileTabRequest struct { + // Identifier of the channel + SupergroupId int64 `json:"supergroup_id"` + // The new value of the main profile tab + MainProfileTab ProfileTab `json:"main_profile_tab"` +} + +// Changes the main profile tab of the channel; requires can_change_info administrator right +func (client *Client) SetSupergroupMainProfileTab(req *SetSupergroupMainProfileTabRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupMainProfileTab", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "main_profile_tab": req.MainProfileTab, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupSignMessagesRequest struct { // Identifier of the channel SupergroupId int64 `json:"supergroup_id"` @@ -20535,10 +21110,45 @@ func (client *Client) GetAvailableGifts() (*AvailableGifts, error) { return UnmarshalAvailableGifts(result.Data) } +type CanSendGiftRequest struct { + // Identifier of the gift to send + GiftId JsonInt64 `json:"gift_id"` +} + +// Checks whether a gift with next_send_date in the future can be sent already +func (client *Client) CanSendGift(req *CanSendGiftRequest) (CanSendGiftResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canSendGift", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(result.Data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type SendGiftRequest struct { // Identifier of the gift to send GiftId JsonInt64 `json:"gift_id"` - // Identifier of the user or the channel chat that will receive the gift + // Identifier of the user or the channel chat that will receive the gift; limited gifts can't be sent to channel chats OwnerId MessageSender `json:"owner_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. Must be empty if the receiver enabled paid messages Text *FormattedText `json:"text"` @@ -20750,6 +21360,38 @@ func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, return UnmarshalUpgradeGiftResult(result.Data) } +type BuyGiftUpgradeRequest struct { + // Identifier of the user or the channel chat that owns the gift + OwnerId MessageSender `json:"owner_id"` + // Prepaid upgrade hash as received along with the gift + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` + // The amount of Telegram Stars the user agreed to pay for the upgrade; must be equal to gift.upgrade_star_count + StarCount int64 `json:"star_count"` +} + +// Pays for upgrade of a regular gift that is owned by another user or channel chat +func (client *Client) BuyGiftUpgrade(req *BuyGiftUpgradeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "buyGiftUpgrade", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "prepaid_upgrade_hash": req.PrepaidUpgradeHash, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type TransferGiftRequest struct { // Unique identifier of business connection on behalf of which to send the request; for bots only BusinessConnectionId string `json:"business_connection_id"` @@ -20761,7 +21403,7 @@ type TransferGiftRequest struct { StarCount int64 `json:"star_count"` } -// Sends an upgraded gift to another user or a channel chat +// Sends an upgraded gift to another user or channel chat func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -20790,12 +21432,12 @@ type SendResoldGiftRequest struct { GiftName string `json:"gift_name"` // Identifier of the user or the channel chat that will receive the gift OwnerId MessageSender `json:"owner_id"` - // The amount of Telegram Stars required to pay for the gift - StarCount int64 `json:"star_count"` + // The price that the user agreed to pay for the gift + Price GiftResalePrice `json:"price"` } // Sends an upgraded gift that is available for resale to another user or channel chat; gifts already owned by the current user must be transferred using transferGift and can't be passed to the method -func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { +func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (GiftResaleResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "sendResoldGift", @@ -20803,7 +21445,7 @@ func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { Data: map[string]interface{}{ "gift_name": req.GiftName, "owner_id": req.OwnerId, - "star_count": req.StarCount, + "price": req.Price, }, }) if err != nil { @@ -20814,7 +21456,16 @@ func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(result.Data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(result.Data) + + default: + return nil, errors.New("invalid type") + } } type GetReceivedGiftsRequest struct { @@ -20822,14 +21473,18 @@ type GetReceivedGiftsRequest struct { BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift receiver OwnerId MessageSender `json:"owner_id"` + // Pass collection identifier to get gifts only from the specified collection; pass 0 to get gifts regardless of collections + CollectionId int32 `json:"collection_id"` // Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right ExcludeUnsaved bool `json:"exclude_unsaved"` // Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right ExcludeSaved bool `json:"exclude_saved"` // Pass true to exclude gifts that can be purchased unlimited number of times ExcludeUnlimited bool `json:"exclude_unlimited"` - // Pass true to exclude gifts that can be purchased limited number of times - ExcludeLimited bool `json:"exclude_limited"` + // Pass true to exclude gifts that can be purchased limited number of times and can be upgraded + ExcludeUpgradable bool `json:"exclude_upgradable"` + // Pass true to exclude gifts that can be purchased limited number of times and can't be upgraded + ExcludeNonUpgradable bool `json:"exclude_non_upgradable"` // Pass true to exclude upgraded gifts ExcludeUpgraded bool `json:"exclude_upgraded"` // Pass true to sort results by gift price instead of send date @@ -20849,10 +21504,12 @@ func (client *Client) GetReceivedGifts(req *GetReceivedGiftsRequest) (*ReceivedG Data: map[string]interface{}{ "business_connection_id": req.BusinessConnectionId, "owner_id": req.OwnerId, + "collection_id": req.CollectionId, "exclude_unsaved": req.ExcludeUnsaved, "exclude_saved": req.ExcludeSaved, "exclude_unlimited": req.ExcludeUnlimited, - "exclude_limited": req.ExcludeLimited, + "exclude_upgradable": req.ExcludeUpgradable, + "exclude_non_upgradable": req.ExcludeNonUpgradable, "exclude_upgraded": req.ExcludeUpgraded, "sort_by_price": req.SortByPrice, "offset": req.Offset, @@ -20922,6 +21579,32 @@ func (client *Client) GetUpgradedGift(req *GetUpgradedGiftRequest) (*UpgradedGif return UnmarshalUpgradedGift(result.Data) } +type GetUpgradedGiftValueInfoRequest struct { + // Unique name of the upgraded gift + Name string `json:"name"` +} + +// Returns information about value of an upgraded gift by its name +func (client *Client) GetUpgradedGiftValueInfo(req *GetUpgradedGiftValueInfoRequest) (*UpgradedGiftValueInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftValueInfo", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpgradedGiftValueInfo(result.Data) +} + type GetUpgradedGiftWithdrawalUrlRequest struct { // Identifier of the gift ReceivedGiftId string `json:"received_gift_id"` @@ -20954,8 +21637,8 @@ func (client *Client) GetUpgradedGiftWithdrawalUrl(req *GetUpgradedGiftWithdrawa type SetGiftResalePriceRequest struct { // Identifier of the unique gift ReceivedGiftId string `json:"received_gift_id"` - // The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift - ResaleStarCount int64 `json:"resale_star_count"` + // The new price for the unique gift; pass null to disallow gift resale. The current user will receive getOption("gift_resale_star_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift if the gift price is in Telegram Stars or getOption("gift_resale_ton_earnings_per_mille") Toncoins for each 1000 Toncoins paid for the gift if the gift price is in Toncoins + Price GiftResalePrice `json:"price"` } // Changes resale price of a unique gift owned by the current user @@ -20966,7 +21649,7 @@ func (client *Client) SetGiftResalePrice(req *SetGiftResalePriceRequest) (*Ok, e }, Data: map[string]interface{}{ "received_gift_id": req.ReceivedGiftId, - "resale_star_count": req.ResaleStarCount, + "price": req.Price, }, }) if err != nil { @@ -21018,6 +21701,250 @@ func (client *Client) SearchGiftsForResale(req *SearchGiftsForResaleRequest) (*G return UnmarshalGiftsForResale(result.Data) } +type GetGiftCollectionsRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` +} + +// Returns collections of gifts owned by the given user or chat +func (client *Client) GetGiftCollections(req *GetGiftCollectionsRequest) (*GiftCollections, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftCollections", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollections(result.Data) +} + +type CreateGiftCollectionRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` + // Name of the collection; 1-12 characters + Name string `json:"name"` + // Identifier of the gifts to add to the collection; 0-getOption("gift_collection_gift_count_max") identifiers + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Creates a collection from gifts on the current user's or a channel's profile page; requires can_post_messages administrator right in the channel chat. An owner can have up to getOption("gift_collection_count_max") gift collections. The new collection will be added to the end of the gift collection list of the owner. Returns the created collection +func (client *Client) CreateGiftCollection(req *CreateGiftCollectionRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createGiftCollection", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "name": req.Name, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type ReorderGiftCollectionsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // New order of gift collections + CollectionIds []int32 `json:"collection_ids"` +} + +// Changes order of gift collections. If the collections are owned by a channel chat, then requires can_post_messages administrator right in the channel chat +func (client *Client) ReorderGiftCollections(req *ReorderGiftCollectionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderGiftCollections", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_ids": req.CollectionIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteGiftCollectionRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` +} + +// Deletes a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat +func (client *Client) DeleteGiftCollection(req *DeleteGiftCollectionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteGiftCollection", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetGiftCollectionNameRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // New name of the collection; 1-12 characters + Name string `json:"name"` +} + +// Changes name of a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) SetGiftCollectionName(req *SetGiftCollectionNameRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftCollectionName", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type AddGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to add to the collection; 1-getOption("gift_collection_gift_count_max") identifiers. If after addition the collection has more than getOption("gift_collection_gift_count_max") gifts, then the last one are removed from the collection + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Adds gifts to the beginning of a previously created collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) AddGiftCollectionGifts(req *AddGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type RemoveGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to remove from the collection + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Removes gifts from a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) RemoveGiftCollectionGifts(req *RemoveGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type ReorderGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to move to the beginning of the collection. All other gifts are placed in the current order after the specified gifts + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Changes order of gifts in a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) ReorderGiftCollectionGifts(req *ReorderGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + type CreateInvoiceLinkRequest struct { // Unique identifier of business connection on behalf of which to send the request BusinessConnectionId string `json:"business_connection_id"` @@ -22453,6 +23380,58 @@ func (client *Client) GetStarAdAccountUrl(req *GetStarAdAccountUrlRequest) (*Htt return UnmarshalHttpUrl(result.Data) } +type GetTonRevenueStatisticsRequest struct { + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed Toncoin revenue statistics of the current user +func (client *Client) GetTonRevenueStatistics(req *GetTonRevenueStatisticsRequest) (*TonRevenueStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonRevenueStatistics", + }, + Data: map[string]interface{}{ + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTonRevenueStatistics(result.Data) +} + +type GetTonWithdrawalUrlRequest struct { + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns a URL for Toncoin withdrawal from the current user's account. The user must have at least 10 toncoins to withdraw and can withdraw up to 100000 Toncoins in one transaction +func (client *Client) GetTonWithdrawalUrl(req *GetTonWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonWithdrawalUrl", + }, + Data: map[string]interface{}{ + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetChatStatisticsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -26398,8 +27377,8 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateDefaultBackground: return UnmarshalUpdateDefaultBackground(result.Data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(result.Data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(result.Data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(result.Data) @@ -26416,6 +27395,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateFreezeState: return UnmarshalUpdateFreezeState(result.Data) + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(result.Data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(result.Data) @@ -26458,6 +27440,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateStarRevenueStatus: return UnmarshalUpdateStarRevenueStatus(result.Data) + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(result.Data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(result.Data) diff --git a/client/type.go b/client/type.go index a98e665..6490a7a 100755 --- a/client/type.go +++ b/client/type.go @@ -19,19 +19,23 @@ const ( ClassStickerType = "StickerType" ClassStickerFullType = "StickerFullType" ClassPollType = "PollType" + ClassProfileTab = "ProfileTab" ClassUserType = "UserType" ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" + ClassGiftResalePrice = "GiftResalePrice" ClassSuggestedPostPrice = "SuggestedPostPrice" ClassSuggestedPostState = "SuggestedPostState" ClassSuggestedPostRefundReason = "SuggestedPostRefundReason" ClassStarSubscriptionType = "StarSubscriptionType" ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassCanSendGiftResult = "CanSendGiftResult" ClassUpgradedGiftOrigin = "UpgradedGiftOrigin" ClassUpgradedGiftAttributeId = "UpgradedGiftAttributeId" ClassGiftForResaleOrder = "GiftForResaleOrder" + ClassGiftResaleResult = "GiftResaleResult" ClassSentGift = "SentGift" ClassTransactionDirection = "TransactionDirection" ClassStarTransactionType = "StarTransactionType" @@ -71,6 +75,7 @@ const ( ClassLoginUrlInfo = "LoginUrlInfo" ClassWebAppOpenMode = "WebAppOpenMode" ClassSavedMessagesTopicType = "SavedMessagesTopicType" + ClassBuiltInTheme = "BuiltInTheme" ClassRichText = "RichText" ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" @@ -143,6 +148,8 @@ const ( ClassBackgroundFill = "BackgroundFill" ClassBackgroundType = "BackgroundType" ClassInputBackground = "InputBackground" + ClassChatTheme = "ChatTheme" + ClassInputChatTheme = "InputChatTheme" ClassCanPostStoryResult = "CanPostStoryResult" ClassCanTransferOwnershipResult = "CanTransferOwnershipResult" ClassCheckChatUsernameResult = "CheckChatUsernameResult" @@ -211,6 +218,7 @@ const ( ClassInputChecklist = "InputChecklist" ClassAnimation = "Animation" ClassAudio = "Audio" + ClassAudios = "Audios" ClassDocument = "Document" ClassPhoto = "Photo" ClassSticker = "Sticker" @@ -289,6 +297,10 @@ const ( ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" ClassAcceptedGiftTypes = "AcceptedGiftTypes" ClassGiftSettings = "GiftSettings" + ClassGiftPurchaseLimits = "GiftPurchaseLimits" + ClassGiftResaleParameters = "GiftResaleParameters" + ClassGiftCollection = "GiftCollection" + ClassGiftCollections = "GiftCollections" ClassUpgradedGiftModel = "UpgradedGiftModel" ClassUpgradedGiftSymbol = "UpgradedGiftSymbol" ClassUpgradedGiftBackdropColors = "UpgradedGiftBackdropColors" @@ -296,6 +308,7 @@ const ( ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" ClassGift = "Gift" ClassUpgradedGift = "UpgradedGift" + ClassUpgradedGiftValueInfo = "UpgradedGiftValueInfo" ClassUpgradeGiftResult = "UpgradeGiftResult" ClassAvailableGift = "AvailableGift" ClassAvailableGifts = "AvailableGifts" @@ -314,6 +327,8 @@ const ( ClassAccentColor = "AccentColor" ClassProfileAccentColors = "ProfileAccentColors" ClassProfileAccentColor = "ProfileAccentColor" + ClassUserRating = "UserRating" + ClassRestrictionInfo = "RestrictionInfo" ClassEmojiStatus = "EmojiStatus" ClassEmojiStatuses = "EmojiStatuses" ClassEmojiStatusCustomEmojis = "EmojiStatusCustomEmojis" @@ -343,6 +358,7 @@ const ( ClassSupergroup = "Supergroup" ClassSupergroupFullInfo = "SupergroupFullInfo" ClassSecretChat = "SecretChat" + ClassPublicPostSearchLimits = "PublicPostSearchLimits" ClassMessageSenders = "MessageSenders" ClassChatMessageSender = "ChatMessageSender" ClassChatMessageSenders = "ChatMessageSenders" @@ -365,6 +381,7 @@ const ( ClassMessages = "Messages" ClassFoundMessages = "FoundMessages" ClassFoundChatMessages = "FoundChatMessages" + ClassFoundPublicPosts = "FoundPublicPosts" ClassMessagePosition = "MessagePosition" ClassMessagePositions = "MessagePositions" ClassMessageCalendarDay = "MessageCalendarDay" @@ -493,6 +510,8 @@ const ( ClassStory = "Story" ClassStories = "Stories" ClassFoundStories = "FoundStories" + ClassStoryAlbum = "StoryAlbum" + ClassStoryAlbums = "StoryAlbums" ClassStoryFullId = "StoryFullId" ClassStoryInfo = "StoryInfo" ClassChatActiveStories = "ChatActiveStories" @@ -566,7 +585,9 @@ const ( ClassBusinessFeaturePromotionAnimation = "BusinessFeaturePromotionAnimation" ClassPremiumState = "PremiumState" ClassPushReceiverId = "PushReceiverId" - ClassChatTheme = "ChatTheme" + ClassEmojiChatTheme = "EmojiChatTheme" + ClassGiftChatTheme = "GiftChatTheme" + ClassGiftChatThemes = "GiftChatThemes" ClassTimeZone = "TimeZone" ClassTimeZones = "TimeZones" ClassHashtags = "Hashtags" @@ -600,6 +621,7 @@ const ( ClassScopeAutosaveSettings = "ScopeAutosaveSettings" ClassAutosaveSettingsException = "AutosaveSettingsException" ClassAutosaveSettings = "AutosaveSettings" + ClassAgeVerificationParameters = "AgeVerificationParameters" ClassFoundPosition = "FoundPosition" ClassFoundPositions = "FoundPositions" ClassTMeUrl = "TMeUrl" @@ -628,6 +650,8 @@ const ( ClassChatRevenueTransactions = "ChatRevenueTransactions" ClassStarRevenueStatus = "StarRevenueStatus" ClassStarRevenueStatistics = "StarRevenueStatistics" + ClassTonRevenueStatus = "TonRevenueStatus" + ClassTonRevenueStatistics = "TonRevenueStatistics" ClassPoint = "Point" ClassUpdates = "Updates" ClassLogVerbosityLevel = "LogVerbosityLevel" @@ -726,6 +750,7 @@ const ( TypeInputChecklist = "inputChecklist" TypeAnimation = "animation" TypeAudio = "audio" + TypeAudios = "audios" TypeDocument = "document" TypePhoto = "photo" TypeSticker = "sticker" @@ -746,6 +771,14 @@ const ( TypeChatBackground = "chatBackground" TypeProfilePhoto = "profilePhoto" TypeChatPhotoInfo = "chatPhotoInfo" + TypeProfileTabPosts = "profileTabPosts" + TypeProfileTabGifts = "profileTabGifts" + TypeProfileTabMedia = "profileTabMedia" + TypeProfileTabFiles = "profileTabFiles" + TypeProfileTabLinks = "profileTabLinks" + TypeProfileTabMusic = "profileTabMusic" + TypeProfileTabVoice = "profileTabVoice" + TypeProfileTabGifs = "profileTabGifs" TypeUserTypeRegular = "userTypeRegular" TypeUserTypeDeleted = "userTypeDeleted" TypeUserTypeBot = "userTypeBot" @@ -789,6 +822,8 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeGiftResalePriceStar = "giftResalePriceStar" + TypeGiftResalePriceTon = "giftResalePriceTon" TypeSuggestedPostPriceStar = "suggestedPostPriceStar" TypeSuggestedPostPriceTon = "suggestedPostPriceTon" TypeSuggestedPostStatePending = "suggestedPostStatePending" @@ -832,9 +867,16 @@ const ( TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" TypeAcceptedGiftTypes = "acceptedGiftTypes" TypeGiftSettings = "giftSettings" + TypeGiftPurchaseLimits = "giftPurchaseLimits" + TypeGiftResaleParameters = "giftResaleParameters" + TypeGiftCollection = "giftCollection" + TypeGiftCollections = "giftCollections" + TypeCanSendGiftResultOk = "canSendGiftResultOk" + TypeCanSendGiftResultFail = "canSendGiftResultFail" TypeUpgradedGiftOriginUpgrade = "upgradedGiftOriginUpgrade" TypeUpgradedGiftOriginTransfer = "upgradedGiftOriginTransfer" TypeUpgradedGiftOriginResale = "upgradedGiftOriginResale" + TypeUpgradedGiftOriginPrepaidUpgrade = "upgradedGiftOriginPrepaidUpgrade" TypeUpgradedGiftModel = "upgradedGiftModel" TypeUpgradedGiftSymbol = "upgradedGiftSymbol" TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" @@ -842,6 +884,7 @@ const ( TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" TypeGift = "gift" TypeUpgradedGift = "upgradedGift" + TypeUpgradedGiftValueInfo = "upgradedGiftValueInfo" TypeUpgradeGiftResult = "upgradeGiftResult" TypeAvailableGift = "availableGift" TypeAvailableGifts = "availableGifts" @@ -856,6 +899,8 @@ const ( TypeGiftForResaleOrderNumber = "giftForResaleOrderNumber" TypeGiftForResale = "giftForResale" TypeGiftsForResale = "giftsForResale" + TypeGiftResaleResultOk = "giftResaleResultOk" + TypeGiftResaleResultPriceIncreased = "giftResaleResultPriceIncreased" TypeSentGiftRegular = "sentGiftRegular" TypeSentGiftUpgraded = "sentGiftUpgraded" TypeReceivedGift = "receivedGift" @@ -886,6 +931,7 @@ const ( TypeStarTransactionTypeGiftTransfer = "starTransactionTypeGiftTransfer" TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" TypeStarTransactionTypeGiftUpgrade = "starTransactionTypeGiftUpgrade" + TypeStarTransactionTypeGiftUpgradePurchase = "starTransactionTypeGiftUpgradePurchase" TypeStarTransactionTypeUpgradedGiftPurchase = "starTransactionTypeUpgradedGiftPurchase" TypeStarTransactionTypeUpgradedGiftSale = "starTransactionTypeUpgradedGiftSale" TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" @@ -898,11 +944,14 @@ const ( TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" TypeStarTransactionTypeBusinessBotTransferSend = "starTransactionTypeBusinessBotTransferSend" TypeStarTransactionTypeBusinessBotTransferReceive = "starTransactionTypeBusinessBotTransferReceive" + TypeStarTransactionTypePublicPostSearch = "starTransactionTypePublicPostSearch" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" TypeTonTransactionTypeFragmentDeposit = "tonTransactionTypeFragmentDeposit" TypeTonTransactionTypeSuggestedPostPayment = "tonTransactionTypeSuggestedPostPayment" + TypeTonTransactionTypeUpgradedGiftPurchase = "tonTransactionTypeUpgradedGiftPurchase" + TypeTonTransactionTypeUpgradedGiftSale = "tonTransactionTypeUpgradedGiftSale" TypeTonTransactionTypeUnsupported = "tonTransactionTypeUnsupported" TypeTonTransaction = "tonTransaction" TypeTonTransactions = "tonTransactions" @@ -918,6 +967,8 @@ const ( TypeAccentColor = "accentColor" TypeProfileAccentColors = "profileAccentColors" TypeProfileAccentColor = "profileAccentColor" + TypeUserRating = "userRating" + TypeRestrictionInfo = "restrictionInfo" TypeEmojiStatusTypeCustomEmoji = "emojiStatusTypeCustomEmoji" TypeEmojiStatusTypeUpgradedGift = "emojiStatusTypeUpgradedGift" TypeEmojiStatus = "emojiStatus" @@ -976,6 +1027,7 @@ const ( TypeSecretChatStateReady = "secretChatStateReady" TypeSecretChatStateClosed = "secretChatStateClosed" TypeSecretChat = "secretChat" + TypePublicPostSearchLimits = "publicPostSearchLimits" TypeMessageSenderUser = "messageSenderUser" TypeMessageSenderChat = "messageSenderChat" TypeMessageSenders = "messageSenders" @@ -1027,6 +1079,7 @@ const ( TypeMessages = "messages" TypeFoundMessages = "foundMessages" TypeFoundChatMessages = "foundChatMessages" + TypeFoundPublicPosts = "foundPublicPosts" TypeMessagePosition = "messagePosition" TypeMessagePositions = "messagePositions" TypeMessageCalendarDay = "messageCalendarDay" @@ -1157,6 +1210,11 @@ const ( TypeLinkPreviewOptions = "linkPreviewOptions" TypeSharedUser = "sharedUser" TypeSharedChat = "sharedChat" + TypeBuiltInThemeClassic = "builtInThemeClassic" + TypeBuiltInThemeDay = "builtInThemeDay" + TypeBuiltInThemeNight = "builtInThemeNight" + TypeBuiltInThemeTinted = "builtInThemeTinted" + TypeBuiltInThemeArctic = "builtInThemeArctic" TypeThemeSettings = "themeSettings" TypeRichTextPlain = "richTextPlain" TypeRichTextBold = "richTextBold" @@ -1225,12 +1283,14 @@ const ( TypeLinkPreviewTypeBackground = "linkPreviewTypeBackground" TypeLinkPreviewTypeChannelBoost = "linkPreviewTypeChannelBoost" TypeLinkPreviewTypeChat = "linkPreviewTypeChat" + TypeLinkPreviewTypeDirectMessagesChat = "linkPreviewTypeDirectMessagesChat" TypeLinkPreviewTypeDocument = "linkPreviewTypeDocument" TypeLinkPreviewTypeEmbeddedAnimationPlayer = "linkPreviewTypeEmbeddedAnimationPlayer" TypeLinkPreviewTypeEmbeddedAudioPlayer = "linkPreviewTypeEmbeddedAudioPlayer" TypeLinkPreviewTypeEmbeddedVideoPlayer = "linkPreviewTypeEmbeddedVideoPlayer" TypeLinkPreviewTypeExternalAudio = "linkPreviewTypeExternalAudio" TypeLinkPreviewTypeExternalVideo = "linkPreviewTypeExternalVideo" + TypeLinkPreviewTypeGiftCollection = "linkPreviewTypeGiftCollection" TypeLinkPreviewTypeGroupCall = "linkPreviewTypeGroupCall" TypeLinkPreviewTypeInvoice = "linkPreviewTypeInvoice" TypeLinkPreviewTypeMessage = "linkPreviewTypeMessage" @@ -1240,6 +1300,7 @@ const ( TypeLinkPreviewTypeSticker = "linkPreviewTypeSticker" TypeLinkPreviewTypeStickerSet = "linkPreviewTypeStickerSet" TypeLinkPreviewTypeStory = "linkPreviewTypeStory" + TypeLinkPreviewTypeStoryAlbum = "linkPreviewTypeStoryAlbum" TypeLinkPreviewTypeSupergroupBoost = "linkPreviewTypeSupergroupBoost" TypeLinkPreviewTypeTheme = "linkPreviewTypeTheme" TypeLinkPreviewTypeUnsupported = "linkPreviewTypeUnsupported" @@ -1599,6 +1660,8 @@ const ( TypeStory = "story" TypeStories = "stories" TypeFoundStories = "foundStories" + TypeStoryAlbum = "storyAlbum" + TypeStoryAlbums = "storyAlbums" TypeStoryFullId = "storyFullId" TypeStoryInfo = "storyInfo" TypeChatActiveStories = "chatActiveStories" @@ -1922,7 +1985,13 @@ const ( TypeInputBackgroundLocal = "inputBackgroundLocal" TypeInputBackgroundRemote = "inputBackgroundRemote" TypeInputBackgroundPrevious = "inputBackgroundPrevious" - TypeChatTheme = "chatTheme" + TypeEmojiChatTheme = "emojiChatTheme" + TypeGiftChatTheme = "giftChatTheme" + TypeGiftChatThemes = "giftChatThemes" + TypeChatThemeEmoji = "chatThemeEmoji" + TypeChatThemeGift = "chatThemeGift" + TypeInputChatThemeEmoji = "inputChatThemeEmoji" + TypeInputChatThemeGift = "inputChatThemeGift" TypeTimeZone = "timeZone" TypeTimeZones = "timeZones" TypeHashtags = "hashtags" @@ -2110,8 +2179,10 @@ const ( TypeInternalLinkTypeChatFolderSettings = "internalLinkTypeChatFolderSettings" TypeInternalLinkTypeChatInvite = "internalLinkTypeChatInvite" TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings = "internalLinkTypeDefaultMessageAutoDeleteTimerSettings" + TypeInternalLinkTypeDirectMessagesChat = "internalLinkTypeDirectMessagesChat" TypeInternalLinkTypeEditProfileSettings = "internalLinkTypeEditProfileSettings" TypeInternalLinkTypeGame = "internalLinkTypeGame" + TypeInternalLinkTypeGiftCollection = "internalLinkTypeGiftCollection" TypeInternalLinkTypeGroupCall = "internalLinkTypeGroupCall" TypeInternalLinkTypeInstantView = "internalLinkTypeInstantView" TypeInternalLinkTypeInvoice = "internalLinkTypeInvoice" @@ -2135,6 +2206,7 @@ const ( TypeInternalLinkTypeSettings = "internalLinkTypeSettings" TypeInternalLinkTypeStickerSet = "internalLinkTypeStickerSet" TypeInternalLinkTypeStory = "internalLinkTypeStory" + TypeInternalLinkTypeStoryAlbum = "internalLinkTypeStoryAlbum" TypeInternalLinkTypeTheme = "internalLinkTypeTheme" TypeInternalLinkTypeThemeSettings = "internalLinkTypeThemeSettings" TypeInternalLinkTypeUnknownDeepLink = "internalLinkTypeUnknownDeepLink" @@ -2200,6 +2272,7 @@ const ( TypeConnectionStateConnecting = "connectionStateConnecting" TypeConnectionStateUpdating = "connectionStateUpdating" TypeConnectionStateReady = "connectionStateReady" + TypeAgeVerificationParameters = "ageVerificationParameters" TypeTopChatCategoryUsers = "topChatCategoryUsers" TypeTopChatCategoryBots = "topChatCategoryBots" TypeTopChatCategoryGroups = "topChatCategoryGroups" @@ -2275,6 +2348,8 @@ const ( TypeChatRevenueTransactions = "chatRevenueTransactions" TypeStarRevenueStatus = "starRevenueStatus" TypeStarRevenueStatistics = "starRevenueStatistics" + TypeTonRevenueStatus = "tonRevenueStatus" + TypeTonRevenueStatistics = "tonRevenueStatistics" TypePoint = "point" TypeVectorPathCommandLine = "vectorPathCommandLine" TypeVectorPathCommandCubicBezierCurve = "vectorPathCommandCubicBezierCurve" @@ -2400,12 +2475,13 @@ const ( TypeUpdateSavedAnimations = "updateSavedAnimations" TypeUpdateSavedNotificationSounds = "updateSavedNotificationSounds" TypeUpdateDefaultBackground = "updateDefaultBackground" - TypeUpdateChatThemes = "updateChatThemes" + TypeUpdateEmojiChatThemes = "updateEmojiChatThemes" TypeUpdateAccentColors = "updateAccentColors" TypeUpdateProfileAccentColors = "updateProfileAccentColors" TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" TypeUpdateFreezeState = "updateFreezeState" + TypeUpdateAgeVerificationParameters = "updateAgeVerificationParameters" TypeUpdateTermsOfService = "updateTermsOfService" TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" @@ -2420,6 +2496,7 @@ const ( TypeUpdateOwnedTonCount = "updateOwnedTonCount" TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" TypeUpdateStarRevenueStatus = "updateStarRevenueStatus" + TypeUpdateTonRevenueStatus = "updateTonRevenueStatus" TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" TypeUpdateDiceEmojis = "updateDiceEmojis" TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" @@ -2525,6 +2602,11 @@ type PollType interface { PollTypeType() string } +// Describes a tab shown in a user or a chat profile +type ProfileTab interface { + ProfileTabType() string +} + // Represents the type of user. The following types are possible: regular users, deleted users and bots type UserType interface { UserTypeType() string @@ -2545,6 +2627,11 @@ type InputChatPhoto interface { InputChatPhotoType() string } +// Describes price of a resold gift +type GiftResalePrice interface { + GiftResalePriceType() string +} + // Describes price of a suggested post type SuggestedPostPrice interface { SuggestedPostPriceType() string @@ -2575,6 +2662,11 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Describes whether a gift can be sent now by the current user +type CanSendGiftResult interface { + CanSendGiftResultType() string +} + // Describes origin from which the upgraded gift was obtained type UpgradedGiftOrigin interface { UpgradedGiftOriginType() string @@ -2590,6 +2682,11 @@ type GiftForResaleOrder interface { GiftForResaleOrderType() string } +// Describes result of sending a resold gift +type GiftResaleResult interface { + GiftResaleResultType() string +} + // Represents content of a gift received by a user or a channel chat type SentGift interface { SentGiftType() string @@ -2785,6 +2882,11 @@ type SavedMessagesTopicType interface { SavedMessagesTopicTypeType() string } +// Describes a built-in theme of an official app +type BuiltInTheme interface { + BuiltInThemeType() string +} + // Describes a formatted text object type RichText interface { RichTextType() string @@ -3145,6 +3247,16 @@ type InputBackground interface { InputBackgroundType() string } +// Describes a chat theme +type ChatTheme interface { + ChatThemeType() string +} + +// Describes a chat theme to set +type InputChatTheme interface { + InputChatThemeType() string +} + // Represents result of checking whether the current user can post a story on behalf of the specific chat type CanPostStoryResult interface { CanPostStoryResultType() string @@ -4087,6 +4199,10 @@ type AuthorizationStateWaitPremiumPurchase struct { meta // Identifier of the store product that must be bought StoreProductId string `json:"store_product_id"` + // Email address to use for support if the user has issues with Telegram Premium purchase + SupportEmailAddress string `json:"support_email_address"` + // Subject for the email sent to the support email address + SupportEmailSubject string `json:"support_email_subject"` } func (entity *AuthorizationStateWaitPremiumPurchase) MarshalJSON() ([]byte, error) { @@ -5773,6 +5889,31 @@ func (*Audio) GetType() string { return TypeAudio } +// Contains a list of audio files +type Audios struct { + meta + // Approximate total number of audio files found + TotalCount int32 `json:"total_count"` + // List of audio files + Audios []*Audio `json:"audios"` +} + +func (entity *Audios) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Audios + + return json.Marshal((*stub)(entity)) +} + +func (*Audios) GetClass() string { + return ClassAudios +} + +func (*Audios) GetType() string { + return TypeAudios +} + // Describes a document of any type type Document struct { meta @@ -6566,6 +6707,206 @@ func (*ChatPhotoInfo) GetType() string { return TypeChatPhotoInfo } +// A tab with stories posted by the user or the channel chat and saved to profile +type ProfileTabPosts struct{ + meta +} + +func (entity *ProfileTabPosts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabPosts + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabPosts) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabPosts) GetType() string { + return TypeProfileTabPosts +} + +func (*ProfileTabPosts) ProfileTabType() string { + return TypeProfileTabPosts +} + +// A tab with gifts received by the user or the channel chat +type ProfileTabGifts struct{ + meta +} + +func (entity *ProfileTabGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabGifts + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabGifts) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabGifts) GetType() string { + return TypeProfileTabGifts +} + +func (*ProfileTabGifts) ProfileTabType() string { + return TypeProfileTabGifts +} + +// A tab with photos and videos posted by the channel +type ProfileTabMedia struct{ + meta +} + +func (entity *ProfileTabMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabMedia + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabMedia) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabMedia) GetType() string { + return TypeProfileTabMedia +} + +func (*ProfileTabMedia) ProfileTabType() string { + return TypeProfileTabMedia +} + +// A tab with documents posted by the channel +type ProfileTabFiles struct{ + meta +} + +func (entity *ProfileTabFiles) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabFiles + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabFiles) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabFiles) GetType() string { + return TypeProfileTabFiles +} + +func (*ProfileTabFiles) ProfileTabType() string { + return TypeProfileTabFiles +} + +// A tab with messages posted by the channel and containing links +type ProfileTabLinks struct{ + meta +} + +func (entity *ProfileTabLinks) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabLinks + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabLinks) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabLinks) GetType() string { + return TypeProfileTabLinks +} + +func (*ProfileTabLinks) ProfileTabType() string { + return TypeProfileTabLinks +} + +// A tab with audio messages posted by the channel +type ProfileTabMusic struct{ + meta +} + +func (entity *ProfileTabMusic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabMusic + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabMusic) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabMusic) GetType() string { + return TypeProfileTabMusic +} + +func (*ProfileTabMusic) ProfileTabType() string { + return TypeProfileTabMusic +} + +// A tab with voice notes posted by the channel +type ProfileTabVoice struct{ + meta +} + +func (entity *ProfileTabVoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabVoice + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabVoice) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabVoice) GetType() string { + return TypeProfileTabVoice +} + +func (*ProfileTabVoice) ProfileTabType() string { + return TypeProfileTabVoice +} + +// A tab with animations posted by the channel +type ProfileTabGifs struct{ + meta +} + +func (entity *ProfileTabGifs) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabGifs + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabGifs) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabGifs) GetType() string { + return TypeProfileTabGifs +} + +func (*ProfileTabGifs) ProfileTabType() string { + return TypeProfileTabGifs +} + // A regular user type UserTypeRegular struct{ meta @@ -7922,10 +8263,64 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes price of a resold gift in Telegram Stars +type GiftResalePriceStar struct { + meta + // The amount of Telegram Stars expected to be paid for the gift. Must be in range getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max") for gifts put for resale + StarCount int64 `json:"star_count"` +} + +func (entity *GiftResalePriceStar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResalePriceStar + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResalePriceStar) GetClass() string { + return ClassGiftResalePrice +} + +func (*GiftResalePriceStar) GetType() string { + return TypeGiftResalePriceStar +} + +func (*GiftResalePriceStar) GiftResalePriceType() string { + return TypeGiftResalePriceStar +} + +// Describes price of a resold gift in Toncoins +type GiftResalePriceTon struct { + meta + // The amount of 1/100 of Toncoin expected to be paid for the gift. Must be in range getOption("gift_resale_toncoin_cent_count_min")-getOption("gift_resale_toncoin_cent_count_max") + ToncoinCentCount int64 `json:"toncoin_cent_count"` +} + +func (entity *GiftResalePriceTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResalePriceTon + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResalePriceTon) GetClass() string { + return ClassGiftResalePrice +} + +func (*GiftResalePriceTon) GetType() string { + return TypeGiftResalePriceTon +} + +func (*GiftResalePriceTon) GiftResalePriceType() string { + return TypeGiftResalePriceTon +} + // Describes price of a suggested post in Telegram Stars type SuggestedPostPriceStar struct { meta - // The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") + // The amount of Telegram Stars expected to be paid for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") StarCount int64 `json:"star_count"` } @@ -7952,7 +8347,7 @@ func (*SuggestedPostPriceStar) SuggestedPostPriceType() string { // Describes price of a suggested post in Toncoins type SuggestedPostPriceTon struct { meta - // The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") + // The amount of 1/100 of Toncoin expected to be paid for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") ToncoinCentCount int64 `json:"toncoin_cent_count"` } @@ -9244,6 +9639,162 @@ func (*GiftSettings) GetType() string { return TypeGiftSettings } +// Describes the maximum number of times that a specific gift can be purchased +type GiftPurchaseLimits struct { + meta + // The maximum number of times the gifts can be purchased + TotalCount int32 `json:"total_count"` + // Number of remaining times the gift can be purchased + RemainingCount int32 `json:"remaining_count"` +} + +func (entity *GiftPurchaseLimits) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftPurchaseLimits + + return json.Marshal((*stub)(entity)) +} + +func (*GiftPurchaseLimits) GetClass() string { + return ClassGiftPurchaseLimits +} + +func (*GiftPurchaseLimits) GetType() string { + return TypeGiftPurchaseLimits +} + +// Describes parameters of a unique gift available for resale +type GiftResaleParameters struct { + meta + // Resale price of the gift in Telegram Stars + StarCount int64 `json:"star_count"` + // Resale price of the gift in 1/100 of Toncoin + ToncoinCentCount int64 `json:"toncoin_cent_count"` + // True, if the gift can be bought only using Toncoins + ToncoinOnly bool `json:"toncoin_only"` +} + +func (entity *GiftResaleParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleParameters + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleParameters) GetClass() string { + return ClassGiftResaleParameters +} + +func (*GiftResaleParameters) GetType() string { + return TypeGiftResaleParameters +} + +// Describes collection of gifts +type GiftCollection struct { + meta + // Unique identifier of the collection + Id int32 `json:"id"` + // Name of the collection + Name string `json:"name"` + // Icon of the collection; may be null if none + Icon *Sticker `json:"icon"` + // Total number of gifts in the collection + GiftCount int32 `json:"gift_count"` +} + +func (entity *GiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*GiftCollection) GetClass() string { + return ClassGiftCollection +} + +func (*GiftCollection) GetType() string { + return TypeGiftCollection +} + +// Contains a list of gift collections +type GiftCollections struct { + meta + // List of gift collections + Collections []*GiftCollection `json:"collections"` +} + +func (entity *GiftCollections) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftCollections + + return json.Marshal((*stub)(entity)) +} + +func (*GiftCollections) GetClass() string { + return ClassGiftCollections +} + +func (*GiftCollections) GetType() string { + return TypeGiftCollections +} + +// The gift can be sent now by the current user +type CanSendGiftResultOk struct{ + meta +} + +func (entity *CanSendGiftResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendGiftResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendGiftResultOk) GetClass() string { + return ClassCanSendGiftResult +} + +func (*CanSendGiftResultOk) GetType() string { + return TypeCanSendGiftResultOk +} + +func (*CanSendGiftResultOk) CanSendGiftResultType() string { + return TypeCanSendGiftResultOk +} + +// The gift can't be sent now by the current user +type CanSendGiftResultFail struct { + meta + // Reason to be shown to the user + Reason *FormattedText `json:"reason"` +} + +func (entity *CanSendGiftResultFail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendGiftResultFail + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendGiftResultFail) GetClass() string { + return ClassCanSendGiftResult +} + +func (*CanSendGiftResultFail) GetType() string { + return TypeCanSendGiftResultFail +} + +func (*CanSendGiftResultFail) CanSendGiftResultType() string { + return TypeCanSendGiftResultFail +} + // The gift was obtained by upgrading of a previously received gift type UpgradedGiftOriginUpgrade struct { meta @@ -9299,8 +9850,8 @@ func (*UpgradedGiftOriginTransfer) UpgradedGiftOriginType() string { // The gift was bought from another user type UpgradedGiftOriginResale struct { meta - // Number of Telegram Stars that were paid by the sender for the gift - StarCount int64 `json:"star_count"` + // Price paid by the sender for the gift + Price GiftResalePrice `json:"price"` } func (entity *UpgradedGiftOriginResale) MarshalJSON() ([]byte, error) { @@ -9323,6 +9874,47 @@ func (*UpgradedGiftOriginResale) UpgradedGiftOriginType() string { return TypeUpgradedGiftOriginResale } +func (upgradedGiftOriginResale *UpgradedGiftOriginResale) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + upgradedGiftOriginResale.Price = fieldPrice + + return nil +} + +// The sender or receiver of the message has paid for upgraid of the gift, which has been completed +type UpgradedGiftOriginPrepaidUpgrade struct{ + meta +} + +func (entity *UpgradedGiftOriginPrepaidUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginPrepaidUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginPrepaidUpgrade) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginPrepaidUpgrade) GetType() string { + return TypeUpgradedGiftOriginPrepaidUpgrade +} + +func (*UpgradedGiftOriginPrepaidUpgrade) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginPrepaidUpgrade +} + // Describes a model of an upgraded gift type UpgradedGiftModel struct { meta @@ -9506,10 +10098,14 @@ type Gift struct { UpgradeStarCount int64 `json:"upgrade_star_count"` // True, if the gift is a birthday gift IsForBirthday bool `json:"is_for_birthday"` - // Number of remaining times the gift can be purchased; 0 if not limited or the gift was sold out - RemainingCount int32 `json:"remaining_count"` - // Number of total times the gift can be purchased; 0 if not limited - TotalCount int32 `json:"total_count"` + // True, if the gift can be bought only by Telegram Premium subscribers + IsPremium bool `json:"is_premium"` + // Point in time (Unix timestamp) when the gift can be sent next time by the current user; can be 0 or a date in the past. If the date is in the future, then call canSendGift to get the reason, why the gift can't be sent now + NextSendDate int32 `json:"next_send_date"` + // Number of times the gift can be purchased by the current user; may be null if not limited + UserLimits *GiftPurchaseLimits `json:"user_limits"` + // Number of times the gift can be purchased all users; may be null if not limited + OverallLimits *GiftPurchaseLimits `json:"overall_limits"` // Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only FirstSendDate int32 `json:"first_send_date"` // Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only @@ -9537,6 +10133,8 @@ type UpgradedGift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` + // Unique identifier of the regular gift from which the gift was upgraded; may be 0 for short period of time for old gifts from database + RegularGiftId JsonInt64 `json:"regular_gift_id"` // Identifier of the chat that published the gift; 0 if none PublisherChatId int64 `json:"publisher_chat_id"` // The title of the upgraded gift @@ -9549,6 +10147,12 @@ type UpgradedGift struct { TotalUpgradedCount int32 `json:"total_upgraded_count"` // The maximum number of gifts that can be upgraded from the same gift MaxUpgradedCount int32 `json:"max_upgraded_count"` + // True, if the original gift could have been bought only by Telegram Premium subscribers + IsPremium bool `json:"is_premium"` + // True, if the gift can be used to set a theme in a chat + IsThemeAvailable bool `json:"is_theme_available"` + // Identifier of the chat for which the gift is used to set a theme; 0 if none or the gift isn't owned by the current user + UsedThemeChatId int64 `json:"used_theme_chat_id"` // Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown OwnerId MessageSender `json:"owner_id"` // Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address @@ -9565,8 +10169,12 @@ type UpgradedGift struct { Backdrop *UpgradedGiftBackdrop `json:"backdrop"` // Information about the originally sent gift; may be null if unknown OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` - // Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible - ResaleStarCount int64 `json:"resale_star_count"` + // Resale parameters of the gift; may be null if resale isn't possible + ResaleParameters *GiftResaleParameters `json:"resale_parameters"` + // ISO 4217 currency code of the currency in which value of the gift is represented; may be empty if unavailable + ValueCurrency string `json:"value_currency"` + // Estimated value of the gift; in the smallest units of the currency; 0 if unavailable + ValueAmount int64 `json:"value_amount"` } func (entity *UpgradedGift) MarshalJSON() ([]byte, error) { @@ -9588,12 +10196,16 @@ func (*UpgradedGift) GetType() string { func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { var tmp struct { Id JsonInt64 `json:"id"` + RegularGiftId JsonInt64 `json:"regular_gift_id"` PublisherChatId int64 `json:"publisher_chat_id"` Title string `json:"title"` Name string `json:"name"` Number int32 `json:"number"` TotalUpgradedCount int32 `json:"total_upgraded_count"` MaxUpgradedCount int32 `json:"max_upgraded_count"` + IsPremium bool `json:"is_premium"` + IsThemeAvailable bool `json:"is_theme_available"` + UsedThemeChatId int64 `json:"used_theme_chat_id"` OwnerId json.RawMessage `json:"owner_id"` OwnerAddress string `json:"owner_address"` OwnerName string `json:"owner_name"` @@ -9602,7 +10214,9 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { Symbol *UpgradedGiftSymbol `json:"symbol"` Backdrop *UpgradedGiftBackdrop `json:"backdrop"` OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` - ResaleStarCount int64 `json:"resale_star_count"` + ResaleParameters *GiftResaleParameters `json:"resale_parameters"` + ValueCurrency string `json:"value_currency"` + ValueAmount int64 `json:"value_amount"` } err := json.Unmarshal(data, &tmp) @@ -9611,12 +10225,16 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { } upgradedGift.Id = tmp.Id + upgradedGift.RegularGiftId = tmp.RegularGiftId upgradedGift.PublisherChatId = tmp.PublisherChatId upgradedGift.Title = tmp.Title upgradedGift.Name = tmp.Name upgradedGift.Number = tmp.Number upgradedGift.TotalUpgradedCount = tmp.TotalUpgradedCount upgradedGift.MaxUpgradedCount = tmp.MaxUpgradedCount + upgradedGift.IsPremium = tmp.IsPremium + upgradedGift.IsThemeAvailable = tmp.IsThemeAvailable + upgradedGift.UsedThemeChatId = tmp.UsedThemeChatId upgradedGift.OwnerAddress = tmp.OwnerAddress upgradedGift.OwnerName = tmp.OwnerName upgradedGift.GiftAddress = tmp.GiftAddress @@ -9624,7 +10242,9 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { upgradedGift.Symbol = tmp.Symbol upgradedGift.Backdrop = tmp.Backdrop upgradedGift.OriginalDetails = tmp.OriginalDetails - upgradedGift.ResaleStarCount = tmp.ResaleStarCount + upgradedGift.ResaleParameters = tmp.ResaleParameters + upgradedGift.ValueCurrency = tmp.ValueCurrency + upgradedGift.ValueAmount = tmp.ValueAmount fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) upgradedGift.OwnerId = fieldOwnerId @@ -9632,6 +10252,55 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { return nil } +// Contains information about value of an upgraded gift +type UpgradedGiftValueInfo struct { + meta + // ISO 4217 currency code of the currency in which the prices are represented + Currency string `json:"currency"` + // Estimated value of the gift; in the smallest units of the currency + Value int64 `json:"value"` + // True, if the value is calculated as average value of similar sold gifts. Otherwise, it is based on the sale price of the gift + IsValueAverage bool `json:"is_value_average"` + // Point in time (Unix timestamp) when the corresponding regular gift was originally purchased + InitialSaleDate int32 `json:"initial_sale_date"` + // Amount of Telegram Stars that were paid for the gift + InitialSaleStarCount int64 `json:"initial_sale_star_count"` + // Initial price of the gift; in the smallest units of the currency + InitialSalePrice int64 `json:"initial_sale_price"` + // Point in time (Unix timestamp) when the upgraded gift was purchased last time; 0 if never + LastSaleDate int32 `json:"last_sale_date"` + // Last purchase price of the gift; in the smallest units of the currency; 0 if the gift has never been resold + LastSalePrice int64 `json:"last_sale_price"` + // True, if the last sale was completed on Fragment + IsLastSaleOnFragment bool `json:"is_last_sale_on_fragment"` + // The current minimum price of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there are no such gifts + MinimumPrice int64 `json:"minimum_price"` + // The average sale price in the last month of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there were no such sales + AverageSalePrice int64 `json:"average_sale_price"` + // Number of gifts upgraded from the same gift being resold on Telegram + TelegramListedGiftCount int32 `json:"telegram_listed_gift_count"` + // Number of gifts upgraded from the same gift being resold on Fragment + FragmentListedGiftCount int32 `json:"fragment_listed_gift_count"` + // The HTTPS link to the Fragment for the gift; may be empty if there are no such gifts being sold on Fragment + FragmentUrl string `json:"fragment_url"` +} + +func (entity *UpgradedGiftValueInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftValueInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftValueInfo) GetClass() string { + return ClassUpgradedGiftValueInfo +} + +func (*UpgradedGiftValueInfo) GetType() string { + return TypeUpgradedGiftValueInfo +} + // Contains result of gift upgrading type UpgradeGiftResult struct { meta @@ -9645,11 +10314,11 @@ type UpgradeGiftResult struct { CanBeTransferred bool `json:"can_be_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible NextTransferDate int32 `json:"next_transfer_date"` - // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift NextResaleDate int32 `json:"next_resale_date"` - // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past ExportDate int32 `json:"export_date"` } @@ -9676,7 +10345,7 @@ type AvailableGift struct { Gift *Gift `json:"gift"` // Number of gifts that are available for resale ResaleCount int32 `json:"resale_count"` - // The minimum price for the gifts available for resale; 0 if there are no such gifts + // The minimum price for the gifts available for resale in Telegram Star equivalent; 0 if there are no such gifts MinResaleStarCount int64 `json:"min_resale_star_count"` // The title of the upgraded gift; empty if the gift isn't available for resale Title string `json:"title"` @@ -10010,6 +10679,74 @@ func (*GiftsForResale) GetType() string { return TypeGiftsForResale } +// Operation was successfully completed +type GiftResaleResultOk struct{ + meta +} + +func (entity *GiftResaleResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleResultOk) GetClass() string { + return ClassGiftResaleResult +} + +func (*GiftResaleResultOk) GetType() string { + return TypeGiftResaleResultOk +} + +func (*GiftResaleResultOk) GiftResaleResultType() string { + return TypeGiftResaleResultOk +} + +// Operation has failed, because price has increased. If the price has decreased, then the buying will succeed anyway +type GiftResaleResultPriceIncreased struct { + meta + // New price for the gift + Price GiftResalePrice `json:"price"` +} + +func (entity *GiftResaleResultPriceIncreased) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleResultPriceIncreased + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleResultPriceIncreased) GetClass() string { + return ClassGiftResaleResult +} + +func (*GiftResaleResultPriceIncreased) GetType() string { + return TypeGiftResaleResultPriceIncreased +} + +func (*GiftResaleResultPriceIncreased) GiftResaleResultType() string { + return TypeGiftResaleResultPriceIncreased +} + +func (giftResaleResultPriceIncreased *GiftResaleResultPriceIncreased) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + giftResaleResultPriceIncreased.Price = fieldPrice + + return nil +} + // Regular gift type SentGiftRegular struct { meta @@ -10089,18 +10826,24 @@ type ReceivedGift struct { Date int32 `json:"date"` // The gift Gift SentGift `json:"gift"` + // Identifiers of collections to which the gift is added; only for the receiver of the gift + CollectionIds []int32 `json:"collection_ids"` // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user SellStarCount int64 `json:"sell_star_count"` // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + // True, if the upgrade was bought after the gift was sent. In this case, prepaid upgrade cost must not be added to the gift cost + IsUpgradeSeparate bool `json:"is_upgrade_separate"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift NextTransferDate int32 `json:"next_transfer_date"` - // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift NextResaleDate int32 `json:"next_resale_date"` - // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` + // If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } func (entity *ReceivedGift) MarshalJSON() ([]byte, error) { @@ -10132,12 +10875,15 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { WasRefunded bool `json:"was_refunded"` Date int32 `json:"date"` Gift json.RawMessage `json:"gift"` + CollectionIds []int32 `json:"collection_ids"` SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + IsUpgradeSeparate bool `json:"is_upgrade_separate"` TransferStarCount int64 `json:"transfer_star_count"` NextTransferDate int32 `json:"next_transfer_date"` NextResaleDate int32 `json:"next_resale_date"` ExportDate int32 `json:"export_date"` + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } err := json.Unmarshal(data, &tmp) @@ -10154,12 +10900,15 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { receivedGift.CanBeTransferred = tmp.CanBeTransferred receivedGift.WasRefunded = tmp.WasRefunded receivedGift.Date = tmp.Date + receivedGift.CollectionIds = tmp.CollectionIds receivedGift.SellStarCount = tmp.SellStarCount receivedGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + receivedGift.IsUpgradeSeparate = tmp.IsUpgradeSeparate receivedGift.TransferStarCount = tmp.TransferStarCount receivedGift.NextTransferDate = tmp.NextTransferDate receivedGift.NextResaleDate = tmp.NextResaleDate receivedGift.ExportDate = tmp.ExportDate + receivedGift.PrepaidUpgradeHash = tmp.PrepaidUpgradeHash fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) receivedGift.SenderId = fieldSenderId @@ -11077,6 +11826,54 @@ func (*StarTransactionTypeGiftUpgrade) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftUpgrade } +// The transaction is a purchase of an upgrade of a gift owned by another user or channel; for regular users only +type StarTransactionTypeGiftUpgradePurchase struct { + meta + // Owner of the upgraded gift + OwnerId MessageSender `json:"owner_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftUpgradePurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftUpgradePurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftUpgradePurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftUpgradePurchase) GetType() string { + return TypeStarTransactionTypeGiftUpgradePurchase +} + +func (*StarTransactionTypeGiftUpgradePurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftUpgradePurchase +} + +func (starTransactionTypeGiftUpgradePurchase *StarTransactionTypeGiftUpgradePurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *Gift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftUpgradePurchase.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftUpgradePurchase.OwnerId = fieldOwnerId + + return nil +} + // The transaction is a purchase of an upgraded gift for some user or channel; for regular users only type StarTransactionTypeUpgradedGiftPurchase struct { meta @@ -11113,8 +11910,10 @@ type StarTransactionTypeUpgradedGiftSale struct { UserId int64 `json:"user_id"` // The gift Gift *UpgradedGift `json:"gift"` - // Information about commission received by Telegram from the transaction - Affiliate *AffiliateInfo `json:"affiliate"` + // The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars received by the seller of the gift + CommissionPerMille int32 `json:"commission_per_mille"` + // The amount of Telegram Stars that were received by Telegram; can be negative for refunds + CommissionStarAmount *StarAmount `json:"commission_star_amount"` } func (entity *StarTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { @@ -11448,6 +12247,31 @@ func (*StarTransactionTypeBusinessBotTransferReceive) StarTransactionTypeType() return TypeStarTransactionTypeBusinessBotTransferReceive } +// The transaction is a payment for search of posts in public Telegram channels; for regular users only +type StarTransactionTypePublicPostSearch struct{ + meta +} + +func (entity *StarTransactionTypePublicPostSearch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePublicPostSearch + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePublicPostSearch) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePublicPostSearch) GetType() string { + return TypeStarTransactionTypePublicPostSearch +} + +func (*StarTransactionTypePublicPostSearch) StarTransactionTypeType() string { + return TypeStarTransactionTypePublicPostSearch +} + // The transaction is a transaction of an unsupported type type StarTransactionTypeUnsupported struct{ meta @@ -11612,6 +12436,68 @@ func (*TonTransactionTypeSuggestedPostPayment) TonTransactionTypeType() string { return TypeTonTransactionTypeSuggestedPostPayment } +// The transaction is a purchase of an upgraded gift for some user or channel; for regular users only +type TonTransactionTypeUpgradedGiftPurchase struct { + meta + // Identifier of the user that sold the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *TonTransactionTypeUpgradedGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUpgradedGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUpgradedGiftPurchase) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUpgradedGiftPurchase) GetType() string { + return TypeTonTransactionTypeUpgradedGiftPurchase +} + +func (*TonTransactionTypeUpgradedGiftPurchase) TonTransactionTypeType() string { + return TypeTonTransactionTypeUpgradedGiftPurchase +} + +// The transaction is a sale of an upgraded gift; for regular users only +type TonTransactionTypeUpgradedGiftSale struct { + meta + // Identifier of the user that bought the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` + // The number of Toncoins received by the Telegram for each 1000 Toncoins received by the seller of the gift + CommissionPerMille int32 `json:"commission_per_mille"` + // The amount of Toncoins that were received by the Telegram; in the smallest units of the currency + CommissionToncoinAmount int64 `json:"commission_toncoin_amount"` +} + +func (entity *TonTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUpgradedGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUpgradedGiftSale) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUpgradedGiftSale) GetType() string { + return TypeTonTransactionTypeUpgradedGiftSale +} + +func (*TonTransactionTypeUpgradedGiftSale) TonTransactionTypeType() string { + return TypeTonTransactionTypeUpgradedGiftSale +} + // The transaction is a transaction of an unsupported type type TonTransactionTypeUnsupported struct{ meta @@ -12087,6 +12973,62 @@ func (*ProfileAccentColor) GetType() string { return TypeProfileAccentColor } +// Contains description of user rating +type UserRating struct { + meta + // The level of the user; may be negative + Level int32 `json:"level"` + // True, if the maximum level is reached + IsMaximumLevelReached bool `json:"is_maximum_level_reached"` + // Numerical value of the rating + Rating int64 `json:"rating"` + // The rating required for the current level + CurrentLevelRating int64 `json:"current_level_rating"` + // The rating required for the next level; 0 if the maximum level is reached + NextLevelRating int64 `json:"next_level_rating"` +} + +func (entity *UserRating) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserRating + + return json.Marshal((*stub)(entity)) +} + +func (*UserRating) GetClass() string { + return ClassUserRating +} + +func (*UserRating) GetType() string { + return TypeUserRating +} + +// Contains information about restrictions that must be applied to a chat or a message +type RestrictionInfo struct { + meta + // A human-readable description of the reason why access to the content must be restricted. If empty, then the content can be accessed, but may be covered by hidden with 18+ spoiler anyway + RestrictionReason string `json:"restriction_reason"` + // True, if media content of the messages must be hidden with 18+ spoiler. Use value of the option "can_ignore_sensitive_content_restrictions" to check whether the current user can ignore the restriction. If age verification parameters were received in updateAgeVerificationParameters, then the user must complete age verification to ignore the restriction. Set the option "ignore_sensitive_content_restrictions" to true if the user passes age verification + HasSensitiveContent bool `json:"has_sensitive_content"` +} + +func (entity *RestrictionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RestrictionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*RestrictionInfo) GetClass() string { + return ClassRestrictionInfo +} + +func (*RestrictionInfo) GetType() string { + return TypeRestrictionInfo +} + // A custom emoji set as emoji status type EmojiStatusTypeCustomEmoji struct { meta @@ -12309,8 +13251,8 @@ type User struct { IsPremium bool `json:"is_premium"` // True, if the user is Telegram support account IsSupport bool `json:"is_support"` - // If non-empty, it contains a human-readable description of the reason why access to this user must be restricted - RestrictionReason string `json:"restriction_reason"` + // Information about restrictions that must be applied to the corresponding private chat; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` // True, if the user has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` // True, if the user has unread non-expired stories available to the current user @@ -12366,7 +13308,7 @@ func (user *User) UnmarshalJSON(data []byte) error { VerificationStatus *VerificationStatus `json:"verification_status"` IsPremium bool `json:"is_premium"` IsSupport bool `json:"is_support"` - RestrictionReason string `json:"restriction_reason"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` RestrictsNewChats bool `json:"restricts_new_chats"` @@ -12400,7 +13342,7 @@ func (user *User) UnmarshalJSON(data []byte) error { user.VerificationStatus = tmp.VerificationStatus user.IsPremium = tmp.IsPremium user.IsSupport = tmp.IsSupport - user.RestrictionReason = tmp.RestrictionReason + user.RestrictionInfo = tmp.RestrictionInfo user.HasActiveStories = tmp.HasActiveStories user.HasUnreadActiveStories = tmp.HasUnreadActiveStories user.RestrictsNewChats = tmp.RestrictsNewChats @@ -12595,6 +13537,16 @@ type UserFullInfo struct { GiftSettings *GiftSettings `json:"gift_settings"` // Information about verification status of the user provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` + // The main tab chosen by the user; may be null if not chosen manually + MainProfileTab ProfileTab `json:"main_profile_tab"` + // The first audio file added to the user's profile; may be null if none + FirstProfileAudio *Audio `json:"first_profile_audio"` + // The current rating of the user; may be null if none + Rating *UserRating `json:"rating"` + // The rating of the user after the next change; may be null if the user isn't the current user or there are no pending rating changes + PendingRating *UserRating `json:"pending_rating"` + // Unix timestamp when rating of the user will change to pending_rating; 0 if the user isn't the current user or there are no pending rating changes + PendingRatingDate int32 `json:"pending_rating_date"` // Information about business settings for Telegram Business accounts; may be null if none BusinessInfo *BusinessInfo `json:"business_info"` // For bots, information about the bot; may be null if the user isn't a bot @@ -12641,6 +13593,11 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` GiftSettings *GiftSettings `json:"gift_settings"` BotVerification *BotVerification `json:"bot_verification"` + MainProfileTab json.RawMessage `json:"main_profile_tab"` + FirstProfileAudio *Audio `json:"first_profile_audio"` + Rating *UserRating `json:"rating"` + PendingRating *UserRating `json:"pending_rating"` + PendingRatingDate int32 `json:"pending_rating_date"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` } @@ -12671,12 +13628,19 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount userFullInfo.GiftSettings = tmp.GiftSettings userFullInfo.BotVerification = tmp.BotVerification + userFullInfo.FirstProfileAudio = tmp.FirstProfileAudio + userFullInfo.Rating = tmp.Rating + userFullInfo.PendingRating = tmp.PendingRating + userFullInfo.PendingRatingDate = tmp.PendingRatingDate userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) userFullInfo.BlockList = fieldBlockList + fieldMainProfileTab, _ := UnmarshalProfileTab(tmp.MainProfileTab) + userFullInfo.MainProfileTab = fieldMainProfileTab + return nil } @@ -14007,10 +14971,8 @@ type Supergroup struct { HasDirectMessagesGroup bool `json:"has_direct_messages_group"` // True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups HasForumTabs bool `json:"has_forum_tabs"` - // True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler - HasSensitiveContent bool `json:"has_sensitive_content"` - // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted - RestrictionReason string `json:"restriction_reason"` + // Information about the restrictions that must be applied to the corresponding supergroup or channel chat; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` // Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message PaidMessageStarCount int64 `json:"paid_message_star_count"` // True, if the supergroup or channel has non-expired stories available to the current user @@ -14060,8 +15022,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { VerificationStatus *VerificationStatus `json:"verification_status"` HasDirectMessagesGroup bool `json:"has_direct_messages_group"` HasForumTabs bool `json:"has_forum_tabs"` - HasSensitiveContent bool `json:"has_sensitive_content"` - RestrictionReason string `json:"restriction_reason"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` PaidMessageStarCount int64 `json:"paid_message_star_count"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` @@ -14094,8 +15055,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.VerificationStatus = tmp.VerificationStatus supergroup.HasDirectMessagesGroup = tmp.HasDirectMessagesGroup supergroup.HasForumTabs = tmp.HasForumTabs - supergroup.HasSensitiveContent = tmp.HasSensitiveContent - supergroup.RestrictionReason = tmp.RestrictionReason + supergroup.RestrictionInfo = tmp.RestrictionInfo supergroup.PaidMessageStarCount = tmp.PaidMessageStarCount supergroup.HasActiveStories = tmp.HasActiveStories supergroup.HasUnreadActiveStories = tmp.HasUnreadActiveStories @@ -14183,6 +15143,8 @@ type SupergroupFullInfo struct { BotCommands []*BotCommands `json:"bot_commands"` // Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` + // The main tab chosen by the administrators of the channel; may be null if not chosen manually + MainProfileTab ProfileTab `json:"main_profile_tab"` // Identifier of the basic group from which supergroup was upgraded; 0 if none UpgradedFromBasicGroupId int64 `json:"upgraded_from_basic_group_id"` // Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none @@ -14205,6 +15167,101 @@ func (*SupergroupFullInfo) GetType() string { return TypeSupergroupFullInfo } +func (supergroupFullInfo *SupergroupFullInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Photo *ChatPhoto `json:"photo"` + Description string `json:"description"` + MemberCount int32 `json:"member_count"` + AdministratorCount int32 `json:"administrator_count"` + RestrictedCount int32 `json:"restricted_count"` + BannedCount int32 `json:"banned_count"` + LinkedChatId int64 `json:"linked_chat_id"` + DirectMessagesChatId int64 `json:"direct_messages_chat_id"` + SlowModeDelay int32 `json:"slow_mode_delay"` + SlowModeDelayExpiresIn float64 `json:"slow_mode_delay_expires_in"` + CanEnablePaidMessages bool `json:"can_enable_paid_messages"` + CanEnablePaidReaction bool `json:"can_enable_paid_reaction"` + CanGetMembers bool `json:"can_get_members"` + HasHiddenMembers bool `json:"has_hidden_members"` + CanHideMembers bool `json:"can_hide_members"` + CanSetStickerSet bool `json:"can_set_sticker_set"` + CanSetLocation bool `json:"can_set_location"` + CanGetStatistics bool `json:"can_get_statistics"` + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + CanGetStarRevenueStatistics bool `json:"can_get_star_revenue_statistics"` + CanSendGift bool `json:"can_send_gift"` + CanToggleAggressiveAntiSpam bool `json:"can_toggle_aggressive_anti_spam"` + IsAllHistoryAvailable bool `json:"is_all_history_available"` + CanHaveSponsoredMessages bool `json:"can_have_sponsored_messages"` + HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled"` + HasPaidMediaAllowed bool `json:"has_paid_media_allowed"` + HasPinnedStories bool `json:"has_pinned_stories"` + GiftCount int32 `json:"gift_count"` + MyBoostCount int32 `json:"my_boost_count"` + UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + StickerSetId JsonInt64 `json:"sticker_set_id"` + CustomEmojiStickerSetId JsonInt64 `json:"custom_emoji_sticker_set_id"` + Location *ChatLocation `json:"location"` + InviteLink *ChatInviteLink `json:"invite_link"` + BotCommands []*BotCommands `json:"bot_commands"` + BotVerification *BotVerification `json:"bot_verification"` + MainProfileTab json.RawMessage `json:"main_profile_tab"` + UpgradedFromBasicGroupId int64 `json:"upgraded_from_basic_group_id"` + UpgradedFromMaxMessageId int64 `json:"upgraded_from_max_message_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + supergroupFullInfo.Photo = tmp.Photo + supergroupFullInfo.Description = tmp.Description + supergroupFullInfo.MemberCount = tmp.MemberCount + supergroupFullInfo.AdministratorCount = tmp.AdministratorCount + supergroupFullInfo.RestrictedCount = tmp.RestrictedCount + supergroupFullInfo.BannedCount = tmp.BannedCount + supergroupFullInfo.LinkedChatId = tmp.LinkedChatId + supergroupFullInfo.DirectMessagesChatId = tmp.DirectMessagesChatId + supergroupFullInfo.SlowModeDelay = tmp.SlowModeDelay + supergroupFullInfo.SlowModeDelayExpiresIn = tmp.SlowModeDelayExpiresIn + supergroupFullInfo.CanEnablePaidMessages = tmp.CanEnablePaidMessages + supergroupFullInfo.CanEnablePaidReaction = tmp.CanEnablePaidReaction + supergroupFullInfo.CanGetMembers = tmp.CanGetMembers + supergroupFullInfo.HasHiddenMembers = tmp.HasHiddenMembers + supergroupFullInfo.CanHideMembers = tmp.CanHideMembers + supergroupFullInfo.CanSetStickerSet = tmp.CanSetStickerSet + supergroupFullInfo.CanSetLocation = tmp.CanSetLocation + supergroupFullInfo.CanGetStatistics = tmp.CanGetStatistics + supergroupFullInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics + supergroupFullInfo.CanGetStarRevenueStatistics = tmp.CanGetStarRevenueStatistics + supergroupFullInfo.CanSendGift = tmp.CanSendGift + supergroupFullInfo.CanToggleAggressiveAntiSpam = tmp.CanToggleAggressiveAntiSpam + supergroupFullInfo.IsAllHistoryAvailable = tmp.IsAllHistoryAvailable + supergroupFullInfo.CanHaveSponsoredMessages = tmp.CanHaveSponsoredMessages + supergroupFullInfo.HasAggressiveAntiSpamEnabled = tmp.HasAggressiveAntiSpamEnabled + supergroupFullInfo.HasPaidMediaAllowed = tmp.HasPaidMediaAllowed + supergroupFullInfo.HasPinnedStories = tmp.HasPinnedStories + supergroupFullInfo.GiftCount = tmp.GiftCount + supergroupFullInfo.MyBoostCount = tmp.MyBoostCount + supergroupFullInfo.UnrestrictBoostCount = tmp.UnrestrictBoostCount + supergroupFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount + supergroupFullInfo.StickerSetId = tmp.StickerSetId + supergroupFullInfo.CustomEmojiStickerSetId = tmp.CustomEmojiStickerSetId + supergroupFullInfo.Location = tmp.Location + supergroupFullInfo.InviteLink = tmp.InviteLink + supergroupFullInfo.BotCommands = tmp.BotCommands + supergroupFullInfo.BotVerification = tmp.BotVerification + supergroupFullInfo.UpgradedFromBasicGroupId = tmp.UpgradedFromBasicGroupId + supergroupFullInfo.UpgradedFromMaxMessageId = tmp.UpgradedFromMaxMessageId + + fieldMainProfileTab, _ := UnmarshalProfileTab(tmp.MainProfileTab) + supergroupFullInfo.MainProfileTab = fieldMainProfileTab + + return nil +} + // The secret chat is not yet created; waiting for the other user to get online type SecretChatStatePending struct{ meta @@ -14340,6 +15397,37 @@ func (secretChat *SecretChat) UnmarshalJSON(data []byte) error { return nil } +// Contains information about public post search limits +type PublicPostSearchLimits struct { + meta + // Number of queries that can be sent daily for free + DailyFreeQueryCount int32 `json:"daily_free_query_count"` + // Number of remaining free queries today + RemainingFreeQueryCount int32 `json:"remaining_free_query_count"` + // Amount of time till the next free query can be sent; 0 if it can be sent now + NextFreeQueryIn int32 `json:"next_free_query_in"` + // Number of Telegram Stars that must be paid for each non-free query + StarCount JsonInt64 `json:"star_count"` + // True, if the search for the specified query isn't charged + IsCurrentQueryFree bool `json:"is_current_query_free"` +} + +func (entity *PublicPostSearchLimits) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicPostSearchLimits + + return json.Marshal((*stub)(entity)) +} + +func (*PublicPostSearchLimits) GetClass() string { + return ClassPublicPostSearchLimits +} + +func (*PublicPostSearchLimits) GetType() string { + return TypePublicPostSearchLimits +} + // The message was sent by a known user type MessageSenderUser struct { meta @@ -15968,10 +17056,8 @@ type Message struct { MediaAlbumId JsonInt64 `json:"media_album_id"` // Unique identifier of the effect added to the message; 0 if none EffectId JsonInt64 `json:"effect_id"` - // True, if media content of the message must be hidden with 18+ spoiler - HasSensitiveContent bool `json:"has_sensitive_content"` - // If non-empty, contains a human-readable description of the reason why access to this message must be restricted - RestrictionReason string `json:"restriction_reason"` + // Information about the restrictions that must be applied to the message content; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` // Content of the message Content MessageContent `json:"content"` // Reply markup for the message; may be null if none @@ -16031,8 +17117,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` EffectId JsonInt64 `json:"effect_id"` - HasSensitiveContent bool `json:"has_sensitive_content"` - RestrictionReason string `json:"restriction_reason"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` Content json.RawMessage `json:"content"` ReplyMarkup json.RawMessage `json:"reply_markup"` } @@ -16071,8 +17156,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId message.EffectId = tmp.EffectId - message.HasSensitiveContent = tmp.HasSensitiveContent - message.RestrictionReason = tmp.RestrictionReason + message.RestrictionInfo = tmp.RestrictionInfo fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) message.SenderId = fieldSenderId @@ -16180,6 +17264,35 @@ func (*FoundChatMessages) GetType() string { return TypeFoundChatMessages } +// Contains a list of messages found by a public post search +type FoundPublicPosts struct { + meta + // List of found public posts + Messages []*Message `json:"messages"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` + // Updated public post search limits after the query; repeated requests with the same query will be free; may be null if they didn't change + SearchLimits *PublicPostSearchLimits `json:"search_limits"` + // True, if the query has failed because search limits are exceeded. In this case search_limits.daily_free_query_count will be equal to 0 + AreLimitsExceeded bool `json:"are_limits_exceeded"` +} + +func (entity *FoundPublicPosts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundPublicPosts + + return json.Marshal((*stub)(entity)) +} + +func (*FoundPublicPosts) GetClass() string { + return ClassFoundPublicPosts +} + +func (*FoundPublicPosts) GetType() string { + return TypeFoundPublicPosts +} + // Contains information about a message in a specific position type MessagePosition struct { meta @@ -18354,8 +19467,8 @@ type Chat struct { EmojiStatus *EmojiStatus `json:"emoji_status"` // Background set for the chat; may be null if none Background *ChatBackground `json:"background"` - // If non-empty, name of a theme, set for the chat - ThemeName string `json:"theme_name"` + // Theme set for the chat; may be null if none + Theme ChatTheme `json:"theme"` // Information about actions which must be possible to do through the chat action bar; may be null if none ActionBar ChatActionBar `json:"action_bar"` // Information about bar for managing a business bot in the chat; may be null if none @@ -18423,7 +19536,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` EmojiStatus *EmojiStatus `json:"emoji_status"` Background *ChatBackground `json:"background"` - ThemeName string `json:"theme_name"` + Theme json.RawMessage `json:"theme"` ActionBar json.RawMessage `json:"action_bar"` BusinessBotManageBar *BusinessBotManageBar `json:"business_bot_manage_bar"` VideoChat *VideoChat `json:"video_chat"` @@ -18466,7 +19579,6 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.MessageAutoDeleteTime = tmp.MessageAutoDeleteTime chat.EmojiStatus = tmp.EmojiStatus chat.Background = tmp.Background - chat.ThemeName = tmp.ThemeName chat.BusinessBotManageBar = tmp.BusinessBotManageBar chat.VideoChat = tmp.VideoChat chat.PendingJoinRequests = tmp.PendingJoinRequests @@ -18489,6 +19601,9 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { fieldAvailableReactions, _ := UnmarshalChatAvailableReactions(tmp.AvailableReactions) chat.AvailableReactions = fieldAvailableReactions + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + chat.Theme = fieldTheme + fieldActionBar, _ := UnmarshalChatActionBar(tmp.ActionBar) chat.ActionBar = fieldActionBar @@ -20418,14 +21533,141 @@ func (*SharedChat) GetType() string { return TypeSharedChat } +// Classic light theme +type BuiltInThemeClassic struct{ + meta +} + +func (entity *BuiltInThemeClassic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeClassic + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeClassic) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeClassic) GetType() string { + return TypeBuiltInThemeClassic +} + +func (*BuiltInThemeClassic) BuiltInThemeType() string { + return TypeBuiltInThemeClassic +} + +// Regular light theme +type BuiltInThemeDay struct{ + meta +} + +func (entity *BuiltInThemeDay) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeDay + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeDay) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeDay) GetType() string { + return TypeBuiltInThemeDay +} + +func (*BuiltInThemeDay) BuiltInThemeType() string { + return TypeBuiltInThemeDay +} + +// Regular dark theme +type BuiltInThemeNight struct{ + meta +} + +func (entity *BuiltInThemeNight) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeNight + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeNight) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeNight) GetType() string { + return TypeBuiltInThemeNight +} + +func (*BuiltInThemeNight) BuiltInThemeType() string { + return TypeBuiltInThemeNight +} + +// Tinted dark theme +type BuiltInThemeTinted struct{ + meta +} + +func (entity *BuiltInThemeTinted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeTinted + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeTinted) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeTinted) GetType() string { + return TypeBuiltInThemeTinted +} + +func (*BuiltInThemeTinted) BuiltInThemeType() string { + return TypeBuiltInThemeTinted +} + +// Arctic light theme +type BuiltInThemeArctic struct{ + meta +} + +func (entity *BuiltInThemeArctic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeArctic + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeArctic) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeArctic) GetType() string { + return TypeBuiltInThemeArctic +} + +func (*BuiltInThemeArctic) BuiltInThemeType() string { + return TypeBuiltInThemeArctic +} + // Describes theme settings type ThemeSettings struct { meta + // Base theme for this theme + BaseTheme BuiltInTheme `json:"base_theme"` // Theme accent color in ARGB format AccentColor int32 `json:"accent_color"` // The background to be used in chats; may be null Background *Background `json:"background"` - // The fill to be used as a background for outgoing messages + // The fill to be used as a background for outgoing messages; may be null if the fill from the base theme must be used instead OutgoingMessageFill BackgroundFill `json:"outgoing_message_fill"` // If true, the freeform gradient fill needs to be animated on every sent message AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` @@ -20451,6 +21693,7 @@ func (*ThemeSettings) GetType() string { func (themeSettings *ThemeSettings) UnmarshalJSON(data []byte) error { var tmp struct { + BaseTheme json.RawMessage `json:"base_theme"` AccentColor int32 `json:"accent_color"` Background *Background `json:"background"` OutgoingMessageFill json.RawMessage `json:"outgoing_message_fill"` @@ -20468,6 +21711,9 @@ func (themeSettings *ThemeSettings) UnmarshalJSON(data []byte) error { themeSettings.AnimateOutgoingMessageFill = tmp.AnimateOutgoingMessageFill themeSettings.OutgoingMessageAccentColor = tmp.OutgoingMessageAccentColor + fieldBaseTheme, _ := UnmarshalBuiltInTheme(tmp.BaseTheme) + themeSettings.BaseTheme = fieldBaseTheme + fieldOutgoingMessageFill, _ := UnmarshalBackgroundFill(tmp.OutgoingMessageFill) themeSettings.OutgoingMessageFill = fieldOutgoingMessageFill @@ -23130,6 +24376,33 @@ func (linkPreviewTypeChat *LinkPreviewTypeChat) UnmarshalJSON(data []byte) error return nil } +// The link is a link to a direct messages chat of a channel +type LinkPreviewTypeDirectMessagesChat struct { + meta + // Photo of the channel chat; may be null + Photo *ChatPhoto `json:"photo"` +} + +func (entity *LinkPreviewTypeDirectMessagesChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeDirectMessagesChat + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeDirectMessagesChat) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeDirectMessagesChat) GetType() string { + return TypeLinkPreviewTypeDirectMessagesChat +} + +func (*LinkPreviewTypeDirectMessagesChat) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeDirectMessagesChat +} + // The link is a link to a general file type LinkPreviewTypeDocument struct { meta @@ -23328,6 +24601,33 @@ func (*LinkPreviewTypeExternalVideo) LinkPreviewTypeType() string { return TypeLinkPreviewTypeExternalVideo } +// The link is a link to a gift collection +type LinkPreviewTypeGiftCollection struct { + meta + // Icons for some gifts from the collection; may be empty + Icons []*Sticker `json:"icons"` +} + +func (entity *LinkPreviewTypeGiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeGiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeGiftCollection) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeGiftCollection) GetType() string { + return TypeLinkPreviewTypeGiftCollection +} + +func (*LinkPreviewTypeGiftCollection) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeGiftCollection +} + // The link is a link to a group call that isn't bound to a chat type LinkPreviewTypeGroupCall struct{ meta @@ -23563,6 +24863,35 @@ func (*LinkPreviewTypeStory) LinkPreviewTypeType() string { return TypeLinkPreviewTypeStory } +// The link is a link to an album of stories +type LinkPreviewTypeStoryAlbum struct { + meta + // Icon of the album; may be null if none + PhotoIcon *Photo `json:"photo_icon"` + // Video icon of the album; may be null if none + VideoIcon *Video `json:"video_icon"` +} + +func (entity *LinkPreviewTypeStoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeStoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeStoryAlbum) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeStoryAlbum) GetType() string { + return TypeLinkPreviewTypeStoryAlbum +} + +func (*LinkPreviewTypeStoryAlbum) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeStoryAlbum +} + // The link is a link to boost a supergroup chat type LinkPreviewTypeSupergroupBoost struct { meta @@ -28761,8 +30090,8 @@ func (*MessageChatSetBackground) MessageContentType() string { // A theme in the chat has been changed type MessageChatSetTheme struct { meta - // If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset to the default one - ThemeName string `json:"theme_name"` + // New theme for the chat; may be null if chat theme was reset to the default one + Theme ChatTheme `json:"theme"` } func (entity *MessageChatSetTheme) MarshalJSON() ([]byte, error) { @@ -28785,6 +30114,22 @@ func (*MessageChatSetTheme) MessageContentType() string { return TypeMessageChatSetTheme } +func (messageChatSetTheme *MessageChatSetTheme) UnmarshalJSON(data []byte) error { + var tmp struct { + Theme json.RawMessage `json:"theme"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + messageChatSetTheme.Theme = fieldTheme + + return nil +} + // The auto-delete or self-destruct timer for messages in the chat has been changed type MessageChatSetMessageAutoDeleteTime struct { meta @@ -29637,7 +30982,7 @@ type MessageGift struct { meta // The gift Gift *Gift `json:"gift"` - // Sender of the gift + // Sender of the gift; may be null for outgoing messages about prepaid upgrade of gifts from unknown users SenderId MessageSender `json:"sender_id"` // Receiver of the gift ReceiverId MessageSender `json:"receiver_id"` @@ -29649,10 +30994,14 @@ type MessageGift struct { SellStarCount int64 `json:"sell_star_count"` // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + // True, if the upgrade was bought after the gift was sent. In this case, prepaid upgrade cost must not be added to the gift cost + IsUpgradeSeparate bool `json:"is_upgrade_separate"` // 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 or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` + // True, if the message is about prepaid upgrade of the gift by another user + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` // True, if the gift can be upgraded to a unique gift; only for the receiver of the gift CanBeUpgraded bool `json:"can_be_upgraded"` // True, if the gift was converted to Telegram Stars; only for the receiver of the gift @@ -29663,6 +31012,8 @@ type MessageGift struct { WasRefunded bool `json:"was_refunded"` // Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` + // If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } func (entity *MessageGift) MarshalJSON() ([]byte, error) { @@ -29694,13 +31045,16 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { Text *FormattedText `json:"text"` SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + IsUpgradeSeparate bool `json:"is_upgrade_separate"` IsPrivate bool `json:"is_private"` IsSaved bool `json:"is_saved"` + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` CanBeUpgraded bool `json:"can_be_upgraded"` WasConverted bool `json:"was_converted"` WasUpgraded bool `json:"was_upgraded"` WasRefunded bool `json:"was_refunded"` UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } err := json.Unmarshal(data, &tmp) @@ -29713,13 +31067,16 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { messageGift.Text = tmp.Text messageGift.SellStarCount = tmp.SellStarCount messageGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + messageGift.IsUpgradeSeparate = tmp.IsUpgradeSeparate messageGift.IsPrivate = tmp.IsPrivate messageGift.IsSaved = tmp.IsSaved + messageGift.IsPrepaidUpgrade = tmp.IsPrepaidUpgrade messageGift.CanBeUpgraded = tmp.CanBeUpgraded messageGift.WasConverted = tmp.WasConverted messageGift.WasUpgraded = tmp.WasUpgraded messageGift.WasRefunded = tmp.WasRefunded messageGift.UpgradedReceivedGiftId = tmp.UpgradedReceivedGiftId + messageGift.PrepaidUpgradeHash = tmp.PrepaidUpgradeHash fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageGift.SenderId = fieldSenderId @@ -29751,11 +31108,11 @@ type MessageUpgradedGift struct { WasTransferred bool `json:"was_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift NextTransferDate int32 `json:"next_transfer_date"` - // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift NextResaleDate int32 `json:"next_resale_date"` - // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -29831,8 +31188,8 @@ type MessageRefundedUpgradedGift struct { SenderId MessageSender `json:"sender_id"` // Receiver of the gift ReceiverId MessageSender `json:"receiver_id"` - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift - IsUpgrade bool `json:"is_upgrade"` + // Origin of the upgraded gift + Origin UpgradedGiftOrigin `json:"origin"` } func (entity *MessageRefundedUpgradedGift) MarshalJSON() ([]byte, error) { @@ -29860,7 +31217,7 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da Gift *Gift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` ReceiverId json.RawMessage `json:"receiver_id"` - IsUpgrade bool `json:"is_upgrade"` + Origin json.RawMessage `json:"origin"` } err := json.Unmarshal(data, &tmp) @@ -29869,7 +31226,6 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da } messageRefundedUpgradedGift.Gift = tmp.Gift - messageRefundedUpgradedGift.IsUpgrade = tmp.IsUpgrade fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageRefundedUpgradedGift.SenderId = fieldSenderId @@ -29877,6 +31233,9 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) messageRefundedUpgradedGift.ReceiverId = fieldReceiverId + fieldOrigin, _ := UnmarshalUpgradedGiftOrigin(tmp.Origin) + messageRefundedUpgradedGift.Origin = fieldOrigin + return nil } @@ -35319,6 +36678,8 @@ type Story struct { IsPostedToChatPage bool `json:"is_posted_to_chat_page"` // True, if the story is visible only for the current user IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + // True, if the story can be added to an album + CanBeAddedToAlbum bool `json:"can_be_added_to_album"` // True, if the story can be deleted CanBeDeleted bool `json:"can_be_deleted"` // True, if the story can be edited @@ -35349,6 +36710,8 @@ type Story struct { Areas []*StoryArea `json:"areas"` // Caption of the story Caption *FormattedText `json:"caption"` + // Identifiers of story albums to which the story is added; only for manageable stories + AlbumIds []int32 `json:"album_ids"` } func (entity *Story) MarshalJSON() ([]byte, error) { @@ -35378,6 +36741,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { IsEdited bool `json:"is_edited"` IsPostedToChatPage bool `json:"is_posted_to_chat_page"` IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + CanBeAddedToAlbum bool `json:"can_be_added_to_album"` CanBeDeleted bool `json:"can_be_deleted"` CanBeEdited bool `json:"can_be_edited"` CanBeForwarded bool `json:"can_be_forwarded"` @@ -35393,6 +36757,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { Content json.RawMessage `json:"content"` Areas []*StoryArea `json:"areas"` Caption *FormattedText `json:"caption"` + AlbumIds []int32 `json:"album_ids"` } err := json.Unmarshal(data, &tmp) @@ -35408,6 +36773,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.IsEdited = tmp.IsEdited story.IsPostedToChatPage = tmp.IsPostedToChatPage story.IsVisibleOnlyForSelf = tmp.IsVisibleOnlyForSelf + story.CanBeAddedToAlbum = tmp.CanBeAddedToAlbum story.CanBeDeleted = tmp.CanBeDeleted story.CanBeEdited = tmp.CanBeEdited story.CanBeForwarded = tmp.CanBeForwarded @@ -35420,6 +36786,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.InteractionInfo = tmp.InteractionInfo story.Areas = tmp.Areas story.Caption = tmp.Caption + story.AlbumIds = tmp.AlbumIds fieldPosterId, _ := UnmarshalMessageSender(tmp.PosterId) story.PosterId = fieldPosterId @@ -35490,6 +36857,58 @@ func (*FoundStories) GetType() string { return TypeFoundStories } +// Describes album of stories +type StoryAlbum struct { + meta + // Unique identifier of the album + Id int32 `json:"id"` + // Name of the album + Name string `json:"name"` + // Icon of the album; may be null if none + PhotoIcon *Photo `json:"photo_icon"` + // Video icon of the album; may be null if none + VideoIcon *Video `json:"video_icon"` +} + +func (entity *StoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAlbum) GetClass() string { + return ClassStoryAlbum +} + +func (*StoryAlbum) GetType() string { + return TypeStoryAlbum +} + +// Represents a list of story albums +type StoryAlbums struct { + meta + // List of story albums + Albums []*StoryAlbum `json:"albums"` +} + +func (entity *StoryAlbums) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAlbums + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAlbums) GetClass() string { + return ClassStoryAlbums +} + +func (*StoryAlbums) GetType() string { + return TypeStoryAlbums +} + // Contains identifier of a story along with identifier of the chat that posted it type StoryFullId struct { meta @@ -35551,6 +36970,8 @@ type ChatActiveStories struct { List StoryList `json:"list"` // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order Order int64 `json:"order"` + // True, if the stories are shown in the main story list and can be archived; otherwise, the stories can be hidden from the main story list only by calling removeTopChat with topChatCategoryUsers and the chat_id. Stories of the current user can't be archived nor hidden using removeTopChat + CanBeArchived bool `json:"can_be_archived"` // Identifier of the last read active story MaxReadStoryId int32 `json:"max_read_story_id"` // Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) @@ -35578,6 +36999,7 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { ChatId int64 `json:"chat_id"` List json.RawMessage `json:"list"` Order int64 `json:"order"` + CanBeArchived bool `json:"can_be_archived"` MaxReadStoryId int32 `json:"max_read_story_id"` Stories []*StoryInfo `json:"stories"` } @@ -35589,6 +37011,7 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { chatActiveStories.ChatId = tmp.ChatId chatActiveStories.Order = tmp.Order + chatActiveStories.CanBeArchived = tmp.CanBeArchived chatActiveStories.MaxReadStoryId = tmp.MaxReadStoryId chatActiveStories.Stories = tmp.Stories @@ -44983,6 +46406,8 @@ type StorePaymentPurposeStars struct { Amount int64 `json:"amount"` // Number of bought Telegram Stars StarCount int64 `json:"star_count"` + // Identifier of the chat that is supposed to receive the Telegram Stars; pass 0 if none + ChatId int64 `json:"chat_id"` } func (entity *StorePaymentPurposeStars) MarshalJSON() ([]byte, error) { @@ -45212,6 +46637,8 @@ type TelegramPaymentPurposeStars struct { Amount int64 `json:"amount"` // Number of bought Telegram Stars StarCount int64 `json:"star_count"` + // Identifier of the chat that is supposed to receive the Telegram Stars; pass 0 if none + ChatId int64 `json:"chat_id"` } func (entity *TelegramPaymentPurposeStars) MarshalJSON() ([]byte, error) { @@ -45903,10 +47330,10 @@ func (backgroundTypeFill *BackgroundTypeFill) UnmarshalJSON(data []byte) error { return nil } -// A background from a chat theme; can be used only as a chat background in channels +// A background from a chat theme based on an emoji; can be used only as a chat background in channels type BackgroundTypeChatTheme struct { meta - // Name of the chat theme + // Name of the emoji chat theme ThemeName string `json:"theme_name"` } @@ -46027,8 +47454,8 @@ func (*InputBackgroundPrevious) InputBackgroundType() string { return TypeInputBackgroundPrevious } -// Describes a chat theme -type ChatTheme struct { +// Describes a chat theme based on an emoji +type EmojiChatTheme struct { meta // Theme name Name string `json:"name"` @@ -46038,20 +47465,180 @@ type ChatTheme struct { DarkSettings *ThemeSettings `json:"dark_settings"` } -func (entity *ChatTheme) MarshalJSON() ([]byte, error) { +func (entity *EmojiChatTheme) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatTheme + type stub EmojiChatTheme return json.Marshal((*stub)(entity)) } -func (*ChatTheme) GetClass() string { +func (*EmojiChatTheme) GetClass() string { + return ClassEmojiChatTheme +} + +func (*EmojiChatTheme) GetType() string { + return TypeEmojiChatTheme +} + +// Describes a chat theme based on an upgraded gift +type GiftChatTheme struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // Theme settings for a light chat theme + LightSettings *ThemeSettings `json:"light_settings"` + // Theme settings for a dark chat theme + DarkSettings *ThemeSettings `json:"dark_settings"` +} + +func (entity *GiftChatTheme) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftChatTheme + + return json.Marshal((*stub)(entity)) +} + +func (*GiftChatTheme) GetClass() string { + return ClassGiftChatTheme +} + +func (*GiftChatTheme) GetType() string { + return TypeGiftChatTheme +} + +// Contains a list of chat themes based on upgraded gifts +type GiftChatThemes struct { + meta + // A list of chat themes + Themes []*GiftChatTheme `json:"themes"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *GiftChatThemes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftChatThemes + + return json.Marshal((*stub)(entity)) +} + +func (*GiftChatThemes) GetClass() string { + return ClassGiftChatThemes +} + +func (*GiftChatThemes) GetType() string { + return TypeGiftChatThemes +} + +// A chat theme based on an emoji +type ChatThemeEmoji struct { + meta + // Name of the theme; full theme description is received through updateEmojiChatThemes + Name string `json:"name"` +} + +func (entity *ChatThemeEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatThemeEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*ChatThemeEmoji) GetClass() string { return ClassChatTheme } -func (*ChatTheme) GetType() string { - return TypeChatTheme +func (*ChatThemeEmoji) GetType() string { + return TypeChatThemeEmoji +} + +func (*ChatThemeEmoji) ChatThemeType() string { + return TypeChatThemeEmoji +} + +// A chat theme based on an upgraded gift +type ChatThemeGift struct { + meta + // The chat theme + GiftTheme *GiftChatTheme `json:"gift_theme"` +} + +func (entity *ChatThemeGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatThemeGift + + return json.Marshal((*stub)(entity)) +} + +func (*ChatThemeGift) GetClass() string { + return ClassChatTheme +} + +func (*ChatThemeGift) GetType() string { + return TypeChatThemeGift +} + +func (*ChatThemeGift) ChatThemeType() string { + return TypeChatThemeGift +} + +// A theme based on an emoji +type InputChatThemeEmoji struct { + meta + // Name of the theme + Name string `json:"name"` +} + +func (entity *InputChatThemeEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatThemeEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatThemeEmoji) GetClass() string { + return ClassInputChatTheme +} + +func (*InputChatThemeEmoji) GetType() string { + return TypeInputChatThemeEmoji +} + +func (*InputChatThemeEmoji) InputChatThemeType() string { + return TypeInputChatThemeEmoji +} + +// A theme based on an upgraded gift +type InputChatThemeGift struct { + meta + // Name of the upgraded gift. A gift can be used only in one chat in a time. When the same gift is used in another chat, theme in the previous chat is reset to default + Name string `json:"name"` +} + +func (entity *InputChatThemeGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatThemeGift + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatThemeGift) GetClass() string { + return ClassInputChatTheme +} + +func (*InputChatThemeGift) GetType() string { + return TypeInputChatThemeGift +} + +func (*InputChatThemeGift) InputChatThemeType() string { + return TypeInputChatThemeGift } // Describes a time zone @@ -46887,8 +48474,10 @@ func (*PushMessageContentContact) PushMessageContentType() string { } // A contact has registered with Telegram -type PushMessageContentContactRegistered struct{ +type PushMessageContentContactRegistered struct { meta + // True, if the user joined Telegram as a Telegram Premium account + AsPremiumAccount bool `json:"as_premium_account"` } func (entity *PushMessageContentContactRegistered) MarshalJSON() ([]byte, error) { @@ -47235,6 +48824,8 @@ type PushMessageContentGift struct { meta // Number of Telegram Stars that sender paid for the gift StarCount int64 `json:"star_count"` + // True, if the message is about prepaid upgrade of the gift by another user instead of actual receiving of a new gift + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` } func (entity *PushMessageContentGift) MarshalJSON() ([]byte, error) { @@ -47260,8 +48851,10 @@ func (*PushMessageContentGift) PushMessageContentType() string { // A message with an upgraded gift type PushMessageContentUpgradedGift struct { meta - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, if is_prepaid_upgrade == false, then this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` + // True, if the message is about completion of prepaid upgrade of the gift instead of actual receiving of a new gift + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` } func (entity *PushMessageContentUpgradedGift) MarshalJSON() ([]byte, error) { @@ -47733,8 +49326,8 @@ func (*PushMessageContentChatSetBackground) PushMessageContentType() string { // A chat theme was edited type PushMessageContentChatSetTheme struct { meta - // If non-empty, name of a new theme, set for the chat. Otherwise, the chat theme was reset to the default one - ThemeName string `json:"theme_name"` + // If non-empty, human-readable name of the new theme. Otherwise, the chat theme was reset to the default one + Name string `json:"name"` } func (entity *PushMessageContentChatSetTheme) MarshalJSON() ([]byte, error) { @@ -51268,6 +52861,33 @@ func (*InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) InternalLinkTypeTy return TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings } +// The link is a link to a channel direct messages chat by username of the channel. Call searchPublicChat with the given chat username to process the link. If the chat is found and is channel, open the direct messages chat of the channel +type InternalLinkTypeDirectMessagesChat struct { + meta + // Username of the channel + ChannelUsername string `json:"channel_username"` +} + +func (entity *InternalLinkTypeDirectMessagesChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeDirectMessagesChat + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeDirectMessagesChat) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeDirectMessagesChat) GetType() string { + return TypeInternalLinkTypeDirectMessagesChat +} + +func (*InternalLinkTypeDirectMessagesChat) InternalLinkTypeType() string { + return TypeInternalLinkTypeDirectMessagesChat +} + // The link is a link to the edit profile section of the application settings type InternalLinkTypeEditProfileSettings struct{ meta @@ -51322,6 +52942,35 @@ func (*InternalLinkTypeGame) InternalLinkTypeType() string { return TypeInternalLinkTypeGame } +// The link is a link to a gift collection. Call searchPublicChat with the given username, then call getReceivedGifts with the received gift owner identifier and the given collection identifier, then show the collection if received +type InternalLinkTypeGiftCollection struct { + meta + // Username of the owner of the gift collection + GiftOwnerUsername string `json:"gift_owner_username"` + // Gift collection identifier + CollectionId int32 `json:"collection_id"` +} + +func (entity *InternalLinkTypeGiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeGiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeGiftCollection) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeGiftCollection) GetType() string { + return TypeInternalLinkTypeGiftCollection +} + +func (*InternalLinkTypeGiftCollection) InternalLinkTypeType() string { + return TypeInternalLinkTypeGiftCollection +} + // The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. Call joinGroupCall with the given invite_link to join the call type InternalLinkTypeGroupCall struct { meta @@ -52001,6 +53650,35 @@ func (*InternalLinkTypeStory) InternalLinkTypeType() string { return TypeInternalLinkTypeStory } +// The link is a link to an album of stories. Call searchPublicChat with the given username, then call getStoryAlbumStories with the received chat identifier and the given story album identifier, then show the story album if received +type InternalLinkTypeStoryAlbum struct { + meta + // Username of the owner of the story album + StoryAlbumOwnerUsername string `json:"story_album_owner_username"` + // Story album identifier + StoryAlbumId int32 `json:"story_album_id"` +} + +func (entity *InternalLinkTypeStoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeStoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeStoryAlbum) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeStoryAlbum) GetType() string { + return TypeInternalLinkTypeStoryAlbum +} + +func (*InternalLinkTypeStoryAlbum) InternalLinkTypeType() string { + return TypeInternalLinkTypeStoryAlbum +} + // The link is a link to a cloud theme. TDLib has no theme support yet type InternalLinkTypeTheme struct { meta @@ -53825,6 +55503,33 @@ func (*ConnectionStateReady) ConnectionStateType() string { return TypeConnectionStateReady } +// Describes parameters for age verification of the current user +type AgeVerificationParameters struct { + meta + // The minimum age required to view restricted content + MinAge int32 `json:"min_age"` + // Username of the bot which main Web App may be used to verify age of the user + VerificationBotUsername string `json:"verification_bot_username"` + // Unique name for the country or region, which legislation required age verification. May be used to get the corresponding localization key + Country string `json:"country"` +} + +func (entity *AgeVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AgeVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*AgeVerificationParameters) GetClass() string { + return ClassAgeVerificationParameters +} + +func (*AgeVerificationParameters) GetType() string { + return TypeAgeVerificationParameters +} + // A category containing frequently used private chats with non-bot users type TopChatCategoryUsers struct{ meta @@ -56155,7 +57860,7 @@ func (*ChatRevenueTransactions) GetType() string { return TypeChatRevenueTransactions } -// Contains information about Telegram Stars earned by a bot or a chat +// Contains information about Telegram Stars earned by a user or a chat type StarRevenueStatus struct { meta // Total amount of Telegram Stars earned @@ -56186,7 +57891,7 @@ func (*StarRevenueStatus) GetType() string { return TypeStarRevenueStatus } -// A detailed statistics about Telegram Stars earned by a bot or a chat +// A detailed statistics about Telegram Stars earned by a user or a chat type StarRevenueStatistics struct { meta // A graph containing amount of revenue in a given day @@ -56234,6 +57939,83 @@ func (starRevenueStatistics *StarRevenueStatistics) UnmarshalJSON(data []byte) e return nil } +// Contains information about Toncoins earned by the current user +type TonRevenueStatus struct { + meta + // Total amount of Toncoins earned; in the smallest units of the cryptocurrency + TotalAmount JsonInt64 `json:"total_amount"` + // Amount of Toncoins that aren't withdrawn yet; in the smallest units of the cryptocurrency + BalanceAmount JsonInt64 `json:"balance_amount"` + // Amount of Toncoins that are available for withdrawal; in the smallest units of the cryptocurrency + AvailableAmount JsonInt64 `json:"available_amount"` + // True, if Toncoins can be withdrawn + WithdrawalEnabled bool `json:"withdrawal_enabled"` +} + +func (entity *TonRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*TonRevenueStatus) GetClass() string { + return ClassTonRevenueStatus +} + +func (*TonRevenueStatus) GetType() string { + return TypeTonRevenueStatus +} + +// A detailed statistics about Toncoins earned by the current user +type TonRevenueStatistics struct { + meta + // A graph containing amount of revenue in a given day + RevenueByDayGraph StatisticalGraph `json:"revenue_by_day_graph"` + // Amount of earned revenue + Status *TonRevenueStatus `json:"status"` + // Current conversion rate of nanotoncoin to USD cents + UsdRate float64 `json:"usd_rate"` +} + +func (entity *TonRevenueStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonRevenueStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*TonRevenueStatistics) GetClass() string { + return ClassTonRevenueStatistics +} + +func (*TonRevenueStatistics) GetType() string { + return TypeTonRevenueStatistics +} + +func (tonRevenueStatistics *TonRevenueStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + RevenueByDayGraph json.RawMessage `json:"revenue_by_day_graph"` + Status *TonRevenueStatus `json:"status"` + UsdRate float64 `json:"usd_rate"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + tonRevenueStatistics.Status = tmp.Status + tonRevenueStatistics.UsdRate = tmp.UsdRate + + fieldRevenueByDayGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueByDayGraph) + tonRevenueStatistics.RevenueByDayGraph = fieldRevenueByDayGraph + + return nil +} + // A point on a Cartesian plane type Point struct { meta @@ -57867,8 +59649,8 @@ type UpdateChatTheme struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // The new name of the chat theme; may be empty if theme was reset to default - ThemeName string `json:"theme_name"` + // The new theme of the chat; may be null if theme was reset to default + Theme ChatTheme `json:"theme"` } func (entity *UpdateChatTheme) MarshalJSON() ([]byte, error) { @@ -57891,6 +59673,25 @@ func (*UpdateChatTheme) UpdateType() string { return TypeUpdateChatTheme } +func (updateChatTheme *UpdateChatTheme) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + Theme json.RawMessage `json:"theme"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateChatTheme.ChatId = tmp.ChatId + + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + updateChatTheme.Theme = fieldTheme + + return nil +} + // The chat unread_mention_count has changed type UpdateChatUnreadMentionCount struct { meta @@ -58348,7 +60149,7 @@ type UpdateTopicMessageCount struct { ChatId int64 `json:"chat_id"` // Identifier of the topic TopicId MessageTopic `json:"topic_id"` - // Approximate number of messages in the topics + // Approximate number of messages in the topic MessageCount int32 `json:"message_count"` } @@ -60343,31 +62144,31 @@ func (*UpdateDefaultBackground) UpdateType() string { return TypeUpdateDefaultBackground } -// The list of available chat themes has changed -type UpdateChatThemes struct { +// The list of available emoji chat themes has changed +type UpdateEmojiChatThemes struct { meta - // The new list of chat themes - ChatThemes []*ChatTheme `json:"chat_themes"` + // The new list of emoji chat themes + ChatThemes []*EmojiChatTheme `json:"chat_themes"` } -func (entity *UpdateChatThemes) MarshalJSON() ([]byte, error) { +func (entity *UpdateEmojiChatThemes) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateChatThemes + type stub UpdateEmojiChatThemes return json.Marshal((*stub)(entity)) } -func (*UpdateChatThemes) GetClass() string { +func (*UpdateEmojiChatThemes) GetClass() string { return ClassUpdate } -func (*UpdateChatThemes) GetType() string { - return TypeUpdateChatThemes +func (*UpdateEmojiChatThemes) GetType() string { + return TypeUpdateEmojiChatThemes } -func (*UpdateChatThemes) UpdateType() string { - return TypeUpdateChatThemes +func (*UpdateEmojiChatThemes) UpdateType() string { + return TypeUpdateEmojiChatThemes } // The list of supported accent colors has changed @@ -60535,6 +62336,33 @@ func (*UpdateFreezeState) UpdateType() string { return TypeUpdateFreezeState } +// The parameters for age verification of the current user's account has changed +type UpdateAgeVerificationParameters struct { + meta + // Parameters for the age verification; may be null if age verification isn't needed + Parameters *AgeVerificationParameters `json:"parameters"` +} + +func (entity *UpdateAgeVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAgeVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAgeVerificationParameters) GetClass() string { + return ClassUpdate +} + +func (*UpdateAgeVerificationParameters) GetType() string { + return TypeUpdateAgeVerificationParameters +} + +func (*UpdateAgeVerificationParameters) UpdateType() string { + return TypeUpdateAgeVerificationParameters +} + // New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" type UpdateTermsOfService struct { meta @@ -60926,7 +62754,7 @@ func (*UpdateChatRevenueAmount) UpdateType() string { return TypeUpdateChatRevenueAmount } -// The Telegram Star revenue earned by a bot or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions +// The Telegram Star revenue earned by a user or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions type UpdateStarRevenueStatus struct { meta // Identifier of the owner of the Telegram Stars @@ -60974,6 +62802,33 @@ func (updateStarRevenueStatus *UpdateStarRevenueStatus) UnmarshalJSON(data []byt return nil } +// The Toncoin revenue earned by the current user has changed. If Toncoin transaction screen of the chat is opened, then getTonTransactions may be called to fetch new transactions +type UpdateTonRevenueStatus struct { + meta + // New Toncoin revenue status + Status *TonRevenueStatus `json:"status"` +} + +func (entity *UpdateTonRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTonRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTonRevenueStatus) GetClass() string { + return ClassUpdate +} + +func (*UpdateTonRevenueStatus) GetType() string { + return TypeUpdateTonRevenueStatus +} + +func (*UpdateTonRevenueStatus) UpdateType() string { + return TypeUpdateTonRevenueStatus +} + // The parameters of speech recognition without Telegram Premium subscription has changed type UpdateSpeechRecognitionTrial struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 829ea95..0fbe52e 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -511,6 +511,58 @@ func UnmarshalListOfPollType(dataList []json.RawMessage) ([]PollType, error) { return list, nil } +func UnmarshalProfileTab(data json.RawMessage) (ProfileTab, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeProfileTabPosts: + return UnmarshalProfileTabPosts(data) + + case TypeProfileTabGifts: + return UnmarshalProfileTabGifts(data) + + case TypeProfileTabMedia: + return UnmarshalProfileTabMedia(data) + + case TypeProfileTabFiles: + return UnmarshalProfileTabFiles(data) + + case TypeProfileTabLinks: + return UnmarshalProfileTabLinks(data) + + case TypeProfileTabMusic: + return UnmarshalProfileTabMusic(data) + + case TypeProfileTabVoice: + return UnmarshalProfileTabVoice(data) + + case TypeProfileTabGifs: + return UnmarshalProfileTabGifs(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfProfileTab(dataList []json.RawMessage) ([]ProfileTab, error) { + list := []ProfileTab{} + + for _, data := range dataList { + entity, err := UnmarshalProfileTab(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUserType(data json.RawMessage) (UserType, error) { var meta meta @@ -662,6 +714,40 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } +func UnmarshalGiftResalePrice(data json.RawMessage) (GiftResalePrice, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftResalePriceStar: + return UnmarshalGiftResalePriceStar(data) + + case TypeGiftResalePriceTon: + return UnmarshalGiftResalePriceTon(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftResalePrice(dataList []json.RawMessage) ([]GiftResalePrice, error) { + list := []GiftResalePrice{} + + for _, data := range dataList { + entity, err := UnmarshalGiftResalePrice(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSuggestedPostPrice(data json.RawMessage) (SuggestedPostPrice, error) { var meta meta @@ -875,6 +961,40 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalCanSendGiftResult(data json.RawMessage) (CanSendGiftResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCanSendGiftResult(dataList []json.RawMessage) ([]CanSendGiftResult, error) { + list := []CanSendGiftResult{} + + for _, data := range dataList { + entity, err := UnmarshalCanSendGiftResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUpgradedGiftOrigin(data json.RawMessage) (UpgradedGiftOrigin, error) { var meta meta @@ -893,6 +1013,9 @@ func UnmarshalUpgradedGiftOrigin(data json.RawMessage) (UpgradedGiftOrigin, erro case TypeUpgradedGiftOriginResale: return UnmarshalUpgradedGiftOriginResale(data) + case TypeUpgradedGiftOriginPrepaidUpgrade: + return UnmarshalUpgradedGiftOriginPrepaidUpgrade(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -986,6 +1109,40 @@ func UnmarshalListOfGiftForResaleOrder(dataList []json.RawMessage) ([]GiftForRes return list, nil } +func UnmarshalGiftResaleResult(data json.RawMessage) (GiftResaleResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftResaleResult(dataList []json.RawMessage) ([]GiftResaleResult, error) { + list := []GiftResaleResult{} + + for _, data := range dataList { + entity, err := UnmarshalGiftResaleResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSentGift(data json.RawMessage) (SentGift, error) { var meta meta @@ -1132,6 +1289,9 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeGiftUpgradePurchase: + return UnmarshalStarTransactionTypeGiftUpgradePurchase(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) @@ -1168,6 +1328,9 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeBusinessBotTransferReceive: return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + case TypeStarTransactionTypePublicPostSearch: + return UnmarshalStarTransactionTypePublicPostSearch(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -1205,6 +1368,12 @@ func UnmarshalTonTransactionType(data json.RawMessage) (TonTransactionType, erro case TypeTonTransactionTypeSuggestedPostPayment: return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + case TypeTonTransactionTypeUpgradedGiftPurchase: + return UnmarshalTonTransactionTypeUpgradedGiftPurchase(data) + + case TypeTonTransactionTypeUpgradedGiftSale: + return UnmarshalTonTransactionTypeUpgradedGiftSale(data) + case TypeTonTransactionTypeUnsupported: return UnmarshalTonTransactionTypeUnsupported(data) @@ -2618,6 +2787,49 @@ func UnmarshalListOfSavedMessagesTopicType(dataList []json.RawMessage) ([]SavedM return list, nil } +func UnmarshalBuiltInTheme(data json.RawMessage) (BuiltInTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBuiltInThemeClassic: + return UnmarshalBuiltInThemeClassic(data) + + case TypeBuiltInThemeDay: + return UnmarshalBuiltInThemeDay(data) + + case TypeBuiltInThemeNight: + return UnmarshalBuiltInThemeNight(data) + + case TypeBuiltInThemeTinted: + return UnmarshalBuiltInThemeTinted(data) + + case TypeBuiltInThemeArctic: + return UnmarshalBuiltInThemeArctic(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBuiltInTheme(dataList []json.RawMessage) ([]BuiltInTheme, error) { + list := []BuiltInTheme{} + + for _, data := range dataList { + entity, err := UnmarshalBuiltInTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalRichText(data json.RawMessage) (RichText, error) { var meta meta @@ -2953,6 +3165,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeChat: return UnmarshalLinkPreviewTypeChat(data) + case TypeLinkPreviewTypeDirectMessagesChat: + return UnmarshalLinkPreviewTypeDirectMessagesChat(data) + case TypeLinkPreviewTypeDocument: return UnmarshalLinkPreviewTypeDocument(data) @@ -2971,6 +3186,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeExternalVideo: return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeGiftCollection: + return UnmarshalLinkPreviewTypeGiftCollection(data) + case TypeLinkPreviewTypeGroupCall: return UnmarshalLinkPreviewTypeGroupCall(data) @@ -2998,6 +3216,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeStory: return UnmarshalLinkPreviewTypeStory(data) + case TypeLinkPreviewTypeStoryAlbum: + return UnmarshalLinkPreviewTypeStoryAlbum(data) + case TypeLinkPreviewTypeSupergroupBoost: return UnmarshalLinkPreviewTypeSupergroupBoost(data) @@ -6506,6 +6727,74 @@ func UnmarshalListOfInputBackground(dataList []json.RawMessage) ([]InputBackgrou return list, nil } +func UnmarshalChatTheme(data json.RawMessage) (ChatTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatThemeEmoji: + return UnmarshalChatThemeEmoji(data) + + case TypeChatThemeGift: + return UnmarshalChatThemeGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatTheme(dataList []json.RawMessage) ([]ChatTheme, error) { + list := []ChatTheme{} + + for _, data := range dataList { + entity, err := UnmarshalChatTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputChatTheme(data json.RawMessage) (InputChatTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputChatThemeEmoji: + return UnmarshalInputChatThemeEmoji(data) + + case TypeInputChatThemeGift: + return UnmarshalInputChatThemeGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputChatTheme(dataList []json.RawMessage) ([]InputChatTheme, error) { + list := []InputChatTheme{} + + for _, data := range dataList { + entity, err := UnmarshalInputChatTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCanPostStoryResult(data json.RawMessage) (CanPostStoryResult, error) { var meta meta @@ -7554,12 +7843,18 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data) + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(data) + case TypeInternalLinkTypeEditProfileSettings: return UnmarshalInternalLinkTypeEditProfileSettings(data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(data) + case TypeInternalLinkTypeGroupCall: return UnmarshalInternalLinkTypeGroupCall(data) @@ -7629,6 +7924,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(data) @@ -8852,8 +9150,8 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateDefaultBackground: return UnmarshalUpdateDefaultBackground(data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(data) @@ -8870,6 +9168,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateFreezeState: return UnmarshalUpdateFreezeState(data) + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) @@ -8912,6 +9213,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateStarRevenueStatus: return UnmarshalUpdateStarRevenueStatus(data) + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) @@ -9719,6 +10023,14 @@ func UnmarshalAudio(data json.RawMessage) (*Audio, error) { return &resp, err } +func UnmarshalAudios(data json.RawMessage) (*Audios, error) { + var resp Audios + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDocument(data json.RawMessage) (*Document, error) { var resp Document @@ -9879,6 +10191,70 @@ func UnmarshalChatPhotoInfo(data json.RawMessage) (*ChatPhotoInfo, error) { return &resp, err } +func UnmarshalProfileTabPosts(data json.RawMessage) (*ProfileTabPosts, error) { + var resp ProfileTabPosts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabGifts(data json.RawMessage) (*ProfileTabGifts, error) { + var resp ProfileTabGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabMedia(data json.RawMessage) (*ProfileTabMedia, error) { + var resp ProfileTabMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabFiles(data json.RawMessage) (*ProfileTabFiles, error) { + var resp ProfileTabFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabLinks(data json.RawMessage) (*ProfileTabLinks, error) { + var resp ProfileTabLinks + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabMusic(data json.RawMessage) (*ProfileTabMusic, error) { + var resp ProfileTabMusic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabVoice(data json.RawMessage) (*ProfileTabVoice, error) { + var resp ProfileTabVoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabGifs(data json.RawMessage) (*ProfileTabGifs, error) { + var resp ProfileTabGifs + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserTypeRegular(data json.RawMessage) (*UserTypeRegular, error) { var resp UserTypeRegular @@ -10223,6 +10599,22 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalGiftResalePriceStar(data json.RawMessage) (*GiftResalePriceStar, error) { + var resp GiftResalePriceStar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResalePriceTon(data json.RawMessage) (*GiftResalePriceTon, error) { + var resp GiftResalePriceTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSuggestedPostPriceStar(data json.RawMessage) (*SuggestedPostPriceStar, error) { var resp SuggestedPostPriceStar @@ -10567,6 +10959,54 @@ func UnmarshalGiftSettings(data json.RawMessage) (*GiftSettings, error) { return &resp, err } +func UnmarshalGiftPurchaseLimits(data json.RawMessage) (*GiftPurchaseLimits, error) { + var resp GiftPurchaseLimits + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResaleParameters(data json.RawMessage) (*GiftResaleParameters, error) { + var resp GiftResaleParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftCollection(data json.RawMessage) (*GiftCollection, error) { + var resp GiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftCollections(data json.RawMessage) (*GiftCollections, error) { + var resp GiftCollections + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendGiftResultOk(data json.RawMessage) (*CanSendGiftResultOk, error) { + var resp CanSendGiftResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendGiftResultFail(data json.RawMessage) (*CanSendGiftResultFail, error) { + var resp CanSendGiftResultFail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftOriginUpgrade(data json.RawMessage) (*UpgradedGiftOriginUpgrade, error) { var resp UpgradedGiftOriginUpgrade @@ -10591,6 +11031,14 @@ func UnmarshalUpgradedGiftOriginResale(data json.RawMessage) (*UpgradedGiftOrigi return &resp, err } +func UnmarshalUpgradedGiftOriginPrepaidUpgrade(data json.RawMessage) (*UpgradedGiftOriginPrepaidUpgrade, error) { + var resp UpgradedGiftOriginPrepaidUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { var resp UpgradedGiftModel @@ -10647,6 +11095,14 @@ func UnmarshalUpgradedGift(data json.RawMessage) (*UpgradedGift, error) { return &resp, err } +func UnmarshalUpgradedGiftValueInfo(data json.RawMessage) (*UpgradedGiftValueInfo, error) { + var resp UpgradedGiftValueInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradeGiftResult(data json.RawMessage) (*UpgradeGiftResult, error) { var resp UpgradeGiftResult @@ -10759,6 +11215,22 @@ func UnmarshalGiftsForResale(data json.RawMessage) (*GiftsForResale, error) { return &resp, err } +func UnmarshalGiftResaleResultOk(data json.RawMessage) (*GiftResaleResultOk, error) { + var resp GiftResaleResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResaleResultPriceIncreased(data json.RawMessage) (*GiftResaleResultPriceIncreased, error) { + var resp GiftResaleResultPriceIncreased + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSentGiftRegular(data json.RawMessage) (*SentGiftRegular, error) { var resp SentGiftRegular @@ -10999,6 +11471,14 @@ func UnmarshalStarTransactionTypeGiftUpgrade(data json.RawMessage) (*StarTransac return &resp, err } +func UnmarshalStarTransactionTypeGiftUpgradePurchase(data json.RawMessage) (*StarTransactionTypeGiftUpgradePurchase, error) { + var resp StarTransactionTypeGiftUpgradePurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*StarTransactionTypeUpgradedGiftPurchase, error) { var resp StarTransactionTypeUpgradedGiftPurchase @@ -11095,6 +11575,14 @@ func UnmarshalStarTransactionTypeBusinessBotTransferReceive(data json.RawMessage return &resp, err } +func UnmarshalStarTransactionTypePublicPostSearch(data json.RawMessage) (*StarTransactionTypePublicPostSearch, error) { + var resp StarTransactionTypePublicPostSearch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { var resp StarTransactionTypeUnsupported @@ -11135,6 +11623,22 @@ func UnmarshalTonTransactionTypeSuggestedPostPayment(data json.RawMessage) (*Ton return &resp, err } +func UnmarshalTonTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*TonTransactionTypeUpgradedGiftPurchase, error) { + var resp TonTransactionTypeUpgradedGiftPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeUpgradedGiftSale(data json.RawMessage) (*TonTransactionTypeUpgradedGiftSale, error) { + var resp TonTransactionTypeUpgradedGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTonTransactionTypeUnsupported(data json.RawMessage) (*TonTransactionTypeUnsupported, error) { var resp TonTransactionTypeUnsupported @@ -11255,6 +11759,22 @@ func UnmarshalProfileAccentColor(data json.RawMessage) (*ProfileAccentColor, err return &resp, err } +func UnmarshalUserRating(data json.RawMessage) (*UserRating, error) { + var resp UserRating + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRestrictionInfo(data json.RawMessage) (*RestrictionInfo, error) { + var resp RestrictionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiStatusTypeCustomEmoji(data json.RawMessage) (*EmojiStatusTypeCustomEmoji, error) { var resp EmojiStatusTypeCustomEmoji @@ -11719,6 +12239,14 @@ func UnmarshalSecretChat(data json.RawMessage) (*SecretChat, error) { return &resp, err } +func UnmarshalPublicPostSearchLimits(data json.RawMessage) (*PublicPostSearchLimits, error) { + var resp PublicPostSearchLimits + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSenderUser(data json.RawMessage) (*MessageSenderUser, error) { var resp MessageSenderUser @@ -12127,6 +12655,14 @@ func UnmarshalFoundChatMessages(data json.RawMessage) (*FoundChatMessages, error return &resp, err } +func UnmarshalFoundPublicPosts(data json.RawMessage) (*FoundPublicPosts, error) { + var resp FoundPublicPosts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessagePosition(data json.RawMessage) (*MessagePosition, error) { var resp MessagePosition @@ -13167,6 +13703,46 @@ func UnmarshalSharedChat(data json.RawMessage) (*SharedChat, error) { return &resp, err } +func UnmarshalBuiltInThemeClassic(data json.RawMessage) (*BuiltInThemeClassic, error) { + var resp BuiltInThemeClassic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeDay(data json.RawMessage) (*BuiltInThemeDay, error) { + var resp BuiltInThemeDay + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeNight(data json.RawMessage) (*BuiltInThemeNight, error) { + var resp BuiltInThemeNight + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeTinted(data json.RawMessage) (*BuiltInThemeTinted, error) { + var resp BuiltInThemeTinted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeArctic(data json.RawMessage) (*BuiltInThemeArctic, error) { + var resp BuiltInThemeArctic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalThemeSettings(data json.RawMessage) (*ThemeSettings, error) { var resp ThemeSettings @@ -13711,6 +14287,14 @@ func UnmarshalLinkPreviewTypeChat(data json.RawMessage) (*LinkPreviewTypeChat, e return &resp, err } +func UnmarshalLinkPreviewTypeDirectMessagesChat(data json.RawMessage) (*LinkPreviewTypeDirectMessagesChat, error) { + var resp LinkPreviewTypeDirectMessagesChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeDocument(data json.RawMessage) (*LinkPreviewTypeDocument, error) { var resp LinkPreviewTypeDocument @@ -13759,6 +14343,14 @@ func UnmarshalLinkPreviewTypeExternalVideo(data json.RawMessage) (*LinkPreviewTy return &resp, err } +func UnmarshalLinkPreviewTypeGiftCollection(data json.RawMessage) (*LinkPreviewTypeGiftCollection, error) { + var resp LinkPreviewTypeGiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeGroupCall(data json.RawMessage) (*LinkPreviewTypeGroupCall, error) { var resp LinkPreviewTypeGroupCall @@ -13831,6 +14423,14 @@ func UnmarshalLinkPreviewTypeStory(data json.RawMessage) (*LinkPreviewTypeStory, return &resp, err } +func UnmarshalLinkPreviewTypeStoryAlbum(data json.RawMessage) (*LinkPreviewTypeStoryAlbum, error) { + var resp LinkPreviewTypeStoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeSupergroupBoost(data json.RawMessage) (*LinkPreviewTypeSupergroupBoost, error) { var resp LinkPreviewTypeSupergroupBoost @@ -16703,6 +17303,22 @@ func UnmarshalFoundStories(data json.RawMessage) (*FoundStories, error) { return &resp, err } +func UnmarshalStoryAlbum(data json.RawMessage) (*StoryAlbum, error) { + var resp StoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAlbums(data json.RawMessage) (*StoryAlbums, error) { + var resp StoryAlbums + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryFullId(data json.RawMessage) (*StoryFullId, error) { var resp StoryFullId @@ -19287,8 +19903,56 @@ func UnmarshalInputBackgroundPrevious(data json.RawMessage) (*InputBackgroundPre return &resp, err } -func UnmarshalChatTheme(data json.RawMessage) (*ChatTheme, error) { - var resp ChatTheme +func UnmarshalEmojiChatTheme(data json.RawMessage) (*EmojiChatTheme, error) { + var resp EmojiChatTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftChatTheme(data json.RawMessage) (*GiftChatTheme, error) { + var resp GiftChatTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftChatThemes(data json.RawMessage) (*GiftChatThemes, error) { + var resp GiftChatThemes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatThemeEmoji(data json.RawMessage) (*ChatThemeEmoji, error) { + var resp ChatThemeEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatThemeGift(data json.RawMessage) (*ChatThemeGift, error) { + var resp ChatThemeGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatThemeEmoji(data json.RawMessage) (*InputChatThemeEmoji, error) { + var resp InputChatThemeEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatThemeGift(data json.RawMessage) (*InputChatThemeGift, error) { + var resp InputChatThemeGift err := json.Unmarshal(data, &resp) @@ -20791,6 +21455,14 @@ func UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data json.Ra return &resp, err } +func UnmarshalInternalLinkTypeDirectMessagesChat(data json.RawMessage) (*InternalLinkTypeDirectMessagesChat, error) { + var resp InternalLinkTypeDirectMessagesChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeEditProfileSettings(data json.RawMessage) (*InternalLinkTypeEditProfileSettings, error) { var resp InternalLinkTypeEditProfileSettings @@ -20807,6 +21479,14 @@ func UnmarshalInternalLinkTypeGame(data json.RawMessage) (*InternalLinkTypeGame, return &resp, err } +func UnmarshalInternalLinkTypeGiftCollection(data json.RawMessage) (*InternalLinkTypeGiftCollection, error) { + var resp InternalLinkTypeGiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeGroupCall(data json.RawMessage) (*InternalLinkTypeGroupCall, error) { var resp InternalLinkTypeGroupCall @@ -20991,6 +21671,14 @@ func UnmarshalInternalLinkTypeStory(data json.RawMessage) (*InternalLinkTypeStor return &resp, err } +func UnmarshalInternalLinkTypeStoryAlbum(data json.RawMessage) (*InternalLinkTypeStoryAlbum, error) { + var resp InternalLinkTypeStoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeTheme(data json.RawMessage) (*InternalLinkTypeTheme, error) { var resp InternalLinkTypeTheme @@ -21511,6 +22199,14 @@ func UnmarshalConnectionStateReady(data json.RawMessage) (*ConnectionStateReady, return &resp, err } +func UnmarshalAgeVerificationParameters(data json.RawMessage) (*AgeVerificationParameters, error) { + var resp AgeVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTopChatCategoryUsers(data json.RawMessage) (*TopChatCategoryUsers, error) { var resp TopChatCategoryUsers @@ -22111,6 +22807,22 @@ func UnmarshalStarRevenueStatistics(data json.RawMessage) (*StarRevenueStatistic return &resp, err } +func UnmarshalTonRevenueStatus(data json.RawMessage) (*TonRevenueStatus, error) { + var resp TonRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonRevenueStatistics(data json.RawMessage) (*TonRevenueStatistics, error) { + var resp TonRevenueStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPoint(data json.RawMessage) (*Point, error) { var resp Point @@ -23111,8 +23823,8 @@ func UnmarshalUpdateDefaultBackground(data json.RawMessage) (*UpdateDefaultBackg return &resp, err } -func UnmarshalUpdateChatThemes(data json.RawMessage) (*UpdateChatThemes, error) { - var resp UpdateChatThemes +func UnmarshalUpdateEmojiChatThemes(data json.RawMessage) (*UpdateEmojiChatThemes, error) { + var resp UpdateEmojiChatThemes err := json.Unmarshal(data, &resp) @@ -23159,6 +23871,14 @@ func UnmarshalUpdateFreezeState(data json.RawMessage) (*UpdateFreezeState, error return &resp, err } +func UnmarshalUpdateAgeVerificationParameters(data json.RawMessage) (*UpdateAgeVerificationParameters, error) { + var resp UpdateAgeVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, error) { var resp UpdateTermsOfService @@ -23271,6 +23991,14 @@ func UnmarshalUpdateStarRevenueStatus(data json.RawMessage) (*UpdateStarRevenueS return &resp, err } +func UnmarshalUpdateTonRevenueStatus(data json.RawMessage) (*UpdateTonRevenueStatus, error) { + var resp UpdateTonRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateSpeechRecognitionTrial(data json.RawMessage) (*UpdateSpeechRecognitionTrial, error) { var resp UpdateSpeechRecognitionTrial @@ -23873,6 +24601,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAudio: return UnmarshalAudio(data) + case TypeAudios: + return UnmarshalAudios(data) + case TypeDocument: return UnmarshalDocument(data) @@ -23933,6 +24664,30 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatPhotoInfo: return UnmarshalChatPhotoInfo(data) + case TypeProfileTabPosts: + return UnmarshalProfileTabPosts(data) + + case TypeProfileTabGifts: + return UnmarshalProfileTabGifts(data) + + case TypeProfileTabMedia: + return UnmarshalProfileTabMedia(data) + + case TypeProfileTabFiles: + return UnmarshalProfileTabFiles(data) + + case TypeProfileTabLinks: + return UnmarshalProfileTabLinks(data) + + case TypeProfileTabMusic: + return UnmarshalProfileTabMusic(data) + + case TypeProfileTabVoice: + return UnmarshalProfileTabVoice(data) + + case TypeProfileTabGifs: + return UnmarshalProfileTabGifs(data) + case TypeUserTypeRegular: return UnmarshalUserTypeRegular(data) @@ -24062,6 +24817,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeGiftResalePriceStar: + return UnmarshalGiftResalePriceStar(data) + + case TypeGiftResalePriceTon: + return UnmarshalGiftResalePriceTon(data) + case TypeSuggestedPostPriceStar: return UnmarshalSuggestedPostPriceStar(data) @@ -24191,6 +24952,24 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftSettings: return UnmarshalGiftSettings(data) + case TypeGiftPurchaseLimits: + return UnmarshalGiftPurchaseLimits(data) + + case TypeGiftResaleParameters: + return UnmarshalGiftResaleParameters(data) + + case TypeGiftCollection: + return UnmarshalGiftCollection(data) + + case TypeGiftCollections: + return UnmarshalGiftCollections(data) + + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(data) + case TypeUpgradedGiftOriginUpgrade: return UnmarshalUpgradedGiftOriginUpgrade(data) @@ -24200,6 +24979,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpgradedGiftOriginResale: return UnmarshalUpgradedGiftOriginResale(data) + case TypeUpgradedGiftOriginPrepaidUpgrade: + return UnmarshalUpgradedGiftOriginPrepaidUpgrade(data) + case TypeUpgradedGiftModel: return UnmarshalUpgradedGiftModel(data) @@ -24221,6 +25003,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpgradedGift: return UnmarshalUpgradedGift(data) + case TypeUpgradedGiftValueInfo: + return UnmarshalUpgradedGiftValueInfo(data) + case TypeUpgradeGiftResult: return UnmarshalUpgradeGiftResult(data) @@ -24263,6 +25048,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftsForResale: return UnmarshalGiftsForResale(data) + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(data) + case TypeSentGiftRegular: return UnmarshalSentGiftRegular(data) @@ -24353,6 +25144,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeGiftUpgradePurchase: + return UnmarshalStarTransactionTypeGiftUpgradePurchase(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) @@ -24389,6 +25183,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeBusinessBotTransferReceive: return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + case TypeStarTransactionTypePublicPostSearch: + return UnmarshalStarTransactionTypePublicPostSearch(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -24404,6 +25201,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTonTransactionTypeSuggestedPostPayment: return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + case TypeTonTransactionTypeUpgradedGiftPurchase: + return UnmarshalTonTransactionTypeUpgradedGiftPurchase(data) + + case TypeTonTransactionTypeUpgradedGiftSale: + return UnmarshalTonTransactionTypeUpgradedGiftSale(data) + case TypeTonTransactionTypeUnsupported: return UnmarshalTonTransactionTypeUnsupported(data) @@ -24449,6 +25252,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeProfileAccentColor: return UnmarshalProfileAccentColor(data) + case TypeUserRating: + return UnmarshalUserRating(data) + + case TypeRestrictionInfo: + return UnmarshalRestrictionInfo(data) + case TypeEmojiStatusTypeCustomEmoji: return UnmarshalEmojiStatusTypeCustomEmoji(data) @@ -24623,6 +25432,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSecretChat: return UnmarshalSecretChat(data) + case TypePublicPostSearchLimits: + return UnmarshalPublicPostSearchLimits(data) + case TypeMessageSenderUser: return UnmarshalMessageSenderUser(data) @@ -24776,6 +25588,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFoundChatMessages: return UnmarshalFoundChatMessages(data) + case TypeFoundPublicPosts: + return UnmarshalFoundPublicPosts(data) + case TypeMessagePosition: return UnmarshalMessagePosition(data) @@ -25166,6 +25981,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSharedChat: return UnmarshalSharedChat(data) + case TypeBuiltInThemeClassic: + return UnmarshalBuiltInThemeClassic(data) + + case TypeBuiltInThemeDay: + return UnmarshalBuiltInThemeDay(data) + + case TypeBuiltInThemeNight: + return UnmarshalBuiltInThemeNight(data) + + case TypeBuiltInThemeTinted: + return UnmarshalBuiltInThemeTinted(data) + + case TypeBuiltInThemeArctic: + return UnmarshalBuiltInThemeArctic(data) + case TypeThemeSettings: return UnmarshalThemeSettings(data) @@ -25370,6 +26200,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeChat: return UnmarshalLinkPreviewTypeChat(data) + case TypeLinkPreviewTypeDirectMessagesChat: + return UnmarshalLinkPreviewTypeDirectMessagesChat(data) + case TypeLinkPreviewTypeDocument: return UnmarshalLinkPreviewTypeDocument(data) @@ -25388,6 +26221,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeExternalVideo: return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeGiftCollection: + return UnmarshalLinkPreviewTypeGiftCollection(data) + case TypeLinkPreviewTypeGroupCall: return UnmarshalLinkPreviewTypeGroupCall(data) @@ -25415,6 +26251,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeStory: return UnmarshalLinkPreviewTypeStory(data) + case TypeLinkPreviewTypeStoryAlbum: + return UnmarshalLinkPreviewTypeStoryAlbum(data) + case TypeLinkPreviewTypeSupergroupBoost: return UnmarshalLinkPreviewTypeSupergroupBoost(data) @@ -26492,6 +27331,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFoundStories: return UnmarshalFoundStories(data) + case TypeStoryAlbum: + return UnmarshalStoryAlbum(data) + + case TypeStoryAlbums: + return UnmarshalStoryAlbums(data) + case TypeStoryFullId: return UnmarshalStoryFullId(data) @@ -27461,8 +28306,26 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputBackgroundPrevious: return UnmarshalInputBackgroundPrevious(data) - case TypeChatTheme: - return UnmarshalChatTheme(data) + case TypeEmojiChatTheme: + return UnmarshalEmojiChatTheme(data) + + case TypeGiftChatTheme: + return UnmarshalGiftChatTheme(data) + + case TypeGiftChatThemes: + return UnmarshalGiftChatThemes(data) + + case TypeChatThemeEmoji: + return UnmarshalChatThemeEmoji(data) + + case TypeChatThemeGift: + return UnmarshalChatThemeGift(data) + + case TypeInputChatThemeEmoji: + return UnmarshalInputChatThemeEmoji(data) + + case TypeInputChatThemeGift: + return UnmarshalInputChatThemeGift(data) case TypeTimeZone: return UnmarshalTimeZone(data) @@ -28025,12 +28888,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data) + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(data) + case TypeInternalLinkTypeEditProfileSettings: return UnmarshalInternalLinkTypeEditProfileSettings(data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(data) + case TypeInternalLinkTypeGroupCall: return UnmarshalInternalLinkTypeGroupCall(data) @@ -28100,6 +28969,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(data) @@ -28295,6 +29167,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeConnectionStateReady: return UnmarshalConnectionStateReady(data) + case TypeAgeVerificationParameters: + return UnmarshalAgeVerificationParameters(data) + case TypeTopChatCategoryUsers: return UnmarshalTopChatCategoryUsers(data) @@ -28520,6 +29395,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarRevenueStatistics: return UnmarshalStarRevenueStatistics(data) + case TypeTonRevenueStatus: + return UnmarshalTonRevenueStatus(data) + + case TypeTonRevenueStatistics: + return UnmarshalTonRevenueStatistics(data) + case TypePoint: return UnmarshalPoint(data) @@ -28895,8 +29776,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateDefaultBackground: return UnmarshalUpdateDefaultBackground(data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(data) @@ -28913,6 +29794,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateFreezeState: return UnmarshalUpdateFreezeState(data) + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) @@ -28955,6 +29839,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateStarRevenueStatus: return UnmarshalUpdateStarRevenueStatus(data) + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) diff --git a/data/td_api.tl b/data/td_api.tl index 60c5f4f..aec4e7c 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -131,7 +131,9 @@ authorizationStateWaitPhoneNumber = AuthorizationState; //@description The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction //@store_product_id Identifier of the store product that must be bought -authorizationStateWaitPremiumPurchase store_product_id:string = AuthorizationState; +//@support_email_address Email address to use for support if the user has issues with Telegram Premium purchase +//@support_email_subject Subject for the email sent to the support email address +authorizationStateWaitPremiumPurchase store_product_id:string support_email_address:string support_email_subject:string = AuthorizationState; //@description TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed //@allow_apple_id True, if authorization through Apple ID is allowed @@ -441,6 +443,9 @@ animation duration:int32 width:int32 height:int32 file_name:string mime_type:str //@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; +//@description Contains a list of audio files @total_count Approximate total number of audio files found @audios List of audio files +audios total_count:int32 audios:vector