From c695d13f46308de873f66d27c90db5a26aae4dcf Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 13 Apr 2025 20:30:45 +0800 Subject: [PATCH 01/17] 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 02/17] 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 03/17] 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 04/17] 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 05/17] 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 06/17] 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 07/17] 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 08/17] 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 09/17] 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 10/17] 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 11/17] 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 12/17] 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 13/17] 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