From 8de0893227be3fe8ea3d3582e1e5cc9fe34954bf Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 7 Mar 2025 22:22:55 +0800 Subject: [PATCH] Update to TDLib 1.8.46 --- client/function.go | 177 +++++++++++-- client/type.go | 581 +++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 214 +++++++++++++++- data/td_api.tl | 212 +++++++++++---- 4 files changed, 1076 insertions(+), 108 deletions(-) diff --git a/client/function.go b/client/function.go index 46a1a11..51e31dc 100755 --- a/client/function.go +++ b/client/function.go @@ -4085,7 +4085,7 @@ type SendQuickReplyShortcutMessagesRequest struct { SendingId int32 `json:"sending_id"` } -// Sends messages from a quick reply shortcut. Requires Telegram Business subscription +// Sends messages from a quick reply shortcut. Requires Telegram Business subscription. Can't be used to send paid messages func (client *Client) SendQuickReplyShortcutMessages(req *SendQuickReplyShortcutMessagesRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -4115,6 +4115,8 @@ type ResendMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false Quote *InputTextQuote `json:"quote"` + // The number of Telegram Stars the user agreed to pay to send the messages. Ignored if messageSendingStateFailed.required_paid_message_star_count == 0 + PaidMessageStarCount int64 `json:"paid_message_star_count"` } // Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message @@ -4127,6 +4129,7 @@ func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, err "chat_id": req.ChatId, "message_ids": req.MessageIds, "quote": req.Quote, + "paid_message_star_count": req.PaidMessageStarCount, }, }) if err != nil { @@ -13249,7 +13252,7 @@ type CreateCallRequest struct { Protocol *CallProtocol `json:"protocol"` // Pass true to create a video call IsVideo bool `json:"is_video"` - // Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored + // Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none GroupCallId int32 `json:"group_call_id"` } @@ -13730,6 +13733,8 @@ type JoinGroupCallRequest struct { IsMyVideoEnabled bool `json:"is_my_video_enabled"` // If non-empty, invite hash to be used to join the group call without being muted by administrators InviteHash string `json:"invite_hash"` + // Fingerprint of the encryption key for E2E group calls not bound to a chat; pass 0 for voice chats + KeyFingerprint JsonInt64 `json:"key_fingerprint"` } // Joins an active group call. Returns join response payload for tgcalls @@ -13746,6 +13751,7 @@ func (client *Client) JoinGroupCall(req *JoinGroupCallRequest) (*Text, error) { "is_muted": req.IsMuted, "is_my_video_enabled": req.IsMyVideoEnabled, "invite_hash": req.InviteHash, + "key_fingerprint": req.KeyFingerprint, }, }) if err != nil { @@ -14750,7 +14756,7 @@ type SuggestUserProfilePhotoRequest struct { Photo InputChatPhoto `json:"photo"` } -// Suggests a profile photo to another regular user with common messages +// Suggests a profile photo to another regular user with common messages and allowing non-paid messages func (client *Client) SuggestUserProfilePhoto(req *SuggestUserProfilePhotoRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -16072,11 +16078,11 @@ func (client *Client) GetLinkPreview(req *GetLinkPreviewRequest) (*LinkPreview, type GetWebPageInstantViewRequest struct { // The web page URL Url string `json:"url"` - // Pass true to get full instant view for the web page - ForceFull bool `json:"force_full"` + // Pass true to get only locally available information without sending network requests + OnlyLocal bool `json:"only_local"` } -// Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page +// Returns an instant view version of a web page if available. This is an offline request if only_local is true. Returns a 404 error if the web page has no instant view page func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) (*WebPageInstantView, error) { result, err := client.Send(Request{ meta: meta{ @@ -16084,7 +16090,7 @@ func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) ( }, Data: map[string]interface{}{ "url": req.Url, - "force_full": req.ForceFull, + "only_local": req.OnlyLocal, }, }) if err != nil { @@ -18908,7 +18914,7 @@ type SendGiftRequest struct { GiftId JsonInt64 `json:"gift_id"` // Identifier of the user or the channel chat that will receive the gift OwnerId MessageSender `json:"owner_id"` - // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. Must be empty if the receiver enabled paid messages Text *FormattedText `json:"text"` // Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` @@ -18974,7 +18980,7 @@ type ToggleGiftIsSavedRequest struct { IsSaved bool `json:"is_saved"` } -// Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the chat +// Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -18996,6 +19002,35 @@ func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, err return UnmarshalOk(result.Data) } +type SetPinnedGiftsRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` + // New list of pinned gifts. All gifts must be upgraded and saved on the profile page first. There can be up to getOption("pinned_gift_count_max") pinned gifts + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Changes the list of pinned gifts on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat +func (client *Client) SetPinnedGifts(req *SetPinnedGiftsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPinnedGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleChatGiftNotificationsRequest struct { // Identifier of the channel chat ChatId int64 `json:"chat_id"` @@ -20007,6 +20042,90 @@ func (client *Client) GetNewChatPrivacySettings() (*NewChatPrivacySettings, erro return UnmarshalNewChatPrivacySettings(result.Data) } +type GetPaidMessageRevenueRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` +} + +// Returns the total number of Telegram Stars received by the current user for paid messages from the given user +func (client *Client) GetPaidMessageRevenue(req *GetPaidMessageRevenueRequest) (*StarCount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPaidMessageRevenue", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarCount(result.Data) +} + +type AllowUnpaidMessagesFromUserRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // Pass true to refund the user previously paid messages + RefundPayments bool `json:"refund_payments"` +} + +// Allows the specified user to send unpaid private messages to the current user by adding a rule to userPrivacySettingAllowUnpaidMessages +func (client *Client) AllowUnpaidMessagesFromUser(req *AllowUnpaidMessagesFromUserRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "allowUnpaidMessagesFromUser", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "refund_payments": req.RefundPayments, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatPaidMessageStarCountRequest struct { + // Identifier of the supergroup chat + ChatId int64 `json:"chat_id"` + // The new number of Telegram Stars that must be paid for each message that is sent to the supergroup chat unless the sender is an administrator of the chat; 0-getOption("paid_message_star_count_max"). The supergroup will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Changes the amount of Telegram Stars that must be paid to send a message to a supergroup chat; requires can_restrict_members administrator right and supergroupFullInfo.can_enable_paid_messages +func (client *Client) SetChatPaidMessageStarCount(req *SetChatPaidMessageStarCountRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatPaidMessageStarCount", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CanSendMessageToUserRequest struct { // Identifier of the other user UserId int64 `json:"user_id"` @@ -20037,6 +20156,9 @@ func (client *Client) CanSendMessageToUser(req *CanSendMessageToUserRequest) (Ca case TypeCanSendMessageToUserResultOk: return UnmarshalCanSendMessageToUserResultOk(result.Data) + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(result.Data) + case TypeCanSendMessageToUserResultUserIsDeleted: return UnmarshalCanSendMessageToUserResultUserIsDeleted(result.Data) @@ -20476,7 +20598,7 @@ func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactions } type GetStarRevenueStatisticsRequest struct { - // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true + // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` // Pass true if a dark theme is used by the application IsDark bool `json:"is_dark"` @@ -20505,7 +20627,7 @@ func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequ } type GetStarWithdrawalUrlRequest struct { - // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat + // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat OwnerId MessageSender `json:"owner_id"` // The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") StarCount int64 `json:"star_count"` @@ -22236,16 +22358,35 @@ func (client *Client) GetPremiumState() (*PremiumState, error) { return UnmarshalPremiumState(result.Data) } -type GetPremiumGiftCodePaymentOptionsRequest struct { - // Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none +// Returns available options for gifting Telegram Premium to a user +func (client *Client) GetPremiumGiftPaymentOptions() (*PremiumGiftPaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumGiftPaymentOptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPremiumGiftPaymentOptions(result.Data) +} + +type GetPremiumGiveawayPaymentOptionsRequest struct { + // Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` } -// Returns available options for Telegram Premium gift code or Telegram Premium giveaway creation -func (client *Client) GetPremiumGiftCodePaymentOptions(req *GetPremiumGiftCodePaymentOptionsRequest) (*PremiumGiftCodePaymentOptions, error) { +// Returns available options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +func (client *Client) GetPremiumGiveawayPaymentOptions(req *GetPremiumGiveawayPaymentOptionsRequest) (*PremiumGiveawayPaymentOptions, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getPremiumGiftCodePaymentOptions", + Type: "getPremiumGiveawayPaymentOptions", }, Data: map[string]interface{}{ "boosted_chat_id": req.BoostedChatId, @@ -22259,7 +22400,7 @@ func (client *Client) GetPremiumGiftCodePaymentOptions(req *GetPremiumGiftCodePa return nil, buildResponseError(result.Data) } - return UnmarshalPremiumGiftCodePaymentOptions(result.Data) + return UnmarshalPremiumGiveawayPaymentOptions(result.Data) } type CheckPremiumGiftCodeRequest struct { @@ -22452,7 +22593,7 @@ func (client *Client) GetStarGiveawayPaymentOptions() (*StarGiveawayPaymentOptio } type GetStarTransactionsRequest struct { - // Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true + // Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` // If non-empty, only transactions related to the Star Subscription will be returned SubscriptionId string `json:"subscription_id"` diff --git a/client/type.go b/client/type.go index 8743a91..c4f4597 100755 --- a/client/type.go +++ b/client/type.go @@ -257,8 +257,10 @@ const ( ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" - ClassPremiumGiftCodePaymentOption = "PremiumGiftCodePaymentOption" - ClassPremiumGiftCodePaymentOptions = "PremiumGiftCodePaymentOptions" + ClassPremiumGiftPaymentOption = "PremiumGiftPaymentOption" + ClassPremiumGiftPaymentOptions = "PremiumGiftPaymentOptions" + ClassPremiumGiveawayPaymentOption = "PremiumGiveawayPaymentOption" + ClassPremiumGiveawayPaymentOptions = "PremiumGiveawayPaymentOptions" ClassPremiumGiftCodeInfo = "PremiumGiftCodeInfo" ClassStarPaymentOption = "StarPaymentOption" ClassStarPaymentOptions = "StarPaymentOptions" @@ -371,6 +373,7 @@ const ( ClassFailedToAddMember = "FailedToAddMember" ClassFailedToAddMembers = "FailedToAddMembers" ClassCreatedBasicGroupChat = "CreatedBasicGroupChat" + ClassAccountInfo = "AccountInfo" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" ClassThemeParameters = "ThemeParameters" @@ -568,6 +571,7 @@ const ( ClassText = "Text" ClassSeconds = "Seconds" ClassFileDownloadedPrefixSize = "FileDownloadedPrefixSize" + ClassStarCount = "StarCount" ClassDeepLinkInfo = "DeepLinkInfo" ClassProxy = "Proxy" ClassProxies = "Proxies" @@ -762,8 +766,10 @@ const ( TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" - TypePremiumGiftCodePaymentOption = "premiumGiftCodePaymentOption" - TypePremiumGiftCodePaymentOptions = "premiumGiftCodePaymentOptions" + TypePremiumGiftPaymentOption = "premiumGiftPaymentOption" + TypePremiumGiftPaymentOptions = "premiumGiftPaymentOptions" + TypePremiumGiveawayPaymentOption = "premiumGiveawayPaymentOption" + TypePremiumGiveawayPaymentOptions = "premiumGiveawayPaymentOptions" TypePremiumGiftCodeInfo = "premiumGiftCodeInfo" TypeStarPaymentOption = "starPaymentOption" TypeStarPaymentOptions = "starPaymentOptions" @@ -812,6 +818,9 @@ const ( TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" + TypeStarTransactionTypePaidMessageSend = "starTransactionTypePaidMessageSend" + TypeStarTransactionTypePaidMessageReceive = "starTransactionTypePaidMessageReceive" + TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" @@ -1005,6 +1014,7 @@ const ( TypeCreatedBasicGroupChat = "createdBasicGroupChat" TypePublicChatTypeHasUsername = "publicChatTypeHasUsername" TypePublicChatTypeIsLocationBased = "publicChatTypeIsLocationBased" + TypeAccountInfo = "accountInfo" TypeChatActionBarReportSpam = "chatActionBarReportSpam" TypeChatActionBarInviteMembers = "chatActionBarInviteMembers" TypeChatActionBarReportAddBlock = "chatActionBarReportAddBlock" @@ -1755,11 +1765,13 @@ const ( TypeBusinessFeaturePromotionAnimation = "businessFeaturePromotionAnimation" TypePremiumState = "premiumState" TypeStorePaymentPurposePremiumSubscription = "storePaymentPurposePremiumSubscription" + TypeStorePaymentPurposePremiumGift = "storePaymentPurposePremiumGift" TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" TypeStorePaymentPurposeStarGiveaway = "storePaymentPurposeStarGiveaway" TypeStorePaymentPurposeStars = "storePaymentPurposeStars" TypeStorePaymentPurposeGiftedStars = "storePaymentPurposeGiftedStars" + TypeTelegramPaymentPurposePremiumGift = "telegramPaymentPurposePremiumGift" TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" TypeTelegramPaymentPurposeStars = "telegramPaymentPurposeStars" @@ -1843,6 +1855,9 @@ const ( TypePushMessageContentVideoNote = "pushMessageContentVideoNote" TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote" TypePushMessageContentBasicGroupChatCreate = "pushMessageContentBasicGroupChatCreate" + TypePushMessageContentVideoChatStarted = "pushMessageContentVideoChatStarted" + TypePushMessageContentVideoChatEnded = "pushMessageContentVideoChatEnded" + TypePushMessageContentInviteVideoChatParticipants = "pushMessageContentInviteVideoChatParticipants" TypePushMessageContentChatAddMembers = "pushMessageContentChatAddMembers" TypePushMessageContentChatChangePhoto = "pushMessageContentChatChangePhoto" TypePushMessageContentChatChangeTitle = "pushMessageContentChatChangeTitle" @@ -1853,6 +1868,7 @@ const ( TypePushMessageContentChatJoinByRequest = "pushMessageContentChatJoinByRequest" TypePushMessageContentRecurringPayment = "pushMessageContentRecurringPayment" TypePushMessageContentSuggestProfilePhoto = "pushMessageContentSuggestProfilePhoto" + TypePushMessageContentProximityAlertTriggered = "pushMessageContentProximityAlertTriggered" TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards" TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum" TypeNotificationTypeNewMessage = "notificationTypeNewMessage" @@ -1906,9 +1922,11 @@ const ( TypeUserPrivacySettingAllowFindingByPhoneNumber = "userPrivacySettingAllowFindingByPhoneNumber" TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" TypeUserPrivacySettingAutosaveGifts = "userPrivacySettingAutosaveGifts" + TypeUserPrivacySettingAllowUnpaidMessages = "userPrivacySettingAllowUnpaidMessages" TypeReadDatePrivacySettings = "readDatePrivacySettings" TypeNewChatPrivacySettings = "newChatPrivacySettings" TypeCanSendMessageToUserResultOk = "canSendMessageToUserResultOk" + TypeCanSendMessageToUserResultUserHasPaidMessages = "canSendMessageToUserResultUserHasPaidMessages" TypeCanSendMessageToUserResultUserIsDeleted = "canSendMessageToUserResultUserIsDeleted" TypeCanSendMessageToUserResultUserRestrictsNewChats = "canSendMessageToUserResultUserRestrictsNewChats" TypeAccountTtl = "accountTtl" @@ -2090,6 +2108,7 @@ const ( TypeText = "text" TypeSeconds = "seconds" TypeFileDownloadedPrefixSize = "fileDownloadedPrefixSize" + TypeStarCount = "starCount" TypeDeepLinkInfo = "deepLinkInfo" TypeTextParseModeMarkdown = "textParseModeMarkdown" TypeTextParseModeHTML = "textParseModeHTML" @@ -5975,6 +5994,8 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { // Describes an alternative re-encoded quality of a video file type AlternativeVideo struct { meta + // Unique identifier of the alternative video, which is used in the HLS file + Id JsonInt64 `json:"id"` // Video width Width int32 `json:"width"` // Video height @@ -8148,15 +8169,71 @@ func (*PremiumStatePaymentOption) GetType() string { return TypePremiumStatePaymentOption } -// Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments -type PremiumGiftCodePaymentOption struct { +// Describes an option for gifting Telegram Premium to a user. Use telegramPaymentPurposePremiumGift for out-of-store payments or payments in Telegram Stars +type PremiumGiftPaymentOption struct { + meta + // ISO 4217 currency code for the payment + Currency string `json:"currency"` + // The amount to pay, in the smallest units of the currency + Amount int64 `json:"amount"` + // The alternative amount of Telegram Stars to pay; 0 if payment in Telegram Stars is not possible + StarCount int64 `json:"star_count"` + // The discount associated with this option, as a percentage + DiscountPercentage int32 `json:"discount_percentage"` + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` + // Identifier of the store product associated with the option + StoreProductId string `json:"store_product_id"` + // A sticker to be shown along with the option; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *PremiumGiftPaymentOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftPaymentOption + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftPaymentOption) GetClass() string { + return ClassPremiumGiftPaymentOption +} + +func (*PremiumGiftPaymentOption) GetType() string { + return TypePremiumGiftPaymentOption +} + +// Contains a list of options for gifting Telegram Premium to a user +type PremiumGiftPaymentOptions struct { + meta + // The list of options sorted by Telegram Premium subscription duration + Options []*PremiumGiftPaymentOption `json:"options"` +} + +func (entity *PremiumGiftPaymentOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftPaymentOptions + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftPaymentOptions) GetClass() string { + return ClassPremiumGiftPaymentOptions +} + +func (*PremiumGiftPaymentOptions) GetType() string { + return TypePremiumGiftPaymentOptions +} + +// Describes an option for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments +type PremiumGiveawayPaymentOption struct { meta // ISO 4217 currency code for Telegram Premium gift code payment Currency string `json:"currency"` // The amount to pay, in the smallest units of the currency Amount int64 `json:"amount"` - // The discount associated with this option, as a percentage - DiscountPercentage int32 `json:"discount_percentage"` // Number of users which will be able to activate the gift codes WinnerCount int32 `json:"winner_count"` // Number of months the Telegram Premium subscription will be active @@ -8165,47 +8242,45 @@ type PremiumGiftCodePaymentOption struct { StoreProductId string `json:"store_product_id"` // Number of times the store product must be paid StoreProductQuantity int32 `json:"store_product_quantity"` - // A sticker to be shown along with the gift code; may be null if unknown - Sticker *Sticker `json:"sticker"` } -func (entity *PremiumGiftCodePaymentOption) MarshalJSON() ([]byte, error) { +func (entity *PremiumGiveawayPaymentOption) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiftCodePaymentOption + type stub PremiumGiveawayPaymentOption return json.Marshal((*stub)(entity)) } -func (*PremiumGiftCodePaymentOption) GetClass() string { - return ClassPremiumGiftCodePaymentOption +func (*PremiumGiveawayPaymentOption) GetClass() string { + return ClassPremiumGiveawayPaymentOption } -func (*PremiumGiftCodePaymentOption) GetType() string { - return TypePremiumGiftCodePaymentOption +func (*PremiumGiveawayPaymentOption) GetType() string { + return TypePremiumGiveawayPaymentOption } -// Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway -type PremiumGiftCodePaymentOptions struct { +// Contains a list of options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +type PremiumGiveawayPaymentOptions struct { meta // The list of options - Options []*PremiumGiftCodePaymentOption `json:"options"` + Options []*PremiumGiveawayPaymentOption `json:"options"` } -func (entity *PremiumGiftCodePaymentOptions) MarshalJSON() ([]byte, error) { +func (entity *PremiumGiveawayPaymentOptions) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiftCodePaymentOptions + type stub PremiumGiveawayPaymentOptions return json.Marshal((*stub)(entity)) } -func (*PremiumGiftCodePaymentOptions) GetClass() string { - return ClassPremiumGiftCodePaymentOptions +func (*PremiumGiveawayPaymentOptions) GetClass() string { + return ClassPremiumGiveawayPaymentOptions } -func (*PremiumGiftCodePaymentOptions) GetType() string { - return TypePremiumGiftCodePaymentOptions +func (*PremiumGiveawayPaymentOptions) GetType() string { + return TypePremiumGiveawayPaymentOptions } // Contains information about a Telegram Premium gift code @@ -8353,7 +8428,7 @@ func (*StarGiveawayWinnerOption) GetType() string { return TypeStarGiveawayWinnerOption } -// Describes an option for creating Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments +// Describes an option for creating of Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments type StarGiveawayPaymentOption struct { meta // ISO 4217 currency code for the payment @@ -8390,7 +8465,7 @@ func (*StarGiveawayPaymentOption) GetType() string { return TypeStarGiveawayPaymentOption } -// Contains a list of options for creating Telegram Star giveaway +// Contains a list of options for creating of Telegram Star giveaway type StarGiveawayPaymentOptions struct { meta // The list of options @@ -8833,6 +8908,8 @@ type ReceivedGift struct { IsPrivate bool `json:"is_private"` // True, if the gift is displayed on the chat's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` + // True, if the gift is pinned to the top of the chat's profile page + IsPinned bool `json:"is_pinned"` // True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift CanBeUpgraded bool `json:"can_be_upgraded"` // True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift @@ -8876,6 +8953,7 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { Text *FormattedText `json:"text"` IsPrivate bool `json:"is_private"` IsSaved bool `json:"is_saved"` + IsPinned bool `json:"is_pinned"` CanBeUpgraded bool `json:"can_be_upgraded"` CanBeTransferred bool `json:"can_be_transferred"` WasRefunded bool `json:"was_refunded"` @@ -8896,6 +8974,7 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { receivedGift.Text = tmp.Text receivedGift.IsPrivate = tmp.IsPrivate receivedGift.IsSaved = tmp.IsSaved + receivedGift.IsPinned = tmp.IsPinned receivedGift.CanBeUpgraded = tmp.CanBeUpgraded receivedGift.CanBeTransferred = tmp.CanBeTransferred receivedGift.WasRefunded = tmp.WasRefunded @@ -9178,7 +9257,7 @@ func (*StarTransactionTypeGiveawayDeposit) StarTransactionTypeType() string { return TypeStarTransactionTypeGiveawayDeposit } -// The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only +// The transaction is a withdrawal of earned Telegram Stars to Fragment; for regular users, bots, supergroup and channel chats only type StarTransactionTypeFragmentWithdrawal struct { meta // State of the withdrawal; may be null for refunds from Fragment @@ -9795,6 +9874,8 @@ func (*StarTransactionTypeGiftSale) StarTransactionTypeType() string { // The transaction is an upgrade of a gift; for regular users only type StarTransactionTypeGiftUpgrade struct { meta + // Identifier of the user that initially sent the gift + UserId int64 `json:"user_id"` // The upgraded gift Gift *UpgradedGift `json:"gift"` } @@ -9906,6 +9987,122 @@ func (*StarTransactionTypeAffiliateProgramCommission) StarTransactionTypeType() return TypeStarTransactionTypeAffiliateProgramCommission } +// The transaction is a sending of a paid message; for regular users only +type StarTransactionTypePaidMessageSend struct { + meta + // Identifier of the chat that received the payment + ChatId int64 `json:"chat_id"` + // Number of sent paid messages + MessageCount int32 `json:"message_count"` +} + +func (entity *StarTransactionTypePaidMessageSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidMessageSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidMessageSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidMessageSend) GetType() string { + return TypeStarTransactionTypePaidMessageSend +} + +func (*StarTransactionTypePaidMessageSend) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidMessageSend +} + +// The transaction is a receiving of a paid message; for regular users and supergroup chats only +type StarTransactionTypePaidMessageReceive struct { + meta + // Identifier of the sender of the message + SenderId MessageSender `json:"sender_id"` + // Number of received paid messages + MessageCount int32 `json:"message_count"` + // The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending + CommissionPerMille int32 `json:"commission_per_mille"` + // The amount of Telegram Stars that were received by Telegram; can be negative for refunds + CommissionStarAmount *StarAmount `json:"commission_star_amount"` +} + +func (entity *StarTransactionTypePaidMessageReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidMessageReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidMessageReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidMessageReceive) GetType() string { + return TypeStarTransactionTypePaidMessageReceive +} + +func (*StarTransactionTypePaidMessageReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidMessageReceive +} + +func (starTransactionTypePaidMessageReceive *StarTransactionTypePaidMessageReceive) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + MessageCount int32 `json:"message_count"` + CommissionPerMille int32 `json:"commission_per_mille"` + CommissionStarAmount *StarAmount `json:"commission_star_amount"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypePaidMessageReceive.MessageCount = tmp.MessageCount + starTransactionTypePaidMessageReceive.CommissionPerMille = tmp.CommissionPerMille + starTransactionTypePaidMessageReceive.CommissionStarAmount = tmp.CommissionStarAmount + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + starTransactionTypePaidMessageReceive.SenderId = fieldSenderId + + return nil +} + +// The transaction is a purchase of Telegram Premium subscription; for regular users only +type StarTransactionTypePremiumPurchase struct { + meta + // Identifier of the user that received the Telegram Premium subscription + UserId int64 `json:"user_id"` + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` + // A sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *StarTransactionTypePremiumPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePremiumPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePremiumPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePremiumPurchase) GetType() string { + return TypeStarTransactionTypePremiumPurchase +} + +func (*StarTransactionTypePremiumPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypePremiumPurchase +} + // The transaction is a transaction of an unsupported type type StarTransactionTypeUnsupported struct{ meta @@ -10611,6 +10808,8 @@ type User struct { HasUnreadActiveStories bool `json:"has_unread_active_stories"` // True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them RestrictsNewChats bool `json:"restricts_new_chats"` + // Number of Telegram Stars that must be paid by general user for each sent message to the user. If positive and userFullInfo is unknown, use canSendMessageToUser to check whether the current user must pay + PaidMessageStarCount int64 `json:"paid_message_star_count"` // If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method HaveAccess bool `json:"have_access"` // Type of the user @@ -10662,6 +10861,7 @@ func (user *User) UnmarshalJSON(data []byte) error { HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` RestrictsNewChats bool `json:"restricts_new_chats"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` HaveAccess bool `json:"have_access"` Type json.RawMessage `json:"type"` LanguageCode string `json:"language_code"` @@ -10695,6 +10895,7 @@ func (user *User) UnmarshalJSON(data []byte) error { user.HasActiveStories = tmp.HasActiveStories user.HasUnreadActiveStories = tmp.HasUnreadActiveStories user.RestrictsNewChats = tmp.RestrictsNewChats + user.PaidMessageStarCount = tmp.PaidMessageStarCount user.HaveAccess = tmp.HaveAccess user.LanguageCode = tmp.LanguageCode user.AddedToAttachmentMenu = tmp.AddedToAttachmentMenu @@ -10877,6 +11078,10 @@ type UserFullInfo struct { GiftCount int32 `json:"gift_count"` // Number of group chats where both the other user and the current user are a member; 0 for the current user GroupInCommonCount int32 `json:"group_in_common_count"` + // Number of Telegram Stars that must be paid by the user for each sent message to the current user + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` + // Number of Telegram Stars that must be paid by the current user for each sent message to the user + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` // Information about verification status of the user provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` // Information about business settings for Telegram Business accounts; may be null if none @@ -10921,6 +11126,8 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { PersonalChatId int64 `json:"personal_chat_id"` GiftCount int32 `json:"gift_count"` GroupInCommonCount int32 `json:"group_in_common_count"` + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` BotVerification *BotVerification `json:"bot_verification"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` @@ -10948,6 +11155,8 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.PersonalChatId = tmp.PersonalChatId userFullInfo.GiftCount = tmp.GiftCount userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount + userFullInfo.IncomingPaidMessageStarCount = tmp.IncomingPaidMessageStarCount + userFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount userFullInfo.BotVerification = tmp.BotVerification userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo @@ -12279,6 +12488,8 @@ type Supergroup struct { HasSensitiveContent bool `json:"has_sensitive_content"` // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted RestrictionReason string `json:"restriction_reason"` + // Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message + PaidMessageStarCount int64 `json:"paid_message_star_count"` // True, if the supergroup or channel has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` // True, if the supergroup or channel has unread non-expired stories available to the current user @@ -12323,6 +12534,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { VerificationStatus *VerificationStatus `json:"verification_status"` HasSensitiveContent bool `json:"has_sensitive_content"` RestrictionReason string `json:"restriction_reason"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` } @@ -12351,6 +12563,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.VerificationStatus = tmp.VerificationStatus supergroup.HasSensitiveContent = tmp.HasSensitiveContent supergroup.RestrictionReason = tmp.RestrictionReason + supergroup.PaidMessageStarCount = tmp.PaidMessageStarCount supergroup.HasActiveStories = tmp.HasActiveStories supergroup.HasUnreadActiveStories = tmp.HasUnreadActiveStories @@ -12381,6 +12594,8 @@ type SupergroupFullInfo struct { SlowModeDelay int32 `json:"slow_mode_delay"` // Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero SlowModeDelayExpiresIn float64 `json:"slow_mode_delay_expires_in"` + // True, if paid messages can be enabled in the supergroup chat; for supergroup only + CanEnablePaidMessages bool `json:"can_enable_paid_messages"` // True, if paid reaction can be enabled in the channel chat; for channels only CanEnablePaidReaction bool `json:"can_enable_paid_reaction"` // True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers @@ -13767,6 +13982,8 @@ type MessageSendingStateFailed struct { NeedAnotherReplyQuote bool `json:"need_another_reply_quote"` // True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages NeedDropReply bool `json:"need_drop_reply"` + // The number of Telegram Stars that must be paid to send the message; 0 if the current amount is correct + RequiredPaidMessageStarCount int64 `json:"required_paid_message_star_count"` // Time left before the message can be re-sent, in seconds. No update is sent when this field changes RetryAfter float64 `json:"retry_after"` } @@ -14113,6 +14330,8 @@ type Message struct { SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` // Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead SenderBoostCount int32 `json:"sender_boost_count"` + // The number of Telegram Stars the sender paid to send the message + PaidMessageStarCount int64 `json:"paid_message_star_count"` // For channel posts and anonymous group messages, optional author signature AuthorSignature string `json:"author_signature"` // Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums @@ -14176,6 +14395,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { ViaBotUserId int64 `json:"via_bot_user_id"` SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` SenderBoostCount int32 `json:"sender_boost_count"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` EffectId JsonInt64 `json:"effect_id"` @@ -14214,6 +14434,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.ViaBotUserId = tmp.ViaBotUserId message.SenderBusinessBotUserId = tmp.SenderBusinessBotUserId message.SenderBoostCount = tmp.SenderBoostCount + message.PaidMessageStarCount = tmp.PaidMessageStarCount message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId message.EffectId = tmp.EffectId @@ -16643,6 +16864,37 @@ func (*PublicChatTypeIsLocationBased) PublicChatTypeType() string { return TypePublicChatTypeIsLocationBased } +// Contains basic information about another user that started a chat with the current user +type AccountInfo struct { + meta + // Month when the user was registered in Telegram; 0-12; may be 0 if unknown + RegistrationMonth int32 `json:"registration_month"` + // Year when the user was registered in Telegram; 0-9999; may be 0 if unknown + RegistrationYear int32 `json:"registration_year"` + // A two-letter ISO 3166-1 alpha-2 country code based on the phone number of the user; may be empty if unknown + PhoneNumberCountryCode string `json:"phone_number_country_code"` + // Point in time (Unix timestamp) when the user changed name last time; 0 if unknown + LastNameChangeDate int32 `json:"last_name_change_date"` + // Point in time (Unix timestamp) when the user changed photo last time; 0 if unknown + LastPhotoChangeDate int32 `json:"last_photo_change_date"` +} + +func (entity *AccountInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AccountInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AccountInfo) GetClass() string { + return ClassAccountInfo +} + +func (*AccountInfo) GetType() string { + return TypeAccountInfo +} + // The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown type ChatActionBarReportSpam struct { meta @@ -16700,6 +16952,8 @@ type ChatActionBarReportAddBlock struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings CanUnarchive bool `json:"can_unarchive"` + // Basic information about the other user in the chat; may be null if unknown + AccountInfo *AccountInfo `json:"account_info"` } func (entity *ChatActionBarReportAddBlock) MarshalJSON() ([]byte, error) { @@ -28798,9 +29052,11 @@ type MessageSendOptions struct { ProtectContent bool `json:"protect_content"` // Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only AllowPaidBroadcast bool `json:"allow_paid_broadcast"` + // The number of Telegram Stars the user agreed to pay to send the messages + PaidMessageStarCount int64 `json:"paid_message_star_count"` // Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` - // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled + // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled SchedulingState MessageSchedulingState `json:"scheduling_state"` // Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats EffectId JsonInt64 `json:"effect_id"` @@ -28832,6 +29088,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` AllowPaidBroadcast bool `json:"allow_paid_broadcast"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` SchedulingState json.RawMessage `json:"scheduling_state"` EffectId JsonInt64 `json:"effect_id"` @@ -28848,6 +29105,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent messageSendOptions.AllowPaidBroadcast = tmp.AllowPaidBroadcast + messageSendOptions.PaidMessageStarCount = tmp.PaidMessageStarCount messageSendOptions.UpdateOrderOfInstalledStickerSets = tmp.UpdateOrderOfInstalledStickerSets messageSendOptions.EffectId = tmp.EffectId messageSendOptions.SendingId = tmp.SendingId @@ -34594,6 +34852,8 @@ type GroupCall struct { meta // Group call identifier Id int32 `json:"id"` + // Identifier of one-to-one call from which the group call was created; 0 if unknown + FromCallId int32 `json:"from_call_id"` // Group call title Title string `json:"title"` // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended @@ -41754,10 +42014,43 @@ func (*StorePaymentPurposePremiumSubscription) StorePaymentPurposeType() string return TypeStorePaymentPurposePremiumSubscription } -// The user creating Telegram Premium gift codes for other users +// The user gifting Telegram Premium to another user +type StorePaymentPurposePremiumGift struct { + meta + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Identifiers of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` +} + +func (entity *StorePaymentPurposePremiumGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposePremiumGift + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposePremiumGift) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposePremiumGift) GetType() string { + return TypeStorePaymentPurposePremiumGift +} + +func (*StorePaymentPurposePremiumGift) StorePaymentPurposeType() string { + return TypeStorePaymentPurposePremiumGift +} + +// The user boosting a chat by creating Telegram Premium gift codes for other users type StorePaymentPurposePremiumGiftCodes struct { meta - // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -41919,10 +42212,45 @@ func (*StorePaymentPurposeGiftedStars) StorePaymentPurposeType() string { return TypeStorePaymentPurposeGiftedStars } -// The user creating Telegram Premium gift codes for other users +// The user gifting Telegram Premium to another user +type TelegramPaymentPurposePremiumGift struct { + meta + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Identifier of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // Number of months the Telegram Premium subscription will be active for the user + MonthCount int32 `json:"month_count"` + // Text to show to the user receiving Telegram Premium; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` +} + +func (entity *TelegramPaymentPurposePremiumGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposePremiumGift + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposePremiumGift) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposePremiumGift) GetType() string { + return TypeTelegramPaymentPurposePremiumGift +} + +func (*TelegramPaymentPurposePremiumGift) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposePremiumGift +} + +// The user boosting a chat by creating Telegram Premium gift codes for other users type TelegramPaymentPurposePremiumGiftCodes struct { meta - // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -44129,6 +44457,8 @@ func (*PushMessageContentSticker) PushMessageContentType() string { // A message with a story type PushMessageContentStory struct { meta + // True, if the user was mentioned in the story + IsMention bool `json:"is_mention"` // True, if the message is a pinned message with the specified content IsPinned bool `json:"is_pinned"` } @@ -44298,6 +44628,83 @@ func (*PushMessageContentBasicGroupChatCreate) PushMessageContentType() string { return TypePushMessageContentBasicGroupChatCreate } +// A video chat or live stream was started +type PushMessageContentVideoChatStarted struct{ + meta +} + +func (entity *PushMessageContentVideoChatStarted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideoChatStarted + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideoChatStarted) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideoChatStarted) GetType() string { + return TypePushMessageContentVideoChatStarted +} + +func (*PushMessageContentVideoChatStarted) PushMessageContentType() string { + return TypePushMessageContentVideoChatStarted +} + +// A video chat or live stream has ended +type PushMessageContentVideoChatEnded struct{ + meta +} + +func (entity *PushMessageContentVideoChatEnded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideoChatEnded + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideoChatEnded) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideoChatEnded) GetType() string { + return TypePushMessageContentVideoChatEnded +} + +func (*PushMessageContentVideoChatEnded) PushMessageContentType() string { + return TypePushMessageContentVideoChatEnded +} + +// An invitation of participants to a video chat or live stream +type PushMessageContentInviteVideoChatParticipants struct { + meta + // True, if the current user was invited to the video chat or the live stream + IsCurrentUser bool `json:"is_current_user"` +} + +func (entity *PushMessageContentInviteVideoChatParticipants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentInviteVideoChatParticipants + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentInviteVideoChatParticipants) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentInviteVideoChatParticipants) GetType() string { + return TypePushMessageContentInviteVideoChatParticipants +} + +func (*PushMessageContentInviteVideoChatParticipants) PushMessageContentType() string { + return TypePushMessageContentInviteVideoChatParticipants +} + // New chat members were invited to a group type PushMessageContentChatAddMembers struct { meta @@ -44568,6 +44975,33 @@ func (*PushMessageContentSuggestProfilePhoto) PushMessageContentType() string { return TypePushMessageContentSuggestProfilePhoto } +// A user in the chat came within proximity alert range from the current user +type PushMessageContentProximityAlertTriggered struct { + meta + // The distance to the user + Distance int32 `json:"distance"` +} + +func (entity *PushMessageContentProximityAlertTriggered) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentProximityAlertTriggered + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentProximityAlertTriggered) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentProximityAlertTriggered) GetType() string { + return TypePushMessageContentProximityAlertTriggered +} + +func (*PushMessageContentProximityAlertTriggered) PushMessageContentType() string { + return TypePushMessageContentProximityAlertTriggered +} + // A forwarded messages type PushMessageContentMessageForwards struct { meta @@ -46091,6 +46525,31 @@ func (*UserPrivacySettingAutosaveGifts) UserPrivacySettingType() string { return TypeUserPrivacySettingAutosaveGifts } +// A privacy setting for managing whether the user can receive messages without additional payment +type UserPrivacySettingAllowUnpaidMessages struct{ + meta +} + +func (entity *UserPrivacySettingAllowUnpaidMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAllowUnpaidMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAllowUnpaidMessages) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAllowUnpaidMessages) GetType() string { + return TypeUserPrivacySettingAllowUnpaidMessages +} + +func (*UserPrivacySettingAllowUnpaidMessages) UserPrivacySettingType() string { + return TypeUserPrivacySettingAllowUnpaidMessages +} + // Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting type ReadDatePrivacySettings struct { meta @@ -46114,11 +46573,13 @@ func (*ReadDatePrivacySettings) GetType() string { return TypeReadDatePrivacySettings } -// Contains privacy settings for new chats with non-contacts +// Contains privacy settings for chats with non-contacts type NewChatPrivacySettings struct { meta // True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting AllowNewChatsFromUnknownUsers bool `json:"allow_new_chats_from_unknown_users"` + // Number of Telegram Stars that must be paid for every incoming private message by non-contacts; 0-getOption("paid_message_star_count_max"). If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` } func (entity *NewChatPrivacySettings) MarshalJSON() ([]byte, error) { @@ -46162,6 +46623,33 @@ func (*CanSendMessageToUserResultOk) CanSendMessageToUserResultType() string { return TypeCanSendMessageToUserResultOk } +// The user can be messaged, but the messages are paid +type CanSendMessageToUserResultUserHasPaidMessages struct { + meta + // Number of Telegram Stars that must be paid by the current user for each sent message to the user + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` +} + +func (entity *CanSendMessageToUserResultUserHasPaidMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendMessageToUserResultUserHasPaidMessages + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) GetClass() string { + return ClassCanSendMessageToUserResult +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) GetType() string { + return TypeCanSendMessageToUserResultUserHasPaidMessages +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) CanSendMessageToUserResultType() string { + return TypeCanSendMessageToUserResultUserHasPaidMessages +} + // The user can't be messaged, because they are deleted or unknown type CanSendMessageToUserResultUserIsDeleted struct{ meta @@ -48172,7 +48660,7 @@ func (*InternalLinkTypePremiumFeatures) InternalLinkTypeType() string { return TypeInternalLinkTypePremiumFeatures } -// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGiftCodes payments or in-store purchases +// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGift payments or in-store purchases type InternalLinkTypePremiumGift struct { meta // Referrer specified in the link @@ -51185,6 +51673,29 @@ func (*FileDownloadedPrefixSize) GetType() string { return TypeFileDownloadedPrefixSize } +// Contains a number of Telegram Stars +type StarCount struct { + meta + // Number of Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *StarCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarCount + + return json.Marshal((*stub)(entity)) +} + +func (*StarCount) GetClass() string { + return ClassStarCount +} + +func (*StarCount) GetType() string { + return TypeStarCount +} + // Contains information about a tg: deep link type DeepLinkInfo struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 313cb84..62cd54e 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -922,6 +922,15 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeAffiliateProgramCommission: return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + case TypeStarTransactionTypePaidMessageSend: + return UnmarshalStarTransactionTypePaidMessageSend(data) + + case TypeStarTransactionTypePaidMessageReceive: + return UnmarshalStarTransactionTypePaidMessageReceive(data) + + case TypeStarTransactionTypePremiumPurchase: + return UnmarshalStarTransactionTypePremiumPurchase(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -5726,6 +5735,9 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) + case TypeStorePaymentPurposePremiumGift: + return UnmarshalStorePaymentPurposePremiumGift(data) + case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -5769,6 +5781,9 @@ func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpo } switch meta.Type { + case TypeTelegramPaymentPurposePremiumGift: + return UnmarshalTelegramPaymentPurposePremiumGift(data) + case TypeTelegramPaymentPurposePremiumGiftCodes: return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) @@ -6311,6 +6326,15 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentBasicGroupChatCreate: return UnmarshalPushMessageContentBasicGroupChatCreate(data) + case TypePushMessageContentVideoChatStarted: + return UnmarshalPushMessageContentVideoChatStarted(data) + + case TypePushMessageContentVideoChatEnded: + return UnmarshalPushMessageContentVideoChatEnded(data) + + case TypePushMessageContentInviteVideoChatParticipants: + return UnmarshalPushMessageContentInviteVideoChatParticipants(data) + case TypePushMessageContentChatAddMembers: return UnmarshalPushMessageContentChatAddMembers(data) @@ -6341,6 +6365,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentSuggestProfilePhoto: return UnmarshalPushMessageContentSuggestProfilePhoto(data) + case TypePushMessageContentProximityAlertTriggered: + return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -6678,6 +6705,9 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro case TypeUserPrivacySettingAutosaveGifts: return UnmarshalUserPrivacySettingAutosaveGifts(data) + case TypeUserPrivacySettingAllowUnpaidMessages: + return UnmarshalUserPrivacySettingAllowUnpaidMessages(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6709,6 +6739,9 @@ func UnmarshalCanSendMessageToUserResult(data json.RawMessage) (CanSendMessageTo case TypeCanSendMessageToUserResultOk: return UnmarshalCanSendMessageToUserResultOk(data) + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data) + case TypeCanSendMessageToUserResultUserIsDeleted: return UnmarshalCanSendMessageToUserResultUserIsDeleted(data) @@ -9752,16 +9785,32 @@ func UnmarshalPremiumStatePaymentOption(data json.RawMessage) (*PremiumStatePaym return &resp, err } -func UnmarshalPremiumGiftCodePaymentOption(data json.RawMessage) (*PremiumGiftCodePaymentOption, error) { - var resp PremiumGiftCodePaymentOption +func UnmarshalPremiumGiftPaymentOption(data json.RawMessage) (*PremiumGiftPaymentOption, error) { + var resp PremiumGiftPaymentOption err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiftCodePaymentOptions(data json.RawMessage) (*PremiumGiftCodePaymentOptions, error) { - var resp PremiumGiftCodePaymentOptions +func UnmarshalPremiumGiftPaymentOptions(data json.RawMessage) (*PremiumGiftPaymentOptions, error) { + var resp PremiumGiftPaymentOptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayPaymentOption(data json.RawMessage) (*PremiumGiveawayPaymentOption, error) { + var resp PremiumGiveawayPaymentOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayPaymentOptions(data json.RawMessage) (*PremiumGiveawayPaymentOptions, error) { + var resp PremiumGiveawayPaymentOptions err := json.Unmarshal(data, &resp) @@ -10152,6 +10201,30 @@ func UnmarshalStarTransactionTypeAffiliateProgramCommission(data json.RawMessage return &resp, err } +func UnmarshalStarTransactionTypePaidMessageSend(data json.RawMessage) (*StarTransactionTypePaidMessageSend, error) { + var resp StarTransactionTypePaidMessageSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePaidMessageReceive(data json.RawMessage) (*StarTransactionTypePaidMessageReceive, error) { + var resp StarTransactionTypePaidMessageReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePremiumPurchase(data json.RawMessage) (*StarTransactionTypePremiumPurchase, error) { + var resp StarTransactionTypePremiumPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { var resp StarTransactionTypeUnsupported @@ -11696,6 +11769,14 @@ func UnmarshalPublicChatTypeIsLocationBased(data json.RawMessage) (*PublicChatTy return &resp, err } +func UnmarshalAccountInfo(data json.RawMessage) (*AccountInfo, error) { + var resp AccountInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatActionBarReportSpam(data json.RawMessage) (*ChatActionBarReportSpam, error) { var resp ChatActionBarReportSpam @@ -17696,6 +17777,14 @@ func UnmarshalStorePaymentPurposePremiumSubscription(data json.RawMessage) (*Sto return &resp, err } +func UnmarshalStorePaymentPurposePremiumGift(data json.RawMessage) (*StorePaymentPurposePremiumGift, error) { + var resp StorePaymentPurposePremiumGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStorePaymentPurposePremiumGiftCodes(data json.RawMessage) (*StorePaymentPurposePremiumGiftCodes, error) { var resp StorePaymentPurposePremiumGiftCodes @@ -17736,6 +17825,14 @@ func UnmarshalStorePaymentPurposeGiftedStars(data json.RawMessage) (*StorePaymen return &resp, err } +func UnmarshalTelegramPaymentPurposePremiumGift(data json.RawMessage) (*TelegramPaymentPurposePremiumGift, error) { + var resp TelegramPaymentPurposePremiumGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTelegramPaymentPurposePremiumGiftCodes(data json.RawMessage) (*TelegramPaymentPurposePremiumGiftCodes, error) { var resp TelegramPaymentPurposePremiumGiftCodes @@ -18400,6 +18497,30 @@ func UnmarshalPushMessageContentBasicGroupChatCreate(data json.RawMessage) (*Pus return &resp, err } +func UnmarshalPushMessageContentVideoChatStarted(data json.RawMessage) (*PushMessageContentVideoChatStarted, error) { + var resp PushMessageContentVideoChatStarted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentVideoChatEnded(data json.RawMessage) (*PushMessageContentVideoChatEnded, error) { + var resp PushMessageContentVideoChatEnded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentInviteVideoChatParticipants(data json.RawMessage) (*PushMessageContentInviteVideoChatParticipants, error) { + var resp PushMessageContentInviteVideoChatParticipants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentChatAddMembers(data json.RawMessage) (*PushMessageContentChatAddMembers, error) { var resp PushMessageContentChatAddMembers @@ -18480,6 +18601,14 @@ func UnmarshalPushMessageContentSuggestProfilePhoto(data json.RawMessage) (*Push return &resp, err } +func UnmarshalPushMessageContentProximityAlertTriggered(data json.RawMessage) (*PushMessageContentProximityAlertTriggered, error) { + var resp PushMessageContentProximityAlertTriggered + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentMessageForwards(data json.RawMessage) (*PushMessageContentMessageForwards, error) { var resp PushMessageContentMessageForwards @@ -18904,6 +19033,14 @@ func UnmarshalUserPrivacySettingAutosaveGifts(data json.RawMessage) (*UserPrivac return &resp, err } +func UnmarshalUserPrivacySettingAllowUnpaidMessages(data json.RawMessage) (*UserPrivacySettingAllowUnpaidMessages, error) { + var resp UserPrivacySettingAllowUnpaidMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReadDatePrivacySettings(data json.RawMessage) (*ReadDatePrivacySettings, error) { var resp ReadDatePrivacySettings @@ -18928,6 +19065,14 @@ func UnmarshalCanSendMessageToUserResultOk(data json.RawMessage) (*CanSendMessag return &resp, err } +func UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data json.RawMessage) (*CanSendMessageToUserResultUserHasPaidMessages, error) { + var resp CanSendMessageToUserResultUserHasPaidMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCanSendMessageToUserResultUserIsDeleted(data json.RawMessage) (*CanSendMessageToUserResultUserIsDeleted, error) { var resp CanSendMessageToUserResultUserIsDeleted @@ -20376,6 +20521,14 @@ func UnmarshalFileDownloadedPrefixSize(data json.RawMessage) (*FileDownloadedPre return &resp, err } +func UnmarshalStarCount(data json.RawMessage) (*StarCount, error) { + var resp StarCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeepLinkInfo(data json.RawMessage) (*DeepLinkInfo, error) { var resp DeepLinkInfo @@ -22596,11 +22749,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumStatePaymentOption: return UnmarshalPremiumStatePaymentOption(data) - case TypePremiumGiftCodePaymentOption: - return UnmarshalPremiumGiftCodePaymentOption(data) + case TypePremiumGiftPaymentOption: + return UnmarshalPremiumGiftPaymentOption(data) - case TypePremiumGiftCodePaymentOptions: - return UnmarshalPremiumGiftCodePaymentOptions(data) + case TypePremiumGiftPaymentOptions: + return UnmarshalPremiumGiftPaymentOptions(data) + + case TypePremiumGiveawayPaymentOption: + return UnmarshalPremiumGiveawayPaymentOption(data) + + case TypePremiumGiveawayPaymentOptions: + return UnmarshalPremiumGiveawayPaymentOptions(data) case TypePremiumGiftCodeInfo: return UnmarshalPremiumGiftCodeInfo(data) @@ -22746,6 +22905,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeAffiliateProgramCommission: return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + case TypeStarTransactionTypePaidMessageSend: + return UnmarshalStarTransactionTypePaidMessageSend(data) + + case TypeStarTransactionTypePaidMessageReceive: + return UnmarshalStarTransactionTypePaidMessageReceive(data) + + case TypeStarTransactionTypePremiumPurchase: + return UnmarshalStarTransactionTypePremiumPurchase(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -23325,6 +23493,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePublicChatTypeIsLocationBased: return UnmarshalPublicChatTypeIsLocationBased(data) + case TypeAccountInfo: + return UnmarshalAccountInfo(data) + case TypeChatActionBarReportSpam: return UnmarshalChatActionBarReportSpam(data) @@ -25575,6 +25746,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) + case TypeStorePaymentPurposePremiumGift: + return UnmarshalStorePaymentPurposePremiumGift(data) + case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -25590,6 +25764,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposeGiftedStars: return UnmarshalStorePaymentPurposeGiftedStars(data) + case TypeTelegramPaymentPurposePremiumGift: + return UnmarshalTelegramPaymentPurposePremiumGift(data) + case TypeTelegramPaymentPurposePremiumGiftCodes: return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) @@ -25839,6 +26016,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentBasicGroupChatCreate: return UnmarshalPushMessageContentBasicGroupChatCreate(data) + case TypePushMessageContentVideoChatStarted: + return UnmarshalPushMessageContentVideoChatStarted(data) + + case TypePushMessageContentVideoChatEnded: + return UnmarshalPushMessageContentVideoChatEnded(data) + + case TypePushMessageContentInviteVideoChatParticipants: + return UnmarshalPushMessageContentInviteVideoChatParticipants(data) + case TypePushMessageContentChatAddMembers: return UnmarshalPushMessageContentChatAddMembers(data) @@ -25869,6 +26055,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentSuggestProfilePhoto: return UnmarshalPushMessageContentSuggestProfilePhoto(data) + case TypePushMessageContentProximityAlertTriggered: + return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -26028,6 +26217,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingAutosaveGifts: return UnmarshalUserPrivacySettingAutosaveGifts(data) + case TypeUserPrivacySettingAllowUnpaidMessages: + return UnmarshalUserPrivacySettingAllowUnpaidMessages(data) + case TypeReadDatePrivacySettings: return UnmarshalReadDatePrivacySettings(data) @@ -26037,6 +26229,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCanSendMessageToUserResultOk: return UnmarshalCanSendMessageToUserResultOk(data) + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data) + case TypeCanSendMessageToUserResultUserIsDeleted: return UnmarshalCanSendMessageToUserResultUserIsDeleted(data) @@ -26580,6 +26775,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFileDownloadedPrefixSize: return UnmarshalFileDownloadedPrefixSize(data) + case TypeStarCount: + return UnmarshalStarCount(data) + case TypeDeepLinkInfo: return UnmarshalDeepLinkInfo(data) diff --git a/data/td_api.tl b/data/td_api.tl index 28709bd..8872945 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -529,12 +529,13 @@ poll id:int64 question:formattedText options:vector total_voter_coun //@description Describes an alternative re-encoded quality of a video file +//@id Unique identifier of the alternative video, which is used in the HLS file //@width Video width //@height Video height //@codec Codec used for video file encoding, for example, "h264", "h265", or "av1" //@hls_file HLS file describing the video //@video File containing the video -alternativeVideo width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; +alternativeVideo id:int64 width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; //@description Describes a chat background @@ -972,19 +973,30 @@ premiumPaymentOption currency:string amount:int53 discount_percentage:int32 mont //@last_transaction_id Identifier of the last in-store transaction for the currently used option premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is_upgrade:Bool last_transaction_id:string = PremiumStatePaymentOption; -//@description Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments +//@description Describes an option for gifting Telegram Premium to a user. Use telegramPaymentPurposePremiumGift for out-of-store payments or payments in Telegram Stars +//@currency ISO 4217 currency code for the payment +//@amount The amount to pay, in the smallest units of the currency +//@star_count The alternative amount of Telegram Stars to pay; 0 if payment in Telegram Stars is not possible +//@discount_percentage The discount associated with this option, as a percentage +//@month_count Number of months the Telegram Premium subscription will be active +//@store_product_id Identifier of the store product associated with the option +//@sticker A sticker to be shown along with the option; may be null if unknown +premiumGiftPaymentOption currency:string amount:int53 star_count:int53 discount_percentage:int32 month_count:int32 store_product_id:string sticker:sticker = PremiumGiftPaymentOption; + +//@description Contains a list of options for gifting Telegram Premium to a user @options The list of options sorted by Telegram Premium subscription duration +premiumGiftPaymentOptions options:vector = PremiumGiftPaymentOptions; + +//@description Describes an option for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments //@currency ISO 4217 currency code for Telegram Premium gift code payment //@amount The amount to pay, in the smallest units of the currency -//@discount_percentage The discount associated with this option, as a percentage //@winner_count Number of users which will be able to activate the gift codes //@month_count Number of months the Telegram Premium subscription will be active //@store_product_id Identifier of the store product associated with the option; may be empty if none //@store_product_quantity Number of times the store product must be paid -//@sticker A sticker to be shown along with the gift code; may be null if unknown -premiumGiftCodePaymentOption currency:string amount:int53 discount_percentage:int32 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 sticker:sticker = PremiumGiftCodePaymentOption; +premiumGiveawayPaymentOption currency:string amount:int53 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiveawayPaymentOption; -//@description Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway @options The list of options -premiumGiftCodePaymentOptions options:vector = PremiumGiftCodePaymentOptions; +//@description Contains a list of options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members @options The list of options +premiumGiveawayPaymentOptions options:vector = PremiumGiveawayPaymentOptions; //@description Contains information about a Telegram Premium gift code //@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown. If null and the code is from messagePremiumGiftCode message, then creator_id from the message can be used @@ -1013,7 +1025,7 @@ starPaymentOptions options:vector = StarPaymentOptions; //@is_default True, if the option must be chosen by default starGiveawayWinnerOption winner_count:int32 won_star_count:int53 is_default:Bool = StarGiveawayWinnerOption; -//@description Describes an option for creating Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments +//@description Describes an option for creating of Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments //@currency ISO 4217 currency code for the payment //@amount The amount to pay, in the smallest units of the currency //@star_count Number of Telegram Stars that will be distributed among winners @@ -1024,7 +1036,7 @@ starGiveawayWinnerOption winner_count:int32 won_star_count:int53 is_default:Bool //@is_additional True, if the option must be shown only in the full list of payment options starGiveawayPaymentOption currency:string amount:int53 star_count:int53 store_product_id:string yearly_boost_count:int32 winner_options:vector is_default:Bool is_additional:Bool = StarGiveawayPaymentOption; -//@description Contains a list of options for creating Telegram Star giveaway @options The list of options +//@description Contains a list of options for creating of Telegram Star giveaway @options The list of options starGiveawayPaymentOptions options:vector = StarGiveawayPaymentOptions; @@ -1118,6 +1130,7 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@text Message added to the gift //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them //@is_saved True, if the gift is displayed on the chat's profile page; only for the receiver of the gift +//@is_pinned True, if the gift is pinned to the top of the chat's profile page //@can_be_upgraded True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift //@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift //@was_refunded True, if the gift was refunded and isn't available anymore @@ -1127,7 +1140,7 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; //@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts @@ -1176,7 +1189,8 @@ starTransactionTypeUserDeposit user_id:int53 sticker:sticker = StarTransactionTy //@giveaway_message_id Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message starTransactionTypeGiveawayDeposit chat_id:int53 giveaway_message_id:int53 = StarTransactionType; -//@description The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only @withdrawal_state State of the withdrawal; may be null for refunds from Fragment +//@description The transaction is a withdrawal of earned Telegram Stars to Fragment; for regular users, bots, supergroup and channel chats only +//@withdrawal_state State of the withdrawal; may be null for refunds from Fragment starTransactionTypeFragmentWithdrawal withdrawal_state:RevenueWithdrawalState = StarTransactionType; //@description The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only @@ -1254,8 +1268,8 @@ starTransactionTypeGiftTransfer owner_id:MessageSender gift:upgradedGift = StarT //@description The transaction is a sale of a received gift; for regular users and channel chats only @user_id Identifier of the user that sent the gift @gift The gift starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; -//@description The transaction is an upgrade of a gift; for regular users only @gift The upgraded gift -starTransactionTypeGiftUpgrade gift:upgradedGift = StarTransactionType; +//@description The transaction is an upgrade of a gift; for regular users only @user_id Identifier of the user that initially sent the gift @gift The upgraded gift +starTransactionTypeGiftUpgrade user_id:int53 gift:upgradedGift = StarTransactionType; //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat @@ -1272,6 +1286,22 @@ starTransactionTypeChannelPaidReactionReceive user_id:int53 message_id:int53 = S //@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner starTransactionTypeAffiliateProgramCommission chat_id:int53 commission_per_mille:int32 = StarTransactionType; +//@description The transaction is a sending of a paid message; for regular users only @chat_id Identifier of the chat that received the payment @message_count Number of sent paid messages +starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTransactionType; + +//@description The transaction is a receiving of a paid message; for regular users and supergroup chats only +//@sender_id Identifier of the sender of the message +//@message_count Number of received paid messages +//@commission_per_mille The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending +//@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds +starTransactionTypePaidMessageReceive sender_id:MessageSender message_count:int32 commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; + +//@description The transaction is a purchase of Telegram Premium subscription; for regular users only +//@user_id Identifier of the user that received the Telegram Premium subscription +//@month_count Number of months the Telegram Premium subscription will be active +//@sticker A sticker to be shown in the transaction information; may be null if unknown +starTransactionTypePremiumPurchase user_id:int53 month_count:int32 sticker:sticker = StarTransactionType; + //@description The transaction is a transaction of an unsupported type starTransactionTypeUnsupported = StarTransactionType; @@ -1420,11 +1450,12 @@ usernames active_usernames:vector disabled_usernames:vector edit //@has_active_stories True, if the user has non-expired stories available to the current user //@has_unread_active_stories True, if the user has unread non-expired stories available to the current user //@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them +//@paid_message_star_count Number of Telegram Stars that must be paid by general user for each sent message to the user. If positive and userFullInfo is unknown, use canSendMessageToUser to check whether the current user must pay //@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool paid_message_star_count:int53 have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -1474,10 +1505,12 @@ botInfo short_description:string description:string photo:photo animation:animat //@personal_chat_id Identifier of the personal chat of the user; 0 if none //@gift_count Number of saved to profile gifts for other users or the total number of received gifts for the current user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user +//@incoming_paid_message_star_count Number of Telegram Stars that must be paid by the user for each sent message to the current user +//@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the user //@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -1719,9 +1752,10 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@verification_status Information about verification status of the supergroup or channel; may be null if none //@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted +//@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1733,6 +1767,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@linked_chat_id Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown //@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds //@slow_mode_delay_expires_in Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero +//@can_enable_paid_messages True, if paid messages can be enabled in the supergroup chat; for supergroup only //@can_enable_paid_reaction True, if paid reaction can be enabled in the channel chat; for channels only //@can_get_members True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers //@has_hidden_members True, if non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers @@ -1761,7 +1796,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -1973,8 +2008,9 @@ messageSendingStatePending sending_id:int32 = MessageSendingState; //@need_another_sender True, if the message can be re-sent only on behalf of a different sender //@need_another_reply_quote True, if the message can be re-sent only if another quote is chosen in the message that is replied by the given message //@need_drop_reply True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages +//@required_paid_message_star_count The number of Telegram Stars that must be paid to send the message; 0 if the current amount is correct //@retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes -messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool retry_after:double = MessageSendingState; +messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool required_paid_message_star_count:int53 retry_after:double = MessageSendingState; //@description Describes manually or automatically chosen quote from another message @@ -2062,6 +2098,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@via_bot_user_id If non-zero, the user identifier of the inline bot through which this message was sent //@sender_business_bot_user_id If non-zero, the user identifier of the business bot that sent this message //@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead +//@paid_message_star_count The number of Telegram Stars the sender paid to send the message //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums //@effect_id Unique identifier of the effect added to the message; 0 if none @@ -2069,7 +2106,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2489,6 +2526,15 @@ publicChatTypeHasUsername = PublicChatType; publicChatTypeIsLocationBased = PublicChatType; +//@description Contains basic information about another user that started a chat with the current user +//@registration_month Month when the user was registered in Telegram; 0-12; may be 0 if unknown +//@registration_year Year when the user was registered in Telegram; 0-9999; may be 0 if unknown +//@phone_number_country_code A two-letter ISO 3166-1 alpha-2 country code based on the phone number of the user; may be empty if unknown +//@last_name_change_date Point in time (Unix timestamp) when the user changed name last time; 0 if unknown +//@last_photo_change_date Point in time (Unix timestamp) when the user changed photo last time; 0 if unknown +accountInfo registration_month:int32 registration_year:int32 phone_number_country_code:string last_name_change_date:int32 last_photo_change_date:int32 = AccountInfo; + + //@class ChatActionBar @description Describes actions which must be possible to do through a chat action bar //@description The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown @@ -2501,7 +2547,8 @@ chatActionBarInviteMembers = ChatActionBar; //@description The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method setMessageSenderBlockList, //-or the other user can be added to the contact list using the method addContact. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown //@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings -chatActionBarReportAddBlock can_unarchive:Bool = ChatActionBar; +//@account_info Basic information about the other user in the chat; may be null if unknown +chatActionBarReportAddBlock can_unarchive:Bool account_info:accountInfo = ChatActionBar; //@description The chat is a private or secret chat and the other user can be added to the contact list using the method addContact chatActionBarAddContact = ChatActionBar; @@ -4248,12 +4295,13 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only //@allow_paid_broadcast Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only +//@paid_message_star_count The number of Telegram Stars the user agreed to pay to send the messages //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum -//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled +//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. @@ -5221,6 +5269,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@description Describes a group call //@id Group call identifier +//@from_call_id Identifier of one-to-one call from which the group call was created; 0 if unknown //@title Group call title //@scheduled_start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended //@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call starts @@ -5241,7 +5290,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@record_duration Duration of the ongoing group call recording, in seconds; 0 if none. An updateGroupCall update is not triggered when value of this field changes, but the same recording goes on //@is_video_recorded True, if a video file is being recorded for the call //@duration Call duration, in seconds; for ended calls only -groupCall id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; +groupCall id:int32 from_call_id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; //@description Describes a group of video synchronization source identifiers @semantics The semantics of sources, one of "SIM" or "FID" @source_ids The list of synchronization source identifiers groupCallVideoSourceGroup semantics:string source_ids:vector = GroupCallVideoSourceGroup; @@ -6258,8 +6307,15 @@ premiumState state:formattedText payment_options:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; -//@description Sends messages from a quick reply shortcut. Requires Telegram Business subscription +//@description Sends messages from a quick reply shortcut. Requires Telegram Business subscription. Can't be used to send paid messages //@chat_id Identifier of the chat to which to send messages. The chat must be a private chat with a regular user //@shortcut_id Unique identifier of the quick reply shortcut //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates @@ -9374,7 +9463,8 @@ sendQuickReplyShortcutMessages chat_id:int53 shortcut_id:int32 sending_id:int32 //@chat_id Identifier of the chat to send messages //@message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order //@quote New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false -resendMessages chat_id:int53 message_ids:vector quote:inputTextQuote = Messages; +//@paid_message_star_count The number of Telegram Stars the user agreed to pay to send the messages. Ignored if messageSendingStateFailed.required_paid_message_star_count == 0 +resendMessages chat_id:int53 message_ids:vector quote:inputTextQuote paid_message_star_count:int53 = Messages; //@description Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats @chat_id Chat identifier sendChatScreenshotTakenNotification chat_id:int53 = Ok; @@ -10888,7 +10978,7 @@ processChatJoinRequests chat_id:int53 invite_link:string approve:Bool = Ok; //@user_id Identifier of the user to be called //@protocol The call protocols supported by the application //@is_video Pass true to create a video call -//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored +//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none createCall user_id:int53 protocol:callProtocol is_video:Bool group_call_id:int32 = CallId; //@description Accepts an incoming call @call_id Call identifier @protocol The call protocols supported by the application @@ -10960,7 +11050,8 @@ toggleGroupCallEnabledStartNotification group_call_id:int32 enabled_start_notifi //@is_muted Pass true to join the call with muted microphone //@is_my_video_enabled Pass true if the user's video is enabled //@invite_hash If non-empty, invite hash to be used to join the group call without being muted by administrators -joinGroupCall group_call_id:int32 participant_id:MessageSender audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool invite_hash:string = Text; +//@key_fingerprint Fingerprint of the encryption key for E2E group calls not bound to a chat; pass 0 for voice chats +joinGroupCall group_call_id:int32 participant_id:MessageSender audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool invite_hash:string key_fingerprint:int64 = Text; //@description Starts screen sharing in a joined group call. Returns join response payload for tgcalls //@group_call_id Group call identifier @@ -11117,7 +11208,9 @@ getCloseFriends = Users; //@description Changes a personal profile photo of a contact user @user_id User identifier @photo Profile photo to set; pass null to delete the photo; inputChatPhotoPrevious isn't supported in this function setUserPersonalProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; -//@description Suggests a profile photo to another regular user with common messages @user_id User identifier @photo Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function +//@description Suggests a profile photo to another regular user with common messages and allowing non-paid messages +//@user_id User identifier +//@photo Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function suggestUserProfilePhoto user_id:int53 photo:InputChatPhoto = Ok; //@description Toggles whether the bot can manage emoji status of the current user @bot_user_id User identifier of the bot @can_manage_emoji_status Pass true if the bot is allowed to change emoji status of the user; pass false otherwise @@ -11313,8 +11406,10 @@ removeRecentHashtag hashtag:string = Ok; //@link_preview_options Options to be used for generation of the link preview; pass null to use default link preview options getLinkPreview text:formattedText link_preview_options:linkPreviewOptions = LinkPreview; -//@description Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page @url The web page URL @force_full Pass true to get full instant view for the web page -getWebPageInstantView url:string force_full:Bool = WebPageInstantView; +//@description Returns an instant view version of a web page if available. This is an offline request if only_local is true. Returns a 404 error if the web page has no instant view page +//@url The web page URL +//@only_local Pass true to get only locally available information without sending network requests +getWebPageInstantView url:string only_local:Bool = WebPageInstantView; //@description Changes a profile photo for the current user @@ -11764,7 +11859,8 @@ getAvailableGifts = Gifts; //@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send //@owner_id Identifier of the user or the channel chat that will receive the gift -//@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed +//@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. +//-Must be empty if the receiver enabled paid messages //@is_private Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them //@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; @@ -11772,11 +11868,16 @@ sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool //@description Sells a gift for Telegram Stars @received_gift_id Identifier of the gift sellGift received_gift_id:string = Ok; -//@description Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the chat +//@description Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat //@received_gift_id Identifier of the gift //@is_saved Pass true to display the gift on the user's or the channel's profile page; pass false to remove it from the profile page toggleGiftIsSaved received_gift_id:string is_saved:Bool = Ok; +//@description Changes the list of pinned gifts on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat +//@owner_id Identifier of the user or the channel chat that received the gifts +//@received_gift_ids New list of pinned gifts. All gifts must be upgraded and saved on the profile page first. There can be up to getOption("pinned_gift_count_max") pinned gifts +setPinnedGifts owner_id:MessageSender received_gift_ids:vector = Ok; + //@description Toggles whether notifications for new gifts received by a channel chat are sent to the current user; requires can_post_messages administrator right in the chat //@chat_id Identifier of the channel chat //@are_enabled Pass true to enable notifications about new gifts owned by the channel chat; pass false to disable the notifications @@ -11930,6 +12031,20 @@ setNewChatPrivacySettings settings:newChatPrivacySettings = Ok; //@description Returns privacy settings for new chat creation getNewChatPrivacySettings = NewChatPrivacySettings; +//@description Returns the total number of Telegram Stars received by the current user for paid messages from the given user @user_id Identifier of the user +getPaidMessageRevenue user_id:int53 = StarCount; + +//@description Allows the specified user to send unpaid private messages to the current user by adding a rule to userPrivacySettingAllowUnpaidMessages +//@user_id Identifier of the user +//@refund_payments Pass true to refund the user previously paid messages +allowUnpaidMessagesFromUser user_id:int53 refund_payments:Bool = Ok; + +//@description Changes the amount of Telegram Stars that must be paid to send a message to a supergroup chat; requires can_restrict_members administrator right and supergroupFullInfo.can_enable_paid_messages +//@chat_id Identifier of the supergroup chat +//@paid_message_star_count The new number of Telegram Stars that must be paid for each message that is sent to the supergroup chat unless the sender is an administrator of the chat; 0-getOption("paid_message_star_count_max"). +//-The supergroup will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending +setChatPaidMessageStarCount chat_id:int53 paid_message_star_count:int53 = Ok; + //@description Check whether the current user can message another user or try to create a chat with them //@user_id Identifier of the other user @@ -12012,12 +12127,12 @@ getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueT //@description Returns detailed Telegram Star revenue statistics -//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true //@is_dark Pass true if a dark theme is used by the application getStarRevenueStatistics owner_id:MessageSender is_dark:Bool = StarRevenueStatistics; //@description Returns a URL for Telegram Star withdrawal -//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat //@star_count The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") //@password The 2-step verification password of the current user getStarWithdrawalUrl owner_id:MessageSender star_count:int53 password:string = HttpUrl; @@ -12273,9 +12388,12 @@ clickPremiumSubscriptionButton = Ok; //@description Returns state of Telegram Premium subscription and promotion videos for Premium features getPremiumState = PremiumState; -//@description Returns available options for Telegram Premium gift code or Telegram Premium giveaway creation -//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none -getPremiumGiftCodePaymentOptions boosted_chat_id:int53 = PremiumGiftCodePaymentOptions; +//@description Returns available options for gifting Telegram Premium to a user +getPremiumGiftPaymentOptions = PremiumGiftPaymentOptions; + +//@description Returns available options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user +getPremiumGiveawayPaymentOptions boosted_chat_id:int53 = PremiumGiveawayPaymentOptions; //@description Return information about a Telegram Premium gift code @code The code to check checkPremiumGiftCode code:string = PremiumGiftCodeInfo; @@ -12306,7 +12424,7 @@ getStarGiveawayPaymentOptions = StarGiveawayPaymentOptions; //@description Returns the list of Telegram Star transactions for the specified owner //@owner_id Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, -//-or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true +//-or identifier of a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true //@subscription_id If non-empty, only transactions related to the Star Subscription will be returned //@direction Direction of the transactions to receive; pass null to get all transactions //@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results