From 969ddb47467c4fa95337eaf250269fd7000058dd Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 9 May 2025 14:42:54 +0800 Subject: [PATCH 01/11] Update to TDLib 1.8.49 --- client/function.go | 135 +++++++++- client/type.go | 600 +++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 298 ++++++++++++++++++++- data/td_api.tl | 155 +++++++++-- 4 files changed, 1125 insertions(+), 63 deletions(-) diff --git a/client/function.go b/client/function.go index ed53166..1102459 100755 --- a/client/function.go +++ b/client/function.go @@ -8708,6 +8708,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(result.Data) + case TypeInternalLinkTypeMyStars: + return UnmarshalInternalLinkTypeMyStars(result.Data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(result.Data) @@ -19163,6 +19166,35 @@ func (client *Client) ToggleSupergroupCanHaveSponsoredMessages(req *ToggleSuperg return UnmarshalOk(result.Data) } +type ToggleSupergroupHasAutomaticTranslationRequest struct { + // The identifier of the channel + SupergroupId int64 `json:"supergroup_id"` + // The new value of has_automatic_translation + HasAutomaticTranslation bool `json:"has_automatic_translation"` +} + +// Toggles whether messages are automatically translated in the channel chat; requires can_change_info administrator right in the channel. The chat must have at least chatBoostFeatures.min_automatic_translation_boost_level boost level to enable automatic translation +func (client *Client) ToggleSupergroupHasAutomaticTranslation(req *ToggleSupergroupHasAutomaticTranslationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupHasAutomaticTranslation", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "has_automatic_translation": req.HasAutomaticTranslation, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupHasHiddenMembersRequest struct { // Identifier of the supergroup SupergroupId int64 `json:"supergroup_id"` @@ -19670,7 +19702,7 @@ func (client *Client) SetGiftSettings(req *SetGiftSettingsRequest) (*Ok, error) } // Returns gifts that can be sent to other users and channel chats -func (client *Client) GetAvailableGifts() (*Gifts, error) { +func (client *Client) GetAvailableGifts() (*AvailableGifts, error) { result, err := client.Send(Request{ meta: meta{ Type: "getAvailableGifts", @@ -19685,7 +19717,7 @@ func (client *Client) GetAvailableGifts() (*Gifts, error) { return nil, buildResponseError(result.Data) } - return UnmarshalGifts(result.Data) + return UnmarshalAvailableGifts(result.Data) } type SendGiftRequest struct { @@ -19938,6 +19970,38 @@ func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SendResoldGiftRequest struct { + // Name of the upgraded gift to send + GiftName string `json:"gift_name"` + // Identifier of the user or the channel chat that will receive the gift + OwnerId MessageSender `json:"owner_id"` + // The amount of Telegram Stars required to pay for the gift + StarCount int64 `json:"star_count"` +} + +// Sends an upgraded gift that is available for resale to another user or channel chat; gifts already owned by the current user must be transferred using transferGift and can't be passed to the method +func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendResoldGift", + }, + Data: map[string]interface{}{ + "gift_name": req.GiftName, + "owner_id": req.OwnerId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetReceivedGiftsRequest struct { // Unique identifier of business connection on behalf of which to send the request; for bots only BusinessConnectionId string `json:"business_connection_id"` @@ -20072,6 +20136,73 @@ func (client *Client) GetUpgradedGiftWithdrawalUrl(req *GetUpgradedGiftWithdrawa return UnmarshalHttpUrl(result.Data) } +type SetGiftResalePriceRequest struct { + // Identifier of the unique gift + ReceivedGiftId string `json:"received_gift_id"` + // The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift + ResaleStarCount int64 `json:"resale_star_count"` +} + +// Changes resale price of a unique gift owned by the current user +func (client *Client) SetGiftResalePrice(req *SetGiftResalePriceRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftResalePrice", + }, + Data: map[string]interface{}{ + "received_gift_id": req.ReceivedGiftId, + "resale_star_count": req.ResaleStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SearchGiftsForResaleRequest struct { + // Identifier of the regular gift that was upgraded to a unique gift + GiftId JsonInt64 `json:"gift_id"` + // Order in which the results will be sorted + Order GiftForResaleOrder `json:"order"` + // Attributes used to filter received gifts. If multiple attributes of the same type are specified, then all of them are allowed. If none attributes of specific type are specified, then all values for this attribute type are allowed + Attributes []UpgradedGiftAttributeId `json:"attributes"` + // Offset of the first entry to return as received from the previous request with the same order and attributes; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of gifts to return + Limit int32 `json:"limit"` +} + +// Returns upgraded gifts that can be bought from other owners +func (client *Client) SearchGiftsForResale(req *SearchGiftsForResaleRequest) (*GiftsForResale, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchGiftsForResale", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + "order": req.Order, + "attributes": req.Attributes, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftsForResale(result.Data) +} + type CreateInvoiceLinkRequest struct { // Unique identifier of business connection on behalf of which to send the request BusinessConnectionId string `json:"business_connection_id"` diff --git a/client/type.go b/client/type.go index 1848a98..ab92cfc 100755 --- a/client/type.go +++ b/client/type.go @@ -26,6 +26,8 @@ const ( ClassStarSubscriptionType = "StarSubscriptionType" ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassUpgradedGiftAttributeId = "UpgradedGiftAttributeId" + ClassGiftForResaleOrder = "GiftForResaleOrder" ClassSentGift = "SentGift" ClassStarTransactionDirection = "StarTransactionDirection" ClassStarTransactionType = "StarTransactionType" @@ -280,9 +282,15 @@ const ( ClassUpgradedGiftBackdrop = "UpgradedGiftBackdrop" ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" ClassGift = "Gift" - ClassGifts = "Gifts" ClassUpgradedGift = "UpgradedGift" ClassUpgradeGiftResult = "UpgradeGiftResult" + ClassAvailableGift = "AvailableGift" + ClassAvailableGifts = "AvailableGifts" + ClassUpgradedGiftModelCount = "UpgradedGiftModelCount" + ClassUpgradedGiftSymbolCount = "UpgradedGiftSymbolCount" + ClassUpgradedGiftBackdropCount = "UpgradedGiftBackdropCount" + ClassGiftForResale = "GiftForResale" + ClassGiftsForResale = "GiftsForResale" ClassReceivedGift = "ReceivedGift" ClassReceivedGifts = "ReceivedGifts" ClassGiftUpgradePreview = "GiftUpgradePreview" @@ -798,9 +806,21 @@ const ( TypeUpgradedGiftBackdrop = "upgradedGiftBackdrop" TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" TypeGift = "gift" - TypeGifts = "gifts" TypeUpgradedGift = "upgradedGift" TypeUpgradeGiftResult = "upgradeGiftResult" + TypeAvailableGift = "availableGift" + TypeAvailableGifts = "availableGifts" + TypeUpgradedGiftAttributeIdModel = "upgradedGiftAttributeIdModel" + TypeUpgradedGiftAttributeIdSymbol = "upgradedGiftAttributeIdSymbol" + TypeUpgradedGiftAttributeIdBackdrop = "upgradedGiftAttributeIdBackdrop" + TypeUpgradedGiftModelCount = "upgradedGiftModelCount" + TypeUpgradedGiftSymbolCount = "upgradedGiftSymbolCount" + TypeUpgradedGiftBackdropCount = "upgradedGiftBackdropCount" + TypeGiftForResaleOrderPrice = "giftForResaleOrderPrice" + TypeGiftForResaleOrderPriceChangeDate = "giftForResaleOrderPriceChangeDate" + TypeGiftForResaleOrderNumber = "giftForResaleOrderNumber" + TypeGiftForResale = "giftForResale" + TypeGiftsForResale = "giftsForResale" TypeSentGiftRegular = "sentGiftRegular" TypeSentGiftUpgraded = "sentGiftUpgraded" TypeReceivedGift = "receivedGift" @@ -831,6 +851,8 @@ const ( TypeStarTransactionTypeGiftTransfer = "starTransactionTypeGiftTransfer" TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" TypeStarTransactionTypeGiftUpgrade = "starTransactionTypeGiftUpgrade" + TypeStarTransactionTypeUpgradedGiftPurchase = "starTransactionTypeUpgradedGiftPurchase" + TypeStarTransactionTypeUpgradedGiftSale = "starTransactionTypeUpgradedGiftSale" TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" @@ -1701,6 +1723,7 @@ const ( TypeChatEventHasAggressiveAntiSpamEnabledToggled = "chatEventHasAggressiveAntiSpamEnabledToggled" TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled" TypeChatEventShowMessageSenderToggled = "chatEventShowMessageSenderToggled" + TypeChatEventAutomaticTranslationToggled = "chatEventAutomaticTranslationToggled" TypeChatEventInviteLinkEdited = "chatEventInviteLinkEdited" TypeChatEventInviteLinkRevoked = "chatEventInviteLinkRevoked" TypeChatEventInviteLinkDeleted = "chatEventInviteLinkDeleted" @@ -2033,6 +2056,7 @@ const ( TypeInternalLinkTypeMainWebApp = "internalLinkTypeMainWebApp" TypeInternalLinkTypeMessage = "internalLinkTypeMessage" TypeInternalLinkTypeMessageDraft = "internalLinkTypeMessageDraft" + TypeInternalLinkTypeMyStars = "internalLinkTypeMyStars" TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" @@ -2141,6 +2165,7 @@ const ( TypeSuggestedActionSetProfilePhoto = "suggestedActionSetProfilePhoto" TypeSuggestedActionExtendPremium = "suggestedActionExtendPremium" TypeSuggestedActionExtendStarSubscriptions = "suggestedActionExtendStarSubscriptions" + TypeSuggestedActionCustom = "suggestedActionCustom" TypeCount = "count" TypeText = "text" TypeData = "data" @@ -2464,6 +2489,16 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Contains identifier of an upgraded gift attribute to search for +type UpgradedGiftAttributeId interface { + UpgradedGiftAttributeIdType() string +} + +// Describes order in which upgraded gifts for resale will be sorted +type GiftForResaleOrder interface { + GiftForResaleOrderType() string +} + // Represents content of a gift received by a user or a channel chat type SentGift interface { SentGiftType() string @@ -8766,6 +8801,8 @@ func (*UpgradedGiftBackdropColors) GetType() string { // Describes a backdrop of an upgraded gift type UpgradedGiftBackdrop struct { meta + // Unique identifier of the backdrop + Id int32 `json:"id"` // Name of the backdrop Name string `json:"name"` // Colors of the backdrop @@ -8885,29 +8922,6 @@ func (*Gift) GetType() string { return TypeGift } -// Contains a list of gifts that can be sent to another user or channel chat -type Gifts struct { - meta - // The list of gifts - Gifts []*Gift `json:"gifts"` -} - -func (entity *Gifts) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Gifts - - return json.Marshal((*stub)(entity)) -} - -func (*Gifts) GetClass() string { - return ClassGifts -} - -func (*Gifts) GetType() string { - return TypeGifts -} - // Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT type UpgradedGift struct { meta @@ -8915,7 +8929,7 @@ type UpgradedGift struct { Id JsonInt64 `json:"id"` // The title of the upgraded gift Title string `json:"title"` - // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift + // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift Name string `json:"name"` // Unique number of the upgraded gift among gifts upgraded from the same gift Number int32 `json:"number"` @@ -8939,6 +8953,8 @@ type UpgradedGift struct { Backdrop *UpgradedGiftBackdrop `json:"backdrop"` // Information about the originally sent gift; may be null if unknown OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` + // Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible + ResaleStarCount int64 `json:"resale_star_count"` } func (entity *UpgradedGift) MarshalJSON() ([]byte, error) { @@ -8973,6 +8989,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { Symbol *UpgradedGiftSymbol `json:"symbol"` Backdrop *UpgradedGiftBackdrop `json:"backdrop"` OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` + ResaleStarCount int64 `json:"resale_star_count"` } err := json.Unmarshal(data, &tmp) @@ -8993,6 +9010,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { upgradedGift.Symbol = tmp.Symbol upgradedGift.Backdrop = tmp.Backdrop upgradedGift.OriginalDetails = tmp.OriginalDetails + upgradedGift.ResaleStarCount = tmp.ResaleStarCount fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) upgradedGift.OwnerId = fieldOwnerId @@ -9013,6 +9031,10 @@ type UpgradeGiftResult struct { CanBeTransferred bool `json:"can_be_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT ExportDate int32 `json:"export_date"` } @@ -9033,6 +9055,347 @@ func (*UpgradeGiftResult) GetType() string { return TypeUpgradeGiftResult } +// Describes a gift that is available for purchase +type AvailableGift struct { + meta + // The gift + Gift *Gift `json:"gift"` + // Number of gifts that are available for resale + ResaleCount int32 `json:"resale_count"` + // The minimum price for the gifts available for resale; 0 if there are no such gifts + MinResaleStarCount int64 `json:"min_resale_star_count"` + // The title of the upgraded gift; empty if the gift isn't available for resale + Title string `json:"title"` +} + +func (entity *AvailableGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AvailableGift + + return json.Marshal((*stub)(entity)) +} + +func (*AvailableGift) GetClass() string { + return ClassAvailableGift +} + +func (*AvailableGift) GetType() string { + return TypeAvailableGift +} + +// Contains a list of gifts that can be sent to another user or channel chat +type AvailableGifts struct { + meta + // The list of gifts + Gifts []*AvailableGift `json:"gifts"` +} + +func (entity *AvailableGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AvailableGifts + + return json.Marshal((*stub)(entity)) +} + +func (*AvailableGifts) GetClass() string { + return ClassAvailableGifts +} + +func (*AvailableGifts) GetType() string { + return TypeAvailableGifts +} + +// Identifier of a gift model +type UpgradedGiftAttributeIdModel struct { + meta + // Identifier of the sticker representing the model + StickerId JsonInt64 `json:"sticker_id"` +} + +func (entity *UpgradedGiftAttributeIdModel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdModel + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdModel) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdModel) GetType() string { + return TypeUpgradedGiftAttributeIdModel +} + +func (*UpgradedGiftAttributeIdModel) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdModel +} + +// Identifier of a gift symbol +type UpgradedGiftAttributeIdSymbol struct { + meta + // Identifier of the sticker representing the symbol + StickerId JsonInt64 `json:"sticker_id"` +} + +func (entity *UpgradedGiftAttributeIdSymbol) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdSymbol + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdSymbol) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdSymbol) GetType() string { + return TypeUpgradedGiftAttributeIdSymbol +} + +func (*UpgradedGiftAttributeIdSymbol) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdSymbol +} + +// Identifier of a gift backdrop +type UpgradedGiftAttributeIdBackdrop struct { + meta + // Identifier of the backdrop + BackdropId int32 `json:"backdrop_id"` +} + +func (entity *UpgradedGiftAttributeIdBackdrop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdBackdrop + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdBackdrop) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdBackdrop) GetType() string { + return TypeUpgradedGiftAttributeIdBackdrop +} + +func (*UpgradedGiftAttributeIdBackdrop) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdBackdrop +} + +// Describes a model of an upgraded gift with the number of gifts found +type UpgradedGiftModelCount struct { + meta + // The model + Model *UpgradedGiftModel `json:"model"` + // Total number of gifts with the model + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftModelCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftModelCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftModelCount) GetClass() string { + return ClassUpgradedGiftModelCount +} + +func (*UpgradedGiftModelCount) GetType() string { + return TypeUpgradedGiftModelCount +} + +// Describes a symbol shown on the pattern of an upgraded gift +type UpgradedGiftSymbolCount struct { + meta + // The symbol + Symbol *UpgradedGiftSymbol `json:"symbol"` + // Total number of gifts with the symbol + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftSymbolCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftSymbolCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftSymbolCount) GetClass() string { + return ClassUpgradedGiftSymbolCount +} + +func (*UpgradedGiftSymbolCount) GetType() string { + return TypeUpgradedGiftSymbolCount +} + +// Describes a backdrop of an upgraded gift +type UpgradedGiftBackdropCount struct { + meta + // The backdrop + Backdrop *UpgradedGiftBackdrop `json:"backdrop"` + // Total number of gifts with the symbol + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftBackdropCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftBackdropCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftBackdropCount) GetClass() string { + return ClassUpgradedGiftBackdropCount +} + +func (*UpgradedGiftBackdropCount) GetType() string { + return TypeUpgradedGiftBackdropCount +} + +// The gifts will be sorted by their price from the lowest to the highest +type GiftForResaleOrderPrice struct{ + meta +} + +func (entity *GiftForResaleOrderPrice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderPrice + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderPrice) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderPrice) GetType() string { + return TypeGiftForResaleOrderPrice +} + +func (*GiftForResaleOrderPrice) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderPrice +} + +// The gifts will be sorted by the last date when their price was changed from the newest to the oldest +type GiftForResaleOrderPriceChangeDate struct{ + meta +} + +func (entity *GiftForResaleOrderPriceChangeDate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderPriceChangeDate + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderPriceChangeDate) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderPriceChangeDate) GetType() string { + return TypeGiftForResaleOrderPriceChangeDate +} + +func (*GiftForResaleOrderPriceChangeDate) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderPriceChangeDate +} + +// The gifts will be sorted by their number from the smallest to the largest +type GiftForResaleOrderNumber struct{ + meta +} + +func (entity *GiftForResaleOrderNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderNumber + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderNumber) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderNumber) GetType() string { + return TypeGiftForResaleOrderNumber +} + +func (*GiftForResaleOrderNumber) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderNumber +} + +// Describes a gift available for resale +type GiftForResale struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // Unique identifier of the received gift for the current user; only for the gifts owned by the current user + ReceivedGiftId string `json:"received_gift_id"` +} + +func (entity *GiftForResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResale + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResale) GetClass() string { + return ClassGiftForResale +} + +func (*GiftForResale) GetType() string { + return TypeGiftForResale +} + +// Describes gifts available for resale +type GiftsForResale struct { + meta + // Total number of gifts found + TotalCount int32 `json:"total_count"` + // The gifts + Gifts []*GiftForResale `json:"gifts"` + // Available models; for searchGiftsForResale requests without offset and attributes only + Models []*UpgradedGiftModelCount `json:"models"` + // Available symbols; for searchGiftsForResale requests without offset and attributes only + Symbols []*UpgradedGiftSymbolCount `json:"symbols"` + // Available backdrops; for searchGiftsForResale requests without offset and attributes only + Backdrops []*UpgradedGiftBackdropCount `json:"backdrops"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *GiftsForResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftsForResale + + return json.Marshal((*stub)(entity)) +} + +func (*GiftsForResale) GetClass() string { + return ClassGiftsForResale +} + +func (*GiftsForResale) GetType() string { + return TypeGiftsForResale +} + // Regular gift type SentGiftRegular struct { meta @@ -9118,6 +9481,10 @@ type ReceivedGift struct { PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -9154,6 +9521,8 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` TransferStarCount int64 `json:"transfer_star_count"` + NextTransferDate int32 `json:"next_transfer_date"` + NextResaleDate int32 `json:"next_resale_date"` ExportDate int32 `json:"export_date"` } @@ -9174,6 +9543,8 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { receivedGift.SellStarCount = tmp.SellStarCount receivedGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount receivedGift.TransferStarCount = tmp.TransferStarCount + receivedGift.NextTransferDate = tmp.NextTransferDate + receivedGift.NextResaleDate = tmp.NextResaleDate receivedGift.ExportDate = tmp.ExportDate fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) @@ -10092,6 +10463,66 @@ func (*StarTransactionTypeGiftUpgrade) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftUpgrade } +// The transaction is a purchase of an upgraded gift for some user or channel; for regular users only +type StarTransactionTypeUpgradedGiftPurchase struct { + meta + // Identifier of the user that sold the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeUpgradedGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUpgradedGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUpgradedGiftPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUpgradedGiftPurchase) GetType() string { + return TypeStarTransactionTypeUpgradedGiftPurchase +} + +func (*StarTransactionTypeUpgradedGiftPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeUpgradedGiftPurchase +} + +// The transaction is a sale of an upgraded gift; for regular users only +type StarTransactionTypeUpgradedGiftSale struct { + meta + // Identifier of the user that bought the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` + // Information about commission received by Telegram from the transaction + Affiliate *AffiliateInfo `json:"affiliate"` +} + +func (entity *StarTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUpgradedGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUpgradedGiftSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUpgradedGiftSale) GetType() string { + return TypeStarTransactionTypeUpgradedGiftSale +} + +func (*StarTransactionTypeUpgradedGiftSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeUpgradedGiftSale +} + // The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only type StarTransactionTypeChannelPaidReactionSend struct { meta @@ -12712,6 +13143,8 @@ type Supergroup struct { MemberCount int32 `json:"member_count"` // Approximate boost level for the chat BoostLevel int32 `json:"boost_level"` + // True, if automatic translation of messages is enabled in the channel + HasAutomaticTranslation bool `json:"has_automatic_translation"` // True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel HasLinkedChat bool `json:"has_linked_chat"` // True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup @@ -12771,6 +13204,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { Status json.RawMessage `json:"status"` MemberCount int32 `json:"member_count"` BoostLevel int32 `json:"boost_level"` + HasAutomaticTranslation bool `json:"has_automatic_translation"` HasLinkedChat bool `json:"has_linked_chat"` HasLocation bool `json:"has_location"` SignMessages bool `json:"sign_messages"` @@ -12800,6 +13234,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.Date = tmp.Date supergroup.MemberCount = tmp.MemberCount supergroup.BoostLevel = tmp.BoostLevel + supergroup.HasAutomaticTranslation = tmp.HasAutomaticTranslation supergroup.HasLinkedChat = tmp.HasLinkedChat supergroup.HasLocation = tmp.HasLocation supergroup.SignMessages = tmp.SignMessages @@ -28100,7 +28535,7 @@ type MessageUpgradedGift struct { SenderId MessageSender `json:"sender_id"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` @@ -28108,8 +28543,14 @@ type MessageUpgradedGift struct { CanBeTransferred bool `json:"can_be_transferred"` // True, if the gift was transferred to another owner; only for the receiver of the gift WasTransferred bool `json:"was_transferred"` + // Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred + LastResaleStarCount int64 `json:"last_resale_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -28143,7 +28584,10 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error IsSaved bool `json:"is_saved"` CanBeTransferred bool `json:"can_be_transferred"` WasTransferred bool `json:"was_transferred"` + LastResaleStarCount int64 `json:"last_resale_star_count"` TransferStarCount int64 `json:"transfer_star_count"` + NextTransferDate int32 `json:"next_transfer_date"` + NextResaleDate int32 `json:"next_resale_date"` ExportDate int32 `json:"export_date"` } @@ -28158,7 +28602,10 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error messageUpgradedGift.IsSaved = tmp.IsSaved messageUpgradedGift.CanBeTransferred = tmp.CanBeTransferred messageUpgradedGift.WasTransferred = tmp.WasTransferred + messageUpgradedGift.LastResaleStarCount = tmp.LastResaleStarCount messageUpgradedGift.TransferStarCount = tmp.TransferStarCount + messageUpgradedGift.NextTransferDate = tmp.NextTransferDate + messageUpgradedGift.NextResaleDate = tmp.NextResaleDate messageUpgradedGift.ExportDate = tmp.ExportDate fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) @@ -28174,7 +28621,7 @@ type MessageRefundedUpgradedGift struct { Gift *Gift `json:"gift"` // Sender of the gift SenderId MessageSender `json:"sender_id"` - // True, if the gift was obtained by upgrading of a previously received gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` } @@ -34116,6 +34563,8 @@ type ChatBoostLevelFeatures struct { CanSetCustomBackground bool `json:"can_set_custom_background"` // True, if custom emoji sticker set can be set for the chat CanSetCustomEmojiStickerSet bool `json:"can_set_custom_emoji_sticker_set"` + // True, if automatic translation of messages can be enabled in the chat + CanEnableAutomaticTranslation bool `json:"can_enable_automatic_translation"` // True, if speech recognition can be used for video note and voice note messages by all users CanRecognizeSpeech bool `json:"can_recognize_speech"` // True, if sponsored messages can be disabled in the chat @@ -34155,6 +34604,8 @@ type ChatBoostFeatures struct { MinCustomBackgroundBoostLevel int32 `json:"min_custom_background_boost_level"` // The minimum boost level required to set custom emoji sticker set for the chat; for supergroup chats only MinCustomEmojiStickerSetBoostLevel int32 `json:"min_custom_emoji_sticker_set_boost_level"` + // The minimum boost level allowing to enable automatic translation of messages for non-Premium users; for channel chats only + MinAutomaticTranslationBoostLevel int32 `json:"min_automatic_translation_boost_level"` // The minimum boost level allowing to recognize speech in video note and voice note messages for non-Premium users; for supergroup chats only MinSpeechRecognitionBoostLevel int32 `json:"min_speech_recognition_boost_level"` // The minimum boost level allowing to disable sponsored messages in the chat; for channel chats only @@ -39936,6 +40387,33 @@ func (*ChatEventShowMessageSenderToggled) ChatEventActionType() string { return TypeChatEventShowMessageSenderToggled } +// The has_automatic_translation setting of a channel was toggled +type ChatEventAutomaticTranslationToggled struct { + meta + // New value of has_automatic_translation + HasAutomaticTranslation bool `json:"has_automatic_translation"` +} + +func (entity *ChatEventAutomaticTranslationToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventAutomaticTranslationToggled + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventAutomaticTranslationToggled) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventAutomaticTranslationToggled) GetType() string { + return TypeChatEventAutomaticTranslationToggled +} + +func (*ChatEventAutomaticTranslationToggled) ChatEventActionType() string { + return TypeChatEventAutomaticTranslationToggled +} + // A chat invite link was edited type ChatEventInviteLinkEdited struct { meta @@ -44061,8 +44539,10 @@ func (*Hashtags) GetType() string { } // A story can be sent -type CanPostStoryResultOk struct{ +type CanPostStoryResultOk struct { meta + // Number of stories that can be posted by the user + StoryCount int32 `json:"story_count"` } func (entity *CanPostStoryResultOk) MarshalJSON() ([]byte, error) { @@ -45191,7 +45671,7 @@ func (*PushMessageContentGift) PushMessageContentType() string { // A message with an upgraded gift type PushMessageContentUpgradedGift struct { meta - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` } @@ -49413,6 +49893,31 @@ func (*InternalLinkTypeMessageDraft) InternalLinkTypeType() string { return TypeInternalLinkTypeMessageDraft } +// The link is a link to the screen with information about Telegram Star balance and transactions of the current user +type InternalLinkTypeMyStars struct{ + meta +} + +func (entity *InternalLinkTypeMyStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeMyStars + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeMyStars) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeMyStars) GetType() string { + return TypeInternalLinkTypeMyStars +} + +func (*InternalLinkTypeMyStars) InternalLinkTypeType() string { + return TypeInternalLinkTypeMyStars +} + // The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it type InternalLinkTypePassportDataRequest struct { meta @@ -52402,6 +52907,39 @@ func (*SuggestedActionExtendStarSubscriptions) SuggestedActionType() string { return TypeSuggestedActionExtendStarSubscriptions } +// A custom suggestion to be shown at the top of the chat list +type SuggestedActionCustom struct { + meta + // Unique name of the suggestion + Name string `json:"name"` + // Title of the suggestion + Title *FormattedText `json:"title"` + // Description of the suggestion + Description *FormattedText `json:"description"` + // The link to open when the suggestion is clicked + Url string `json:"url"` +} + +func (entity *SuggestedActionCustom) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionCustom + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionCustom) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionCustom) GetType() string { + return TypeSuggestedActionCustom +} + +func (*SuggestedActionCustom) SuggestedActionType() string { + return TypeSuggestedActionCustom +} + // Contains a counter type Count struct { meta @@ -54003,7 +54541,7 @@ func (*VectorPathCommandLine) VectorPathCommandType() string { return TypeVectorPathCommandLine } -// A cubic Bézier curve to a given point +// A cubic Bézier curve to a given point type VectorPathCommandCubicBezierCurve struct { meta // The start control point of the curve diff --git a/client/unmarshaler.go b/client/unmarshaler.go index dd0a41a..d5efa81 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -770,6 +770,80 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalUpgradedGiftAttributeId(data json.RawMessage) (UpgradedGiftAttributeId, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUpgradedGiftAttributeIdModel: + return UnmarshalUpgradedGiftAttributeIdModel(data) + + case TypeUpgradedGiftAttributeIdSymbol: + return UnmarshalUpgradedGiftAttributeIdSymbol(data) + + case TypeUpgradedGiftAttributeIdBackdrop: + return UnmarshalUpgradedGiftAttributeIdBackdrop(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUpgradedGiftAttributeId(dataList []json.RawMessage) ([]UpgradedGiftAttributeId, error) { + list := []UpgradedGiftAttributeId{} + + for _, data := range dataList { + entity, err := UnmarshalUpgradedGiftAttributeId(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGiftForResaleOrder(data json.RawMessage) (GiftForResaleOrder, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftForResaleOrderPrice: + return UnmarshalGiftForResaleOrderPrice(data) + + case TypeGiftForResaleOrderPriceChangeDate: + return UnmarshalGiftForResaleOrderPriceChangeDate(data) + + case TypeGiftForResaleOrderNumber: + return UnmarshalGiftForResaleOrderNumber(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftForResaleOrder(dataList []json.RawMessage) ([]GiftForResaleOrder, error) { + list := []GiftForResaleOrder{} + + for _, data := range dataList { + entity, err := UnmarshalGiftForResaleOrder(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSentGift(data json.RawMessage) (SentGift, error) { var meta meta @@ -916,6 +990,12 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: + return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) + + case TypeStarTransactionTypeUpgradedGiftSale: + return UnmarshalStarTransactionTypeUpgradedGiftSale(data) + case TypeStarTransactionTypeChannelPaidReactionSend: return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) @@ -5410,6 +5490,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventShowMessageSenderToggled: return UnmarshalChatEventShowMessageSenderToggled(data) + case TypeChatEventAutomaticTranslationToggled: + return UnmarshalChatEventAutomaticTranslationToggled(data) + case TypeChatEventInviteLinkEdited: return UnmarshalChatEventInviteLinkEdited(data) @@ -7231,6 +7314,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(data) + case TypeInternalLinkTypeMyStars: + return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -7750,6 +7836,9 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionExtendStarSubscriptions: return UnmarshalSuggestedActionExtendStarSubscriptions(data) + case TypeSuggestedActionCustom: + return UnmarshalSuggestedActionCustom(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -10123,14 +10212,6 @@ func UnmarshalGift(data json.RawMessage) (*Gift, error) { return &resp, err } -func UnmarshalGifts(data json.RawMessage) (*Gifts, error) { - var resp Gifts - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalUpgradedGift(data json.RawMessage) (*UpgradedGift, error) { var resp UpgradedGift @@ -10147,6 +10228,110 @@ func UnmarshalUpgradeGiftResult(data json.RawMessage) (*UpgradeGiftResult, error return &resp, err } +func UnmarshalAvailableGift(data json.RawMessage) (*AvailableGift, error) { + var resp AvailableGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAvailableGifts(data json.RawMessage) (*AvailableGifts, error) { + var resp AvailableGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdModel(data json.RawMessage) (*UpgradedGiftAttributeIdModel, error) { + var resp UpgradedGiftAttributeIdModel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdSymbol(data json.RawMessage) (*UpgradedGiftAttributeIdSymbol, error) { + var resp UpgradedGiftAttributeIdSymbol + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdBackdrop(data json.RawMessage) (*UpgradedGiftAttributeIdBackdrop, error) { + var resp UpgradedGiftAttributeIdBackdrop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftModelCount(data json.RawMessage) (*UpgradedGiftModelCount, error) { + var resp UpgradedGiftModelCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftSymbolCount(data json.RawMessage) (*UpgradedGiftSymbolCount, error) { + var resp UpgradedGiftSymbolCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftBackdropCount(data json.RawMessage) (*UpgradedGiftBackdropCount, error) { + var resp UpgradedGiftBackdropCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderPrice(data json.RawMessage) (*GiftForResaleOrderPrice, error) { + var resp GiftForResaleOrderPrice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderPriceChangeDate(data json.RawMessage) (*GiftForResaleOrderPriceChangeDate, error) { + var resp GiftForResaleOrderPriceChangeDate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderNumber(data json.RawMessage) (*GiftForResaleOrderNumber, error) { + var resp GiftForResaleOrderNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResale(data json.RawMessage) (*GiftForResale, error) { + var resp GiftForResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftsForResale(data json.RawMessage) (*GiftsForResale, error) { + var resp GiftsForResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSentGiftRegular(data json.RawMessage) (*SentGiftRegular, error) { var resp SentGiftRegular @@ -10387,6 +10572,22 @@ func UnmarshalStarTransactionTypeGiftUpgrade(data json.RawMessage) (*StarTransac return &resp, err } +func UnmarshalStarTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*StarTransactionTypeUpgradedGiftPurchase, error) { + var resp StarTransactionTypeUpgradedGiftPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeUpgradedGiftSale(data json.RawMessage) (*StarTransactionTypeUpgradedGiftSale, error) { + var resp StarTransactionTypeUpgradedGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeChannelPaidReactionSend(data json.RawMessage) (*StarTransactionTypeChannelPaidReactionSend, error) { var resp StarTransactionTypeChannelPaidReactionSend @@ -17347,6 +17548,14 @@ func UnmarshalChatEventShowMessageSenderToggled(data json.RawMessage) (*ChatEven return &resp, err } +func UnmarshalChatEventAutomaticTranslationToggled(data json.RawMessage) (*ChatEventAutomaticTranslationToggled, error) { + var resp ChatEventAutomaticTranslationToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventInviteLinkEdited(data json.RawMessage) (*ChatEventInviteLinkEdited, error) { var resp ChatEventInviteLinkEdited @@ -20003,6 +20212,14 @@ func UnmarshalInternalLinkTypeMessageDraft(data json.RawMessage) (*InternalLinkT return &resp, err } +func UnmarshalInternalLinkTypeMyStars(data json.RawMessage) (*InternalLinkTypeMyStars, error) { + var resp InternalLinkTypeMyStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypePassportDataRequest(data json.RawMessage) (*InternalLinkTypePassportDataRequest, error) { var resp InternalLinkTypePassportDataRequest @@ -20867,6 +21084,14 @@ func UnmarshalSuggestedActionExtendStarSubscriptions(data json.RawMessage) (*Sug return &resp, err } +func UnmarshalSuggestedActionCustom(data json.RawMessage) (*SuggestedActionCustom, error) { + var resp SuggestedActionCustom + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCount(data json.RawMessage) (*Count, error) { var resp Count @@ -23227,15 +23452,51 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGift: return UnmarshalGift(data) - case TypeGifts: - return UnmarshalGifts(data) - case TypeUpgradedGift: return UnmarshalUpgradedGift(data) case TypeUpgradeGiftResult: return UnmarshalUpgradeGiftResult(data) + case TypeAvailableGift: + return UnmarshalAvailableGift(data) + + case TypeAvailableGifts: + return UnmarshalAvailableGifts(data) + + case TypeUpgradedGiftAttributeIdModel: + return UnmarshalUpgradedGiftAttributeIdModel(data) + + case TypeUpgradedGiftAttributeIdSymbol: + return UnmarshalUpgradedGiftAttributeIdSymbol(data) + + case TypeUpgradedGiftAttributeIdBackdrop: + return UnmarshalUpgradedGiftAttributeIdBackdrop(data) + + case TypeUpgradedGiftModelCount: + return UnmarshalUpgradedGiftModelCount(data) + + case TypeUpgradedGiftSymbolCount: + return UnmarshalUpgradedGiftSymbolCount(data) + + case TypeUpgradedGiftBackdropCount: + return UnmarshalUpgradedGiftBackdropCount(data) + + case TypeGiftForResaleOrderPrice: + return UnmarshalGiftForResaleOrderPrice(data) + + case TypeGiftForResaleOrderPriceChangeDate: + return UnmarshalGiftForResaleOrderPriceChangeDate(data) + + case TypeGiftForResaleOrderNumber: + return UnmarshalGiftForResaleOrderNumber(data) + + case TypeGiftForResale: + return UnmarshalGiftForResale(data) + + case TypeGiftsForResale: + return UnmarshalGiftsForResale(data) + case TypeSentGiftRegular: return UnmarshalSentGiftRegular(data) @@ -23326,6 +23587,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: + return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) + + case TypeStarTransactionTypeUpgradedGiftSale: + return UnmarshalStarTransactionTypeUpgradedGiftSale(data) + case TypeStarTransactionTypeChannelPaidReactionSend: return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) @@ -25936,6 +26203,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventShowMessageSenderToggled: return UnmarshalChatEventShowMessageSenderToggled(data) + case TypeChatEventAutomaticTranslationToggled: + return UnmarshalChatEventAutomaticTranslationToggled(data) + case TypeChatEventInviteLinkEdited: return UnmarshalChatEventInviteLinkEdited(data) @@ -26932,6 +27202,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(data) + case TypeInternalLinkTypeMyStars: + return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -27256,6 +27529,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionExtendStarSubscriptions: return UnmarshalSuggestedActionExtendStarSubscriptions(data) + case TypeSuggestedActionCustom: + return UnmarshalSuggestedActionCustom(data) + case TypeCount: return UnmarshalCount(data) diff --git a/data/td_api.tl b/data/td_api.tl index eb49cac..b4ebb53 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -1093,10 +1093,11 @@ upgradedGiftSymbol name:string sticker:sticker rarity_per_mille:int32 = Upgraded upgradedGiftBackdropColors center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 = UpgradedGiftBackdropColors; //@description Describes a backdrop of an upgraded gift +//@id Unique identifier of the backdrop //@name Name of the backdrop //@colors Colors of the backdrop //@rarity_per_mille The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded -upgradedGiftBackdrop name:string colors:upgradedGiftBackdropColors rarity_per_mille:int32 = UpgradedGiftBackdrop; +upgradedGiftBackdrop id:int32 name:string colors:upgradedGiftBackdropColors rarity_per_mille:int32 = UpgradedGiftBackdrop; //@description Describes the original details about the gift //@sender_id Identifier of the user or the chat that sent the gift; may be null if the gift was private @@ -1118,13 +1119,10 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; -//@description Contains a list of gifts that can be sent to another user or channel chat @gifts The list of gifts -gifts gifts:vector = Gifts; - //@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift //@title The title of the upgraded gift -//@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift +//@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift //@total_upgraded_count Total number of gifts that were upgraded from the same gift //@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift @@ -1136,7 +1134,8 @@ gifts gifts:vector = Gifts; //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown -upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; +//@resale_star_count Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible +upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1144,8 +1143,69 @@ upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count //@is_saved True, if the gift is displayed on the user's or the channel's profile page //@can_be_transferred True, if the gift can be transferred to another owner //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT -upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; +upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = UpgradeGiftResult; + +//@description Describes a gift that is available for purchase +//@gift The gift +//@resale_count Number of gifts that are available for resale +//@min_resale_star_count The minimum price for the gifts available for resale; 0 if there are no such gifts +//@title The title of the upgraded gift; empty if the gift isn't available for resale +availableGift gift:gift resale_count:int32 min_resale_star_count:int53 title:string = AvailableGift; + +//@description Contains a list of gifts that can be sent to another user or channel chat @gifts The list of gifts +availableGifts gifts:vector = AvailableGifts; + + +//@class UpgradedGiftAttributeId @description Contains identifier of an upgraded gift attribute to search for + +//@description Identifier of a gift model @sticker_id Identifier of the sticker representing the model +upgradedGiftAttributeIdModel sticker_id:int64 = UpgradedGiftAttributeId; + +//@description Identifier of a gift symbol @sticker_id Identifier of the sticker representing the symbol +upgradedGiftAttributeIdSymbol sticker_id:int64 = UpgradedGiftAttributeId; + +//@description Identifier of a gift backdrop @backdrop_id Identifier of the backdrop +upgradedGiftAttributeIdBackdrop backdrop_id:int32 = UpgradedGiftAttributeId; + + +//@description Describes a model of an upgraded gift with the number of gifts found @model The model @total_count Total number of gifts with the model +upgradedGiftModelCount model:upgradedGiftModel total_count:int32 = UpgradedGiftModelCount; + +//@description Describes a symbol shown on the pattern of an upgraded gift @symbol The symbol @total_count Total number of gifts with the symbol +upgradedGiftSymbolCount symbol:upgradedGiftSymbol total_count:int32 = UpgradedGiftSymbolCount; + +//@description Describes a backdrop of an upgraded gift @backdrop The backdrop @total_count Total number of gifts with the symbol +upgradedGiftBackdropCount backdrop:upgradedGiftBackdrop total_count:int32 = UpgradedGiftBackdropCount; + + +//@class GiftForResaleOrder @description Describes order in which upgraded gifts for resale will be sorted + +//@description The gifts will be sorted by their price from the lowest to the highest +giftForResaleOrderPrice = GiftForResaleOrder; + +//@description The gifts will be sorted by the last date when their price was changed from the newest to the oldest +giftForResaleOrderPriceChangeDate = GiftForResaleOrder; + +//@description The gifts will be sorted by their number from the smallest to the largest +giftForResaleOrderNumber = GiftForResaleOrder; + + +//@description Describes a gift available for resale +//@gift The gift +//@received_gift_id Unique identifier of the received gift for the current user; only for the gifts owned by the current user +giftForResale gift:upgradedGift received_gift_id:string = GiftForResale; + +//@description Describes gifts available for resale +//@total_count Total number of gifts found +//@gifts The gifts +//@models Available models; for searchGiftsForResale requests without offset and attributes only +//@symbols Available symbols; for searchGiftsForResale requests without offset and attributes only +//@backdrops Available backdrops; for searchGiftsForResale requests without offset and attributes only +//@next_offset The offset for the next request. If empty, then there are no more results +giftsForResale total_count:int32 gifts:vector models:vector symbols:vector backdrops:vector next_offset:string = GiftsForResale; //@class SentGift @description Represents content of a gift received by a user or a channel chat @@ -1172,8 +1232,10 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = ReceivedGift; +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = ReceivedGift; //@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts @@ -1304,6 +1366,15 @@ starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; //@description The transaction is an upgrade of a gift; for regular users only @user_id Identifier of the user that initially sent the gift @gift The upgraded gift starTransactionTypeGiftUpgrade user_id:int53 gift:upgradedGift = StarTransactionType; +//@description The transaction is a purchase of an upgraded gift for some user or channel; for regular users only @user_id Identifier of the user that sold the gift @gift The gift +starTransactionTypeUpgradedGiftPurchase user_id:int53 gift:upgradedGift = StarTransactionType; + +//@description The transaction is a sale of an upgraded gift; for regular users only +//@user_id Identifier of the user that bought the gift +//@gift The gift +//@affiliate Information about commission received by Telegram from the transaction +starTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift affiliate:affiliateInfo = StarTransactionType; + //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat //@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message @@ -1779,6 +1850,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //-getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, //-or for chats with messages or stories from publicForwards and foundStories //@boost_level Approximate boost level for the chat +//@has_automatic_translation True, if automatic translation of messages is enabled in the channel //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup //@sign_messages True, if messages sent to the channel contains name of the sender. This field is only applicable to channels @@ -1795,7 +1867,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -4189,18 +4261,21 @@ messageGift gift:gift sender_id:MessageSender received_gift_id:string text:forma //@gift The gift //@sender_id Sender of the gift; may be null for anonymous gifts //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift //@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift //@was_transferred True, if the gift was transferred to another owner; only for the receiver of the gift +//@last_resale_star_count Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; +messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded //@gift The gift //@sender_id Sender of the gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift messageRefundedUpgradedGift gift:gift sender_id:MessageSender is_upgrade:Bool = MessageContent; //@description Paid messages were refunded @message_count The number of refunded messages @star_count The number of refunded Telegram Stars @@ -5124,9 +5199,10 @@ botMediaPreviewInfo previews:vector language_codes:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_speech_recognition_boost_level:int32 min_sponsored_message_disable_boost_level:int32 = ChatBoostFeatures; +chatBoostFeatures features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_automatic_translation_boost_level:int32 min_speech_recognition_boost_level:int32 min_sponsored_message_disable_boost_level:int32 = ChatBoostFeatures; //@class ChatBoostSource @description Describes source of a chat boost @@ -6064,6 +6141,9 @@ chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction; //@description The show_message_sender setting of a channel was toggled @show_message_sender New value of show_message_sender chatEventShowMessageSenderToggled show_message_sender:Bool = ChatEventAction; +//@description The has_automatic_translation setting of a channel was toggled @has_automatic_translation New value of has_automatic_translation +chatEventAutomaticTranslationToggled has_automatic_translation:Bool = ChatEventAction; + //@description A chat invite link was edited @old_invite_link Previous information about the invite link @new_invite_link New information about the invite link chatEventInviteLinkEdited old_invite_link:chatInviteLink new_invite_link:chatInviteLink = ChatEventAction; @@ -6655,8 +6735,8 @@ hashtags hashtags:vector = Hashtags; //@class CanPostStoryResult @description Represents result of checking whether the current user can post a story on behalf of the specific chat -//@description A story can be sent -canPostStoryResultOk = CanPostStoryResult; +//@description A story can be sent @story_count Number of stories that can be posted by the user +canPostStoryResultOk story_count:int32 = CanPostStoryResult; //@description The user must subscribe to Telegram Premium to be able to post stories canPostStoryResultPremiumNeeded = CanPostStoryResult; @@ -6809,7 +6889,7 @@ pushMessageContentGiveaway winner_count:int32 prize:GiveawayPrize is_pinned:Bool pushMessageContentGift star_count:int53 = PushMessageContent; //@description A message with an upgraded gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift +//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift pushMessageContentUpgradedGift is_upgrade:Bool = PushMessageContent; //@description A screenshot of a message in the chat has been taken @@ -7438,6 +7518,9 @@ internalLinkTypeMessage url:string = InternalLinkType; //@contains_link True, if the first line of the text contains a link. If true, the input field needs to be focused and the text after the link must be selected internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLinkType; +//@description The link is a link to the screen with information about Telegram Star balance and transactions of the current user +internalLinkTypeMyStars = InternalLinkType; + //@description The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it //@bot_user_id User identifier of the service's bot; the corresponding user may be unknown yet //@scope Telegram Passport element types requested by the service @@ -7894,6 +7977,13 @@ suggestedActionExtendPremium manage_premium_subscription_url:string = SuggestedA //-to get the number of expiring subscriptions and the number of required to buy Telegram Stars suggestedActionExtendStarSubscriptions = SuggestedAction; +//@description A custom suggestion to be shown at the top of the chat list +//@name Unique name of the suggestion +//@title Title of the suggestion +//@param_description Description of the suggestion +//@url The link to open when the suggestion is clicked +suggestedActionCustom name:string title:formattedText description:formattedText url:string = SuggestedAction; + //@description Contains a counter @count Count count count:int32 = Count; @@ -8157,7 +8247,7 @@ point x:double y:double = Point; //@description A straight line to a given point @end_point The end point of the straight line vectorPathCommandLine end_point:point = VectorPathCommand; -//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve +//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve vectorPathCommandCubicBezierCurve start_control_point:point end_control_point:point end_point:point = VectorPathCommand; @@ -12058,6 +12148,12 @@ toggleSupergroupIsAllHistoryAvailable supergroup_id:int53 is_all_history_availab //@can_have_sponsored_messages The new value of can_have_sponsored_messages toggleSupergroupCanHaveSponsoredMessages supergroup_id:int53 can_have_sponsored_messages:Bool = Ok; +//@description Toggles whether messages are automatically translated in the channel chat; requires can_change_info administrator right in the channel. +//-The chat must have at least chatBoostFeatures.min_automatic_translation_boost_level boost level to enable automatic translation +//@supergroup_id The identifier of the channel +//@has_automatic_translation The new value of has_automatic_translation +toggleSupergroupHasAutomaticTranslation supergroup_id:int53 has_automatic_translation:Bool = Ok; + //@description Toggles whether non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers. Can be called only if supergroupFullInfo.can_hide_members == true //@supergroup_id Identifier of the supergroup //@has_hidden_members New value of has_hidden_members @@ -12147,7 +12243,7 @@ deleteSavedCredentials = Ok; setGiftSettings settings:giftSettings = Ok; //@description Returns gifts that can be sent to other users and channel chats -getAvailableGifts = Gifts; +getAvailableGifts = AvailableGifts; //@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send @@ -12195,6 +12291,13 @@ upgradeGift business_connection_id:string received_gift_id:string keep_original_ //@star_count The amount of Telegram Stars required to pay for the transfer transferGift business_connection_id:string received_gift_id:string new_owner_id:MessageSender star_count:int53 = Ok; +//@description Sends an upgraded gift that is available for resale to another user or channel chat; gifts already owned by the current user +//-must be transferred using transferGift and can't be passed to the method +//@gift_name Name of the upgraded gift to send +//@owner_id Identifier of the user or the channel chat that will receive the gift +//@star_count The amount of Telegram Stars required to pay for the gift +sendResoldGift gift_name:string owner_id:MessageSender star_count:int53 = Ok; + //@description Returns gifts received by the given user or chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@owner_id Identifier of the gift receiver @@ -12219,6 +12322,20 @@ getUpgradedGift name:string = UpgradedGift; //@password The 2-step verification password of the current user getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; +//@description Changes resale price of a unique gift owned by the current user +//@received_gift_id Identifier of the unique gift +//@resale_star_count The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. +//-The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift +setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; + +//@description Returns upgraded gifts that can be bought from other owners +//@gift_id Identifier of the regular gift that was upgraded to a unique gift +//@order Order in which the results will be sorted +//@attributes Attributes used to filter received gifts. If multiple attributes of the same type are specified, then all of them are allowed. +//-If none attributes of specific type are specified, then all values for this attribute type are allowed +//@offset Offset of the first entry to return as received from the previous request with the same order and attributes; use empty string to get the first chunk of results +//@limit The maximum number of gifts to return +searchGiftsForResale gift_id:int64 order:GiftForResaleOrder attributes:vector offset:string limit:int32 = GiftsForResale; //@description Creates a link for the given invoice; for bots only //@business_connection_id Unique identifier of business connection on behalf of which to send the request From bc2b5f58230b2ff037cf0b6603be9599af96f6b9 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 10 Jun 2025 23:44:57 +0800 Subject: [PATCH 02/11] Update to TDLib 1.8.50 --- client/function.go | 454 +++++++++++++++++++++++++++++++++++++++--- client/type.go | 407 ++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 137 +++++++++++++ data/td_api.tl | 244 ++++++++++++++++++----- 4 files changed, 1133 insertions(+), 109 deletions(-) diff --git a/client/function.go b/client/function.go index 1102459..072145a 100755 --- a/client/function.go +++ b/client/function.go @@ -1672,6 +1672,35 @@ func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*Message return UnmarshalMessageViewers(result.Data) } +type GetMessageAuthorRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns information about actual author of a message sent on behalf of a channel. The method can be called if messageProperties.can_get_author == true +func (client *Client) GetMessageAuthor(req *GetMessageAuthorRequest) (*User, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageAuthor", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUser(result.Data) +} + type GetFileRequest struct { // Identifier of the file to get FileId int32 `json:"file_id"` @@ -2387,7 +2416,7 @@ func (client *Client) GetSuitableDiscussionChats() (*Chats, error) { return UnmarshalChats(result.Data) } -// Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium +// Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives the error "CHANNELS_TOO_MUCH". Also, the limit can be increased with Telegram Premium func (client *Client) GetInactiveSupergroupChats() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2425,6 +2454,320 @@ func (client *Client) GetSuitablePersonalChats() (*Chats, error) { return UnmarshalChats(result.Data) } +type LoadDirectMessagesChatTopicsRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached + Limit int32 `json:"limit"` +} + +// Loads more topics in a channel direct messages chat administered by the current user. The loaded topics will be sent through updateDirectMessagesChatTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +func (client *Client) LoadDirectMessagesChatTopics(req *LoadDirectMessagesChatTopicsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "loadDirectMessagesChatTopics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetDirectMessagesChatTopicRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic to get + TopicId int64 `json:"topic_id"` +} + +// Returns information about the topic in a channel direct messages chat administered by the current user +func (client *Client) GetDirectMessagesChatTopic(req *GetDirectMessagesChatTopicRequest) (*DirectMessagesChatTopic, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopic", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalDirectMessagesChatTopic(result.Data) +} + +type GetDirectMessagesChatTopicHistoryRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be fetched + TopicId int64 `json:"topic_id"` + // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns messages in the topic in a channel direct messages chat administered by the current user. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) +func (client *Client) GetDirectMessagesChatTopicHistory(req *GetDirectMessagesChatTopicHistoryRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type GetDirectMessagesChatTopicMessageByDateRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be fetched + TopicId int64 `json:"topic_id"` + // Point in time (Unix timestamp) relative to which to search for messages + Date int32 `json:"date"` +} + +// Returns the last message sent in the topic in a channel direct messages chat administered by the current user no later than the specified date +func (client *Client) GetDirectMessagesChatTopicMessageByDate(req *GetDirectMessagesChatTopicMessageByDateRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicMessageByDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "date": req.Date, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type DeleteDirectMessagesChatTopicHistoryRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be deleted + TopicId int64 `json:"topic_id"` +} + +// Deletes all messages in the topic in a channel direct messages chat administered by the current user +func (client *Client) DeleteDirectMessagesChatTopicHistory(req *DeleteDirectMessagesChatTopicHistoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteDirectMessagesChatTopicHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteDirectMessagesChatTopicMessagesByDateRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be deleted + TopicId int64 `json:"topic_id"` + // The minimum date of the messages to delete + MinDate int32 `json:"min_date"` + // The maximum date of the messages to delete + MaxDate int32 `json:"max_date"` +} + +// Deletes all messages between the specified dates in the topic in a channel direct messages chat administered by the current user. Messages sent in the last 30 seconds will not be deleted +func (client *Client) DeleteDirectMessagesChatTopicMessagesByDate(req *DeleteDirectMessagesChatTopicMessagesByDateRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteDirectMessagesChatTopicMessagesByDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "min_date": req.MinDate, + "max_date": req.MaxDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetDirectMessagesChatTopicIsMarkedAsUnreadRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` + // New value of is_marked_as_unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` +} + +// Changes the marked as unread state of the topic in a channel direct messages chat administered by the current user +func (client *Client) SetDirectMessagesChatTopicIsMarkedAsUnread(req *SetDirectMessagesChatTopicIsMarkedAsUnreadRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setDirectMessagesChatTopicIsMarkedAsUnread", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "is_marked_as_unread": req.IsMarkedAsUnread, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetDirectMessagesChatTopicDraftMessageRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` + // New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored + DraftMessage *DraftMessage `json:"draft_message"` +} + +// Changes the draft message in the topic in a channel direct messages chat administered by the current user +func (client *Client) SetDirectMessagesChatTopicDraftMessage(req *SetDirectMessagesChatTopicDraftMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setDirectMessagesChatTopicDraftMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "draft_message": req.DraftMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type UnpinAllDirectMessagesChatTopicMessagesRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` +} + +// Removes all pinned messages from the topic in a channel direct messages chat administered by the current user +func (client *Client) UnpinAllDirectMessagesChatTopicMessages(req *UnpinAllDirectMessagesChatTopicMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "unpinAllDirectMessagesChatTopicMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReadAllDirectMessagesChatTopicReactionsRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` +} + +// Removes all unread reactions in the topic in a channel direct messages chat administered by the current user +func (client *Client) ReadAllDirectMessagesChatTopicReactions(req *ReadAllDirectMessagesChatTopicReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readAllDirectMessagesChatTopicReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type LoadSavedMessagesTopicsRequest struct { // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached Limit int32 `json:"limit"` @@ -2797,6 +3140,8 @@ func (client *Client) DeleteChat(req *DeleteChatRequest) (*Ok, error) { type SearchChatMessagesRequest struct { // Identifier of the chat in which to search messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to search messages only in specific topic; pass null to search for messages in all topics + TopicId MessageTopic `json:"topic_id"` // Query to search for Query string `json:"query"` // Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats @@ -2809,13 +3154,9 @@ type SearchChatMessagesRequest struct { Limit int32 `json:"limit"` // Additional filter for messages to search; pass null to search for all messages Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified thread will be returned; supergroups only - MessageThreadId int64 `json:"message_thread_id"` - // If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } -// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation +// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and topic_id search criteria is expected to be supported, only if it is required for Telegram official application implementation func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*FoundChatMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2823,14 +3164,13 @@ func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Found }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "query": req.Query, "sender_id": req.SenderId, "from_message_id": req.FromMessageId, "offset": req.Offset, "limit": req.Limit, "filter": req.Filter, - "message_thread_id": req.MessageThreadId, - "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -3371,12 +3711,12 @@ func (client *Client) GetChatSparseMessagePositions(req *GetChatSparseMessagePos type GetChatMessageCalendarRequest struct { // Identifier of the chat in which to return information about messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to get the result only in specific topic; pass null to get the result in all topics; forum topics aren't supported + TopicId MessageTopic `json:"topic_id"` // Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function Filter SearchMessagesFilter `json:"filter"` // The message identifier from which to return information about messages; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // If not0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } // Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" @@ -3387,9 +3727,9 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "filter": req.Filter, "from_message_id": req.FromMessageId, - "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -3406,15 +3746,15 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) type GetChatMessageCountRequest struct { // Identifier of the chat in which to count messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to get number of messages only in specific topic; pass null to get number of messages in all topics + TopicId MessageTopic `json:"topic_id"` // Filter for message content; searchMessagesFilterEmpty is unsupported in this function Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally ReturnLocal bool `json:"return_local"` } -// Returns approximate number of messages of the specified type in the chat +// Returns approximate number of messages of the specified type in the chat or its topic func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Count, error) { result, err := client.Send(Request{ meta: meta{ @@ -3422,8 +3762,8 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "filter": req.Filter, - "saved_messages_topic_id": req.SavedMessagesTopicId, "return_local": req.ReturnLocal, }, }) @@ -3441,17 +3781,15 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou type GetChatMessagePositionRequest struct { // Identifier of the chat in which to find message position ChatId int64 `json:"chat_id"` - // Message identifier - MessageId int64 `json:"message_id"` + // Pass topic identifier to get position among messages only in specific topic; pass null to get position among all chat messages + TopicId MessageTopic `json:"topic_id"` // Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified thread will be considered; supergroups only - MessageThreadId int64 `json:"message_thread_id"` - // If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // Message identifier + MessageId int64 `json:"message_id"` } -// Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats +// Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat and topic. Cannot be used in secret chats func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) (*Count, error) { result, err := client.Send(Request{ meta: meta{ @@ -3459,10 +3797,9 @@ func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_id": req.MessageId, + "topic_id": req.TopicId, "filter": req.Filter, - "message_thread_id": req.MessageThreadId, - "saved_messages_topic_id": req.SavedMessagesTopicId, + "message_id": req.MessageId, }, }) if err != nil { @@ -4235,7 +4572,7 @@ type ForwardMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` - // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable + // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // Pass true to remove media captions of message copies. Ignored if send_copy is false RemoveCaption bool `json:"remove_caption"` @@ -4362,7 +4699,7 @@ func (client *Client) SendChatScreenshotTakenNotification(req *SendChatScreensho } type AddLocalMessageRequest struct { - // Target chat + // Target chat; channel direct messages chats aren't supported ChatId int64 `json:"chat_id"` // Identifier of the sender of the message SenderId MessageSender `json:"sender_id"` @@ -7976,8 +8313,10 @@ type OpenWebAppRequest struct { BotUserId int64 `json:"bot_user_id"` // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise Url string `json:"url"` - // If not 0, the message thread identifier in which the message will be sent + // If not 0, the message thread identifier to which the message will be sent MessageThreadId int64 `json:"message_thread_id"` + // If not 0, unique identifier of the topic of channel direct messages chat to which the message will be sent + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` // Information about the message or story to be replied in the message sent by the Web App; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` // Parameters to use to open the Web App @@ -7995,6 +8334,7 @@ func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { "bot_user_id": req.BotUserId, "url": req.Url, "message_thread_id": req.MessageThreadId, + "direct_messages_chat_topic_id": req.DirectMessagesChatTopicId, "reply_to": req.ReplyTo, "parameters": req.Parameters, }, @@ -10449,6 +10789,38 @@ func (client *Client) SetChatDiscussionGroup(req *SetChatDiscussionGroupRequest) return UnmarshalOk(result.Data) } +type SetChatDirectMessagesGroupRequest struct { + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Pass true if the direct messages group is enabled for the channel chat; pass false otherwise + IsEnabled bool `json:"is_enabled"` + // The new number of Telegram Stars that must be paid for each message that is sent to the direct messages chat unless the sender is an administrator of the channel chat; 0-getOption("paid_message_star_count_max"). The channel will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. Requires supergroupFullInfo.can_enable_paid_messages for positive amounts + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Changes direct messages group settings for a channel chat; requires owner privileges in the chat +func (client *Client) SetChatDirectMessagesGroup(req *SetChatDirectMessagesGroupRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatDirectMessagesGroup", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_enabled": req.IsEnabled, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetChatLocationRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -13114,7 +13486,7 @@ func (client *Client) SearchFileDownloads(req *SearchFileDownloadsRequest) (*Fou type SetApplicationVerificationTokenRequest struct { // Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired VerificationId int64 `json:"verification_id"` - // Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request + // Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; pass an empty string to abort verification and receive the error "VERIFICATION_FAILED" for the request Token string `json:"token"` } @@ -14779,8 +15151,8 @@ type SetGroupCallParticipantIsSpeakingRequest struct { IsSpeaking bool `json:"is_speaking"` } -// Informs TDLib that speaking state of a participant of an active group call has changed -func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallParticipantIsSpeakingRequest) (*Ok, error) { +// Informs TDLib that speaking state of a participant of an active group call has changed. Returns identifier of the participant if it is found +func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallParticipantIsSpeakingRequest) (MessageSender, error) { result, err := client.Send(Request{ meta: meta{ Type: "setGroupCallParticipantIsSpeaking", @@ -14799,7 +15171,16 @@ func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallPartici return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeMessageSenderUser: + return UnmarshalMessageSenderUser(result.Data) + + case TypeMessageSenderChat: + return UnmarshalMessageSenderChat(result.Data) + + default: + return nil, errors.New("invalid type") + } } type ToggleGroupCallParticipantIsMutedRequest struct { @@ -19258,6 +19639,8 @@ type ToggleSupergroupIsForumRequest struct { SupergroupId int64 `json:"supergroup_id"` // New value of is_forum IsForum bool `json:"is_forum"` + // New value of has_forum_tabs; ignored if is_forum is false + HasForumTabs bool `json:"has_forum_tabs"` } // Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums @@ -19269,6 +19652,7 @@ func (client *Client) ToggleSupergroupIsForum(req *ToggleSupergroupIsForumReques Data: map[string]interface{}{ "supergroup_id": req.SupergroupId, "is_forum": req.IsForum, + "has_forum_tabs": req.HasForumTabs, }, }) if err != nil { @@ -25371,6 +25755,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(result.Data) + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(result.Data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(result.Data) + case TypeUpdateQuickReplyShortcut: return UnmarshalUpdateQuickReplyShortcut(result.Data) diff --git a/client/type.go b/client/type.go index ab92cfc..2fd662d 100755 --- a/client/type.go +++ b/client/type.go @@ -45,6 +45,7 @@ const ( ClassMessageOrigin = "MessageOrigin" ClassReactionType = "ReactionType" ClassPaidReactionType = "PaidReactionType" + ClassMessageTopic = "MessageTopic" ClassMessageEffectType = "MessageEffectType" ClassMessageSendingState = "MessageSendingState" ClassMessageReplyTo = "MessageReplyTo" @@ -400,6 +401,7 @@ const ( ClassWebAppOpenParameters = "WebAppOpenParameters" ClassMessageThreadInfo = "MessageThreadInfo" ClassSavedMessagesTopic = "SavedMessagesTopic" + ClassDirectMessagesChatTopic = "DirectMessagesChatTopic" ClassForumTopicIcon = "ForumTopicIcon" ClassForumTopicInfo = "ForumTopicInfo" ClassForumTopic = "ForumTopic" @@ -965,6 +967,9 @@ const ( TypeMessageReactions = "messageReactions" TypeMessageInteractionInfo = "messageInteractionInfo" TypeUnreadReaction = "unreadReaction" + TypeMessageTopicForum = "messageTopicForum" + TypeMessageTopicDirectMessages = "messageTopicDirectMessages" + TypeMessageTopicSavedMessages = "messageTopicSavedMessages" TypeMessageEffectTypeEmojiReaction = "messageEffectTypeEmojiReaction" TypeMessageEffectTypePremiumSticker = "messageEffectTypePremiumSticker" TypeMessageEffect = "messageEffect" @@ -991,6 +996,7 @@ const ( TypeMessageSourceChatHistory = "messageSourceChatHistory" TypeMessageSourceMessageThreadHistory = "messageSourceMessageThreadHistory" TypeMessageSourceForumTopicHistory = "messageSourceForumTopicHistory" + TypeMessageSourceDirectMessagesChatTopicHistory = "messageSourceDirectMessagesChatTopicHistory" TypeMessageSourceHistoryPreview = "messageSourceHistoryPreview" TypeMessageSourceChatList = "messageSourceChatList" TypeMessageSourceSearch = "messageSourceSearch" @@ -1101,6 +1107,7 @@ const ( TypeSavedMessagesTopicTypeAuthorHidden = "savedMessagesTopicTypeAuthorHidden" TypeSavedMessagesTopicTypeSavedFromChat = "savedMessagesTopicTypeSavedFromChat" TypeSavedMessagesTopic = "savedMessagesTopic" + TypeDirectMessagesChatTopic = "directMessagesChatTopic" TypeForumTopicIcon = "forumTopicIcon" TypeForumTopicInfo = "forumTopicInfo" TypeForumTopic = "forumTopic" @@ -1384,6 +1391,7 @@ const ( TypeMessageRefundedUpgradedGift = "messageRefundedUpgradedGift" TypeMessagePaidMessagesRefunded = "messagePaidMessagesRefunded" TypeMessagePaidMessagePriceChanged = "messagePaidMessagePriceChanged" + TypeMessageDirectMessagePriceChanged = "messageDirectMessagePriceChanged" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -2273,6 +2281,8 @@ const ( TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" TypeUpdateSavedMessagesTopic = "updateSavedMessagesTopic" TypeUpdateSavedMessagesTopicCount = "updateSavedMessagesTopicCount" + TypeUpdateDirectMessagesChatTopic = "updateDirectMessagesChatTopic" + TypeUpdateTopicMessageCount = "updateTopicMessageCount" TypeUpdateQuickReplyShortcut = "updateQuickReplyShortcut" TypeUpdateQuickReplyShortcutDeleted = "updateQuickReplyShortcutDeleted" TypeUpdateQuickReplyShortcuts = "updateQuickReplyShortcuts" @@ -2584,6 +2594,11 @@ type PaidReactionType interface { PaidReactionTypeType() string } +// Describes a topic of messages in a chat +type MessageTopic interface { + MessageTopicType() string +} + // Describes type of emoji effect type MessageEffectType interface { MessageEffectTypeType() string @@ -7626,11 +7641,11 @@ func (*ChatPermissions) GetType() string { // Describes rights of the administrator type ChatAdministratorRights struct { meta - // True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only + // True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` - // True, if the administrator can create channel posts or view channel statistics; applicable to channels only + // True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only CanPostMessages bool `json:"can_post_messages"` // True, if the administrator can edit messages of other users and pin messages; applicable to channels only CanEditMessages bool `json:"can_edit_messages"` @@ -10639,7 +10654,7 @@ func (*StarTransactionTypePaidMessageSend) StarTransactionTypeType() string { return TypeStarTransactionTypePaidMessageSend } -// The transaction is a receiving of a paid message; for regular users and supergroup chats only +// The transaction is a receiving of a paid message; for regular users, supergroup and channel chats only type StarTransactionTypePaidMessageReceive struct { meta // Identifier of the sender of the message @@ -13165,8 +13180,16 @@ type Supergroup struct { IsBroadcastGroup bool `json:"is_broadcast_group"` // True, if the supergroup is a forum with topics IsForum bool `json:"is_forum"` + // True, if the supergroup is a direct message group for a channel chat + IsDirectMessagesGroup bool `json:"is_direct_messages_group"` + // True, if the supergroup is a direct messages group for a channel chat that is administered by the current user + IsAdministeredDirectMessagesGroup bool `json:"is_administered_direct_messages_group"` // Information about verification status of the supergroup or channel; may be null if none VerificationStatus *VerificationStatus `json:"verification_status"` + // True, if the channel has direct messages group + HasDirectMessagesGroup bool `json:"has_direct_messages_group"` + // True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups + HasForumTabs bool `json:"has_forum_tabs"` // True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler HasSensitiveContent bool `json:"has_sensitive_content"` // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted @@ -13215,7 +13238,11 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { IsChannel bool `json:"is_channel"` IsBroadcastGroup bool `json:"is_broadcast_group"` IsForum bool `json:"is_forum"` + IsDirectMessagesGroup bool `json:"is_direct_messages_group"` + IsAdministeredDirectMessagesGroup bool `json:"is_administered_direct_messages_group"` VerificationStatus *VerificationStatus `json:"verification_status"` + HasDirectMessagesGroup bool `json:"has_direct_messages_group"` + HasForumTabs bool `json:"has_forum_tabs"` HasSensitiveContent bool `json:"has_sensitive_content"` RestrictionReason string `json:"restriction_reason"` PaidMessageStarCount int64 `json:"paid_message_star_count"` @@ -13245,7 +13272,11 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.IsChannel = tmp.IsChannel supergroup.IsBroadcastGroup = tmp.IsBroadcastGroup supergroup.IsForum = tmp.IsForum + supergroup.IsDirectMessagesGroup = tmp.IsDirectMessagesGroup + supergroup.IsAdministeredDirectMessagesGroup = tmp.IsAdministeredDirectMessagesGroup supergroup.VerificationStatus = tmp.VerificationStatus + supergroup.HasDirectMessagesGroup = tmp.HasDirectMessagesGroup + supergroup.HasForumTabs = tmp.HasForumTabs supergroup.HasSensitiveContent = tmp.HasSensitiveContent supergroup.RestrictionReason = tmp.RestrictionReason supergroup.PaidMessageStarCount = tmp.PaidMessageStarCount @@ -13275,6 +13306,8 @@ type SupergroupFullInfo struct { BannedCount int32 `json:"banned_count"` // Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown LinkedChatId int64 `json:"linked_chat_id"` + // Chat identifier of a direct messages group for the channel, or a channel, for which the supergroup is the designated direct messages group; 0 if none + DirectMessagesChatId int64 `json:"direct_messages_chat_id"` // Delay between consecutive sent messages for non-administrator supergroup members, in seconds SlowModeDelay int32 `json:"slow_mode_delay"` // Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero @@ -14515,6 +14548,87 @@ func (unreadReaction *UnreadReaction) UnmarshalJSON(data []byte) error { return nil } +// A topic in a forum supergroup chat +type MessageTopicForum struct { + meta + // Unique identifier of the forum topic; all messages in a non-forum supergroup chats belongs to the General topic + ForumTopicId int64 `json:"forum_topic_id"` +} + +func (entity *MessageTopicForum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicForum + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicForum) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicForum) GetType() string { + return TypeMessageTopicForum +} + +func (*MessageTopicForum) MessageTopicType() string { + return TypeMessageTopicForum +} + +// A topic in a channel direct messages chat administered by the current user +type MessageTopicDirectMessages struct { + meta + // Unique identifier of the topic + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` +} + +func (entity *MessageTopicDirectMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicDirectMessages + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicDirectMessages) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicDirectMessages) GetType() string { + return TypeMessageTopicDirectMessages +} + +func (*MessageTopicDirectMessages) MessageTopicType() string { + return TypeMessageTopicDirectMessages +} + +// A topic in Saved Messages chat +type MessageTopicSavedMessages struct { + meta + // Unique identifier of the Saved Messages topic + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` +} + +func (entity *MessageTopicSavedMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicSavedMessages + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicSavedMessages) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicSavedMessages) GetType() string { + return TypeMessageTopicSavedMessages +} + +func (*MessageTopicSavedMessages) MessageTopicType() string { + return TypeMessageTopicSavedMessages +} + // An effect from an emoji reaction type MessageEffectTypeEmojiReaction struct { meta @@ -14973,14 +15087,12 @@ type Message struct { IsPinned bool `json:"is_pinned"` // True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message IsFromOffline bool `json:"is_from_offline"` - // True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options + // True, if content of the message can be saved locally CanBeSaved bool `json:"can_be_saved"` // True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message HasTimestampedMedia bool `json:"has_timestamped_media"` // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts IsChannelPost bool `json:"is_channel_post"` - // True, if the message is a forum topic message - IsTopicMessage bool `json:"is_topic_message"` // True, if the message contains an unread mention for the current user ContainsUnreadMention bool `json:"contains_unread_mention"` // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages @@ -15001,8 +15113,8 @@ type Message struct { ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs MessageThreadId int64 `json:"message_thread_id"` - // Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // Identifier of the topic within the chat to which the message belongs; may be null if none + TopicId MessageTopic `json:"topic_id"` // The message's self-destruct type; may be null if none SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet @@ -15062,7 +15174,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { CanBeSaved bool `json:"can_be_saved"` HasTimestampedMedia bool `json:"has_timestamped_media"` IsChannelPost bool `json:"is_channel_post"` - IsTopicMessage bool `json:"is_topic_message"` ContainsUnreadMention bool `json:"contains_unread_mention"` Date int32 `json:"date"` EditDate int32 `json:"edit_date"` @@ -15073,7 +15184,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { FactCheck *FactCheck `json:"fact_check"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` - SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + TopicId json.RawMessage `json:"topic_id"` SelfDestructType json.RawMessage `json:"self_destruct_type"` SelfDestructIn float64 `json:"self_destruct_in"` AutoDeleteIn float64 `json:"auto_delete_in"` @@ -15103,7 +15214,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.CanBeSaved = tmp.CanBeSaved message.HasTimestampedMedia = tmp.HasTimestampedMedia message.IsChannelPost = tmp.IsChannelPost - message.IsTopicMessage = tmp.IsTopicMessage message.ContainsUnreadMention = tmp.ContainsUnreadMention message.Date = tmp.Date message.EditDate = tmp.EditDate @@ -15113,7 +15223,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.UnreadReactions = tmp.UnreadReactions message.FactCheck = tmp.FactCheck message.MessageThreadId = tmp.MessageThreadId - message.SavedMessagesTopicId = tmp.SavedMessagesTopicId message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn message.ViaBotUserId = tmp.ViaBotUserId @@ -15138,6 +15247,9 @@ func (message *Message) UnmarshalJSON(data []byte) error { fieldReplyTo, _ := UnmarshalMessageReplyTo(tmp.ReplyTo) message.ReplyTo = fieldReplyTo + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + message.TopicId = fieldTopicId + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) message.SelfDestructType = fieldSelfDestructType @@ -15404,7 +15516,7 @@ func (*MessageSourceChatHistory) MessageSourceType() string { return TypeMessageSourceChatHistory } -// The message is from a message thread history +// The message is from history of a message thread type MessageSourceMessageThreadHistory struct{ meta } @@ -15429,7 +15541,7 @@ func (*MessageSourceMessageThreadHistory) MessageSourceType() string { return TypeMessageSourceMessageThreadHistory } -// The message is from a forum topic history +// The message is from history of a forum topic type MessageSourceForumTopicHistory struct{ meta } @@ -15454,6 +15566,31 @@ func (*MessageSourceForumTopicHistory) MessageSourceType() string { return TypeMessageSourceForumTopicHistory } +// The message is from history of a topic in a channel direct messages chat administered by the current user +type MessageSourceDirectMessagesChatTopicHistory struct{ + meta +} + +func (entity *MessageSourceDirectMessagesChatTopicHistory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceDirectMessagesChatTopicHistory + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceDirectMessagesChatTopicHistory) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceDirectMessagesChatTopicHistory) GetType() string { + return TypeMessageSourceDirectMessagesChatTopicHistory +} + +func (*MessageSourceDirectMessagesChatTopicHistory) MessageSourceType() string { + return TypeMessageSourceDirectMessagesChatTopicHistory +} + // The message is from chat, message thread or forum topic history preview type MessageSourceHistoryPreview struct{ meta @@ -19020,6 +19157,86 @@ func (savedMessagesTopic *SavedMessagesTopic) UnmarshalJSON(data []byte) error { return nil } +// Contains information about a topic in a channel direct messages chat administered by the current user +type DirectMessagesChatTopic struct { + meta + // Identifier of the chat to which the topic belongs + ChatId int64 `json:"chat_id"` + // Unique topic identifier + Id int64 `json:"id"` + // Identifier of the user or chat that sends the messages to the topic + SenderId MessageSender `json:"sender_id"` + // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order + Order JsonInt64 `json:"order"` + // True, if the forum topic is marked as unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + // Number of unread messages in the chat + UnreadCount int64 `json:"unread_count"` + // Identifier of the last read incoming message + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + // Identifier of the last read outgoing message + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Number of messages with unread reactions in the chat + UnreadReactionCount int64 `json:"unread_reaction_count"` + // Last message in the topic; may be null if none or unknown + LastMessage *Message `json:"last_message"` + // A draft of a message in the topic; may be null if none + DraftMessage *DraftMessage `json:"draft_message"` +} + +func (entity *DirectMessagesChatTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DirectMessagesChatTopic + + return json.Marshal((*stub)(entity)) +} + +func (*DirectMessagesChatTopic) GetClass() string { + return ClassDirectMessagesChatTopic +} + +func (*DirectMessagesChatTopic) GetType() string { + return TypeDirectMessagesChatTopic +} + +func (directMessagesChatTopic *DirectMessagesChatTopic) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + Id int64 `json:"id"` + SenderId json.RawMessage `json:"sender_id"` + Order JsonInt64 `json:"order"` + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + UnreadCount int64 `json:"unread_count"` + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + UnreadReactionCount int64 `json:"unread_reaction_count"` + LastMessage *Message `json:"last_message"` + DraftMessage *DraftMessage `json:"draft_message"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + directMessagesChatTopic.ChatId = tmp.ChatId + directMessagesChatTopic.Id = tmp.Id + directMessagesChatTopic.Order = tmp.Order + directMessagesChatTopic.IsMarkedAsUnread = tmp.IsMarkedAsUnread + directMessagesChatTopic.UnreadCount = tmp.UnreadCount + directMessagesChatTopic.LastReadInboxMessageId = tmp.LastReadInboxMessageId + directMessagesChatTopic.LastReadOutboxMessageId = tmp.LastReadOutboxMessageId + directMessagesChatTopic.UnreadReactionCount = tmp.UnreadReactionCount + directMessagesChatTopic.LastMessage = tmp.LastMessage + directMessagesChatTopic.DraftMessage = tmp.DraftMessage + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + directMessagesChatTopic.SenderId = fieldSenderId + + return nil +} + // Describes a forum topic icon type ForumTopicIcon struct { meta @@ -19050,6 +19267,8 @@ type ForumTopicInfo struct { meta // Identifier of the forum chat to which the topic belongs ChatId int64 `json:"chat_id"` + // Forum topic identifier of the topic + ForumTopicId int64 `json:"forum_topic_id"` // Message thread identifier of the topic MessageThreadId int64 `json:"message_thread_id"` // Name of the topic @@ -19089,6 +19308,7 @@ func (*ForumTopicInfo) GetType() string { func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { var tmp struct { ChatId int64 `json:"chat_id"` + ForumTopicId int64 `json:"forum_topic_id"` MessageThreadId int64 `json:"message_thread_id"` Name string `json:"name"` Icon *ForumTopicIcon `json:"icon"` @@ -19106,6 +19326,7 @@ func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { } forumTopicInfo.ChatId = tmp.ChatId + forumTopicInfo.ForumTopicId = tmp.ForumTopicId forumTopicInfo.MessageThreadId = tmp.MessageThreadId forumTopicInfo.Name = tmp.Name forumTopicInfo.Icon = tmp.Icon @@ -27045,7 +27266,7 @@ func (messageCall *MessageCall) UnmarshalJSON(data []byte) error { return nil } -// A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden +// A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use getGroupCallParticipants to show current group call participants on the screen. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden type MessageGroupCall struct { meta // True, if the call is active, i.e. the called user joined the call @@ -28441,6 +28662,8 @@ type MessageGift struct { Gift *Gift `json:"gift"` // Sender of the gift SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` // Message added to the gift @@ -28489,6 +28712,7 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { var tmp struct { Gift *Gift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` ReceivedGiftId string `json:"received_gift_id"` Text *FormattedText `json:"text"` SellStarCount int64 `json:"sell_star_count"` @@ -28523,6 +28747,9 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageGift.SenderId = fieldSenderId + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageGift.ReceiverId = fieldReceiverId + return nil } @@ -28533,6 +28760,8 @@ type MessageUpgradedGift struct { Gift *UpgradedGift `json:"gift"` // Sender of the gift; may be null for anonymous gifts SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift @@ -28579,6 +28808,7 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error var tmp struct { Gift *UpgradedGift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` ReceivedGiftId string `json:"received_gift_id"` IsUpgrade bool `json:"is_upgrade"` IsSaved bool `json:"is_saved"` @@ -28611,6 +28841,9 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageUpgradedGift.SenderId = fieldSenderId + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageUpgradedGift.ReceiverId = fieldReceiverId + return nil } @@ -28621,6 +28854,8 @@ type MessageRefundedUpgradedGift struct { Gift *Gift `json:"gift"` // Sender of the gift SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` } @@ -28649,6 +28884,7 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da var tmp struct { Gift *Gift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` IsUpgrade bool `json:"is_upgrade"` } @@ -28663,6 +28899,9 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageRefundedUpgradedGift.SenderId = fieldSenderId + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageRefundedUpgradedGift.ReceiverId = fieldReceiverId + return nil } @@ -28722,6 +28961,35 @@ func (*MessagePaidMessagePriceChanged) MessageContentType() string { return TypeMessagePaidMessagePriceChanged } +// A price for direct messages was changed in the channel chat +type MessageDirectMessagePriceChanged struct { + meta + // True, if direct messages group was enabled for the channel; false otherwise + IsEnabled bool `json:"is_enabled"` + // The new number of Telegram Stars that must be paid by non-administrator users of the channel chat for each message sent to the direct messages group; 0 if the direct messages group was disabled or the messages are free + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +func (entity *MessageDirectMessagePriceChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageDirectMessagePriceChanged + + return json.Marshal((*stub)(entity)) +} + +func (*MessageDirectMessagePriceChanged) GetClass() string { + return ClassMessageContent +} + +func (*MessageDirectMessagePriceChanged) GetType() string { + return TypeMessageDirectMessagePriceChanged +} + +func (*MessageDirectMessagePriceChanged) MessageContentType() string { + return TypeMessageDirectMessagePriceChanged +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -29940,6 +30208,8 @@ func (*MessageSelfDestructTypeImmediately) MessageSelfDestructTypeType() string // Options to be used when a message is sent type MessageSendOptions struct { meta + // Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` // Pass true to disable notification for the message DisableNotification bool `json:"disable_notification"` // Pass true if the message is sent from the background @@ -29952,7 +30222,7 @@ type MessageSendOptions struct { PaidMessageStarCount int64 `json:"paid_message_star_count"` // Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` - // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled + // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, to a channel direct messages chat, live location messages and self-destructing messages can't be scheduled SchedulingState MessageSchedulingState `json:"scheduling_state"` // Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats EffectId JsonInt64 `json:"effect_id"` @@ -29980,6 +30250,7 @@ func (*MessageSendOptions) GetType() string { func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { var tmp struct { + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` DisableNotification bool `json:"disable_notification"` FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` @@ -29997,6 +30268,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { return err } + messageSendOptions.DirectMessagesChatTopicId = tmp.DirectMessagesChatTopicId messageSendOptions.DisableNotification = tmp.DisableNotification messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent @@ -30016,7 +30288,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { // Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied type MessageCopyOptions struct { meta - // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable + // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false ReplaceCaption bool `json:"replace_caption"` @@ -30858,12 +31130,12 @@ func (*InputMessageInvoice) InputMessageContentType() string { return TypeInputMessageInvoice } -// A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot +// A message with a poll. Polls can't be sent to secret chats and channel direct messages chats. Polls can be sent to a private chat only if the chat is a chat with a bot or the Saved Messages chat type InputMessagePoll struct { meta // Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users Question *FormattedText `json:"question"` - // List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users + // List of poll answer options, 2-getOption("poll_answer_count_max") strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users Options []*FormattedText `json:"options"` // True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels IsAnonymous bool `json:"is_anonymous"` @@ -30995,6 +31267,8 @@ func (*InputMessageForwarded) InputMessageContentType() string { // Contains properties of a message and describes actions that can be done with the message right now type MessageProperties struct { meta + // True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options + CanBeCopied bool `json:"can_be_copied"` // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options CanBeCopiedToSecretChat bool `json:"can_be_copied_to_secret_chat"` // True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false @@ -31003,7 +31277,7 @@ type MessageProperties struct { CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message CanBeEdited bool `json:"can_be_edited"` - // True, if the message can be forwarded using inputMessageForwarded or forwardMessages + // True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options CanBeForwarded bool `json:"can_be_forwarded"` // True, if the message can be paid using inputInvoiceMessage CanBePaid bool `json:"can_be_paid"` @@ -31013,7 +31287,7 @@ type MessageProperties struct { CanBeReplied bool `json:"can_be_replied"` // True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` - // True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options + // True, if content of the message can be saved locally CanBeSaved bool `json:"can_be_saved"` // True, if the message can be shared in a story using inputStoryAreaTypeMessage CanBeSharedInStory bool `json:"can_be_shared_in_story"` @@ -31021,6 +31295,8 @@ type MessageProperties struct { CanEditMedia bool `json:"can_edit_media"` // True, if scheduling state of the message can be edited CanEditSchedulingState bool `json:"can_edit_scheduling_state"` + // True, if author of the message sent on behalf of a chat can be received through getMessageAuthor + CanGetAuthor bool `json:"can_get_author"` // True, if code for message embedding can be received using getMessageEmbeddingCode CanGetEmbeddingCode bool `json:"can_get_embedding_code"` // True, if a link can be generated for the message using getMessageLink @@ -34981,7 +35257,7 @@ func (*ResendCodeReasonUserRequest) ResendCodeReasonType() string { // The code is re-sent, because device verification has failed type ResendCodeReasonVerificationFailed struct { meta - // Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, or APNS_INIT_FAILED + // Cause of the verification failure, for example, "PLAY_SERVICES_NOT_AVAILABLE", "APNS_RECEIVE_TIMEOUT", or "APNS_INIT_FAILED" ErrorMessage string `json:"error_message"` } @@ -49650,7 +49926,7 @@ func (*InternalLinkTypeGame) InternalLinkTypeType() string { return TypeInternalLinkTypeGame } -// The link is a link to a group call that isn't bound to a chat. Call joinGroupCall with the given invite_link +// The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. Call joinGroupCall with the given invite_link to join the call type InternalLinkTypeGroupCall struct { meta // Internal representation of the invite link @@ -54541,7 +54817,7 @@ func (*VectorPathCommandLine) VectorPathCommandType() string { return TypeVectorPathCommandLine } -// A cubic Bézier curve to a given point +// A cubic Bézier curve to a given point type VectorPathCommandCubicBezierCurve struct { meta // The start control point of the curve @@ -56538,6 +56814,85 @@ func (*UpdateSavedMessagesTopicCount) UpdateType() string { return TypeUpdateSavedMessagesTopicCount } +// Basic information about a topic in a channel direct messages chat administered by the current user has changed. This update is guaranteed to come before the topic identifier is returned to the application +type UpdateDirectMessagesChatTopic struct { + meta + // New data about the topic + Topic *DirectMessagesChatTopic `json:"topic"` +} + +func (entity *UpdateDirectMessagesChatTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateDirectMessagesChatTopic + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateDirectMessagesChatTopic) GetClass() string { + return ClassUpdate +} + +func (*UpdateDirectMessagesChatTopic) GetType() string { + return TypeUpdateDirectMessagesChatTopic +} + +func (*UpdateDirectMessagesChatTopic) UpdateType() string { + return TypeUpdateDirectMessagesChatTopic +} + +// Number of messages in a topic has changed; for Saved Messages and channel direct messages chat topics only +type UpdateTopicMessageCount struct { + meta + // Identifier of the chat in topic of which the number of messages has changed + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId MessageTopic `json:"topic_id"` + // Approximate number of messages in the topics + MessageCount int32 `json:"message_count"` +} + +func (entity *UpdateTopicMessageCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTopicMessageCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTopicMessageCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateTopicMessageCount) GetType() string { + return TypeUpdateTopicMessageCount +} + +func (*UpdateTopicMessageCount) UpdateType() string { + return TypeUpdateTopicMessageCount +} + +func (updateTopicMessageCount *UpdateTopicMessageCount) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + TopicId json.RawMessage `json:"topic_id"` + MessageCount int32 `json:"message_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateTopicMessageCount.ChatId = tmp.ChatId + updateTopicMessageCount.MessageCount = tmp.MessageCount + + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + updateTopicMessageCount.TopicId = fieldTopicId + + return nil +} + // Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application type UpdateQuickReplyShortcut struct { meta @@ -56688,6 +57043,10 @@ type UpdateForumTopic struct { LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` // Identifier of the last read outgoing message LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Number of unread messages with a mention/reply in the topic + UnreadMentionCount int32 `json:"unread_mention_count"` + // Number of messages with unread reactions in the topic + UnreadReactionCount int32 `json:"unread_reaction_count"` // Notification settings for the topic NotificationSettings *ChatNotificationSettings `json:"notification_settings"` } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index d5efa81..6adae01 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1599,6 +1599,43 @@ func UnmarshalListOfPaidReactionType(dataList []json.RawMessage) ([]PaidReaction return list, nil } +func UnmarshalMessageTopic(data json.RawMessage) (MessageTopic, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageTopicForum: + return UnmarshalMessageTopicForum(data) + + case TypeMessageTopicDirectMessages: + return UnmarshalMessageTopicDirectMessages(data) + + case TypeMessageTopicSavedMessages: + return UnmarshalMessageTopicSavedMessages(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageTopic(dataList []json.RawMessage) ([]MessageTopic, error) { + list := []MessageTopic{} + + for _, data := range dataList { + entity, err := UnmarshalMessageTopic(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageEffectType(data json.RawMessage) (MessageEffectType, error) { var meta meta @@ -1756,6 +1793,9 @@ func UnmarshalMessageSource(data json.RawMessage) (MessageSource, error) { case TypeMessageSourceForumTopicHistory: return UnmarshalMessageSourceForumTopicHistory(data) + case TypeMessageSourceDirectMessagesChatTopicHistory: + return UnmarshalMessageSourceDirectMessagesChatTopicHistory(data) + case TypeMessageSourceHistoryPreview: return UnmarshalMessageSourceHistoryPreview(data) @@ -3608,6 +3648,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePaidMessagePriceChanged: return UnmarshalMessagePaidMessagePriceChanged(data) + case TypeMessageDirectMessagePriceChanged: + return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -8393,6 +8436,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(data) + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(data) + case TypeUpdateQuickReplyShortcut: return UnmarshalUpdateQuickReplyShortcut(data) @@ -11484,6 +11533,30 @@ func UnmarshalUnreadReaction(data json.RawMessage) (*UnreadReaction, error) { return &resp, err } +func UnmarshalMessageTopicForum(data json.RawMessage) (*MessageTopicForum, error) { + var resp MessageTopicForum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageTopicDirectMessages(data json.RawMessage) (*MessageTopicDirectMessages, error) { + var resp MessageTopicDirectMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageTopicSavedMessages(data json.RawMessage) (*MessageTopicSavedMessages, error) { + var resp MessageTopicSavedMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageEffectTypeEmojiReaction(data json.RawMessage) (*MessageEffectTypeEmojiReaction, error) { var resp MessageEffectTypeEmojiReaction @@ -11692,6 +11765,14 @@ func UnmarshalMessageSourceForumTopicHistory(data json.RawMessage) (*MessageSour return &resp, err } +func UnmarshalMessageSourceDirectMessagesChatTopicHistory(data json.RawMessage) (*MessageSourceDirectMessagesChatTopicHistory, error) { + var resp MessageSourceDirectMessagesChatTopicHistory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSourceHistoryPreview(data json.RawMessage) (*MessageSourceHistoryPreview, error) { var resp MessageSourceHistoryPreview @@ -12572,6 +12653,14 @@ func UnmarshalSavedMessagesTopic(data json.RawMessage) (*SavedMessagesTopic, err return &resp, err } +func UnmarshalDirectMessagesChatTopic(data json.RawMessage) (*DirectMessagesChatTopic, error) { + var resp DirectMessagesChatTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalForumTopicIcon(data json.RawMessage) (*ForumTopicIcon, error) { var resp ForumTopicIcon @@ -14836,6 +14925,14 @@ func UnmarshalMessagePaidMessagePriceChanged(data json.RawMessage) (*MessagePaid return &resp, err } +func UnmarshalMessageDirectMessagePriceChanged(data json.RawMessage) (*MessageDirectMessagePriceChanged, error) { + var resp MessageDirectMessagePriceChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -21948,6 +22045,22 @@ func UnmarshalUpdateSavedMessagesTopicCount(data json.RawMessage) (*UpdateSavedM return &resp, err } +func UnmarshalUpdateDirectMessagesChatTopic(data json.RawMessage) (*UpdateDirectMessagesChatTopic, error) { + var resp UpdateDirectMessagesChatTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateTopicMessageCount(data json.RawMessage) (*UpdateTopicMessageCount, error) { + var resp UpdateTopicMessageCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateQuickReplyShortcut(data json.RawMessage) (*UpdateQuickReplyShortcut, error) { var resp UpdateQuickReplyShortcut @@ -23929,6 +24042,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUnreadReaction: return UnmarshalUnreadReaction(data) + case TypeMessageTopicForum: + return UnmarshalMessageTopicForum(data) + + case TypeMessageTopicDirectMessages: + return UnmarshalMessageTopicDirectMessages(data) + + case TypeMessageTopicSavedMessages: + return UnmarshalMessageTopicSavedMessages(data) + case TypeMessageEffectTypeEmojiReaction: return UnmarshalMessageEffectTypeEmojiReaction(data) @@ -24007,6 +24129,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSourceForumTopicHistory: return UnmarshalMessageSourceForumTopicHistory(data) + case TypeMessageSourceDirectMessagesChatTopicHistory: + return UnmarshalMessageSourceDirectMessagesChatTopicHistory(data) + case TypeMessageSourceHistoryPreview: return UnmarshalMessageSourceHistoryPreview(data) @@ -24337,6 +24462,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSavedMessagesTopic: return UnmarshalSavedMessagesTopic(data) + case TypeDirectMessagesChatTopic: + return UnmarshalDirectMessagesChatTopic(data) + case TypeForumTopicIcon: return UnmarshalForumTopicIcon(data) @@ -25186,6 +25314,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePaidMessagePriceChanged: return UnmarshalMessagePaidMessagePriceChanged(data) + case TypeMessageDirectMessagePriceChanged: + return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -27853,6 +27984,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedMessagesTopicCount: return UnmarshalUpdateSavedMessagesTopicCount(data) + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(data) + case TypeUpdateQuickReplyShortcut: return UnmarshalUpdateQuickReplyShortcut(data) diff --git a/data/td_api.tl b/data/td_api.tl index b4ebb53..5b4847b 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -838,9 +838,10 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_link_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_create_topics:Bool = ChatPermissions; //@description Describes rights of the administrator -//@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only +//@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, +//-ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only //@can_change_info True, if the administrator can change the chat title, photo, and other settings -//@can_post_messages True, if the administrator can create channel posts or view channel statistics; applicable to channels only +//@can_post_messages True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only //@can_delete_messages True, if the administrator can delete messages of other users //@can_invite_users True, if the administrator can invite new users to the chat @@ -1393,7 +1394,7 @@ starTransactionTypeAffiliateProgramCommission chat_id:int53 commission_per_mille //@description The transaction is a sending of a paid message; for regular users only @chat_id Identifier of the chat that received the payment @message_count Number of sent paid messages starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTransactionType; -//@description The transaction is a receiving of a paid message; for regular users and supergroup chats only +//@description The transaction is a receiving of a paid message; for regular users, supergroup and channel chats only //@sender_id Identifier of the sender of the message //@message_count Number of received paid messages //@commission_per_mille The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending @@ -1861,13 +1862,17 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@is_channel True, if the supergroup is a channel //@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members //@is_forum True, if the supergroup is a forum with topics +//@is_direct_messages_group True, if the supergroup is a direct message group for a channel chat +//@is_administered_direct_messages_group True, if the supergroup is a direct messages group for a channel chat that is administered by the current user //@verification_status Information about verification status of the supergroup or channel; may be null if none +//@has_direct_messages_group True, if the channel has direct messages group +//@has_forum_tabs True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups //@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted //@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_direct_messages_group:Bool is_administered_direct_messages_group:Bool verification_status:verificationStatus has_direct_messages_group:Bool has_forum_tabs:Bool has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -1877,6 +1882,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@restricted_count Number of restricted users in the supergroup; 0 if unknown //@banned_count Number of users banned from chat; 0 if unknown //@linked_chat_id Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown +//@direct_messages_chat_id Chat identifier of a direct messages group for the channel, or a channel, for which the supergroup is the designated direct messages group; 0 if none //@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds //@slow_mode_delay_expires_in Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero //@can_enable_paid_messages True, if paid messages can be enabled in the supergroup chat; for supergroup only @@ -1908,7 +1914,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 direct_messages_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -2091,6 +2097,18 @@ messageInteractionInfo view_count:int32 forward_count:int32 reply_info:messageRe unreadReaction type:ReactionType sender_id:MessageSender is_big:Bool = UnreadReaction; +//@class MessageTopic @description Describes a topic of messages in a chat + +//@description A topic in a forum supergroup chat @forum_topic_id Unique identifier of the forum topic; all messages in a non-forum supergroup chats belongs to the General topic +messageTopicForum forum_topic_id:int53 = MessageTopic; + +//@description A topic in a channel direct messages chat administered by the current user @direct_messages_chat_topic_id Unique identifier of the topic +messageTopicDirectMessages direct_messages_chat_topic_id:int53 = MessageTopic; + +//@description A topic in Saved Messages chat @saved_messages_topic_id Unique identifier of the Saved Messages topic +messageTopicSavedMessages saved_messages_topic_id:int53 = MessageTopic; + + //@class MessageEffectType @description Describes type of emoji effect //@description An effect from an emoji reaction @select_animation Select animation for the effect in TGS format @effect_animation Effect animation for the effect in TGS format @@ -2189,10 +2207,9 @@ factCheck text:formattedText country_code:string = FactCheck; //@is_outgoing True, if the message is outgoing //@is_pinned True, if the message is pinned //@is_from_offline True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message -//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options +//@can_be_saved True, if content of the message can be saved locally //@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message //@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts -//@is_topic_message True, if the message is a forum topic message //@contains_unread_mention True, if the message contains an unread mention for the current user //@date Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages //@edit_date Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages @@ -2203,7 +2220,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@fact_check Information about fact-check added to the message; may be null if none //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs -//@saved_messages_topic_id Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages +//@topic_id Identifier of the topic within the chat to which the message belongs; may be null if none //@self_destruct_type The message's self-destruct type; may be null if none //@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet //@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never @@ -2218,7 +2235,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2255,12 +2272,15 @@ businessMessages messages:vector = BusinessMessages; //@description The message is from a chat history messageSourceChatHistory = MessageSource; -//@description The message is from a message thread history +//@description The message is from history of a message thread messageSourceMessageThreadHistory = MessageSource; -//@description The message is from a forum topic history +//@description The message is from history of a forum topic messageSourceForumTopicHistory = MessageSource; +//@description The message is from history of a topic in a channel direct messages chat administered by the current user +messageSourceDirectMessagesChatTopicHistory = MessageSource; + //@description The message is from chat, message thread or forum topic history preview messageSourceHistoryPreview = MessageSource; @@ -2892,11 +2912,27 @@ savedMessagesTopicTypeSavedFromChat chat_id:int53 = SavedMessagesTopicType; savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int64 last_message:message draft_message:draftMessage = SavedMessagesTopic; +//@description Contains information about a topic in a channel direct messages chat administered by the current user +//@chat_id Identifier of the chat to which the topic belongs +//@id Unique topic identifier +//@sender_id Identifier of the user or chat that sends the messages to the topic +//@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order +//@is_marked_as_unread True, if the forum topic is marked as unread +//@unread_count Number of unread messages in the chat +//@last_read_inbox_message_id Identifier of the last read incoming message +//@last_read_outbox_message_id Identifier of the last read outgoing message +//@unread_reaction_count Number of messages with unread reactions in the chat +//@last_message Last message in the topic; may be null if none or unknown +//@draft_message A draft of a message in the topic; may be null if none +directMessagesChatTopic chat_id:int53 id:int53 sender_id:MessageSender order:int64 is_marked_as_unread:Bool unread_count:int53 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_reaction_count:int53 last_message:message draft_message:draftMessage = DirectMessagesChatTopic; + + //@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@description Contains basic information about a forum topic //@chat_id Identifier of the forum chat to which the topic belongs +//@forum_topic_id Forum topic identifier of the topic //@message_thread_id Message thread identifier of the topic //@name Name of the topic //@icon Icon of the topic @@ -2906,7 +2942,7 @@ forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@is_outgoing True, if the topic was created by the current user //@is_closed True, if the topic is closed //@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only -forumTopicInfo chat_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; +forumTopicInfo chat_id:int53 forum_topic_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; //@description Describes a forum topic //@info Basic information about the topic @@ -4030,8 +4066,8 @@ messageInvoice product_info:productInfo currency:string total_amount:int53 start messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; //@description A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, -//-and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. -//-If the call become active or missed, then the call screen must be hidden +//-and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use getGroupCallParticipants to show current group call participants on the screen. +//-Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden //@is_active True, if the call is active, i.e. the called user joined the call //@was_missed True, if the called user missed or declined the call //@is_video True, if the call is a video call @@ -4244,6 +4280,7 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@description A regular gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift //@sender_id Sender of the gift +//@receiver_id Receiver of the gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@text Message added to the gift //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver @@ -4255,11 +4292,12 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@was_upgraded True, if the gift was upgraded to a unique gift //@was_refunded True, if the gift was refunded and isn't available anymore //@upgraded_received_gift_id Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift -messageGift gift:gift sender_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; +messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; //@description An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift //@sender_id Sender of the gift; may be null for anonymous gifts +//@receiver_id Receiver of the gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift @@ -4270,13 +4308,14 @@ messageGift gift:gift sender_id:MessageSender received_gift_id:string text:forma //@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift //@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift sender_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; +messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded //@gift The gift //@sender_id Sender of the gift +//@receiver_id Receiver of the gift //@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift -messageRefundedUpgradedGift gift:gift sender_id:MessageSender is_upgrade:Bool = MessageContent; +messageRefundedUpgradedGift gift:gift sender_id:MessageSender receiver_id:MessageSender is_upgrade:Bool = MessageContent; //@description Paid messages were refunded @message_count The number of refunded messages @star_count The number of refunded Telegram Stars messagePaidMessagesRefunded message_count:int32 star_count:int53 = MessageContent; @@ -4284,6 +4323,12 @@ messagePaidMessagesRefunded message_count:int32 star_count:int53 = MessageConten //@description A price for paid messages was changed in the supergroup chat @paid_message_star_count The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message messagePaidMessagePriceChanged paid_message_star_count:int53 = MessageContent; +//@description A price for direct messages was changed in the channel chat +//@is_enabled True, if direct messages group was enabled for the channel; false otherwise +//@paid_message_star_count The new number of Telegram Stars that must be paid by non-administrator users of the channel chat for each message sent to the direct messages group; +//-0 if the direct messages group was disabled or the messages are free +messageDirectMessagePriceChanged is_enabled:Bool paid_message_star_count:int53 = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4437,21 +4482,23 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@description Options to be used when a message is sent +//@direct_messages_chat_topic_id Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user //@disable_notification Pass true to disable notification for the message //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only //@allow_paid_broadcast Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only //@paid_message_star_count The number of Telegram Stars the user agreed to pay to send the messages //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum -//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, live location messages and self-destructing messages can't be scheduled +//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, to a channel direct messages chat, +//-live location messages and self-destructing messages can't be scheduled //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions direct_messages_chat_topic_id:int53 disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. -//-Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable +//-Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false //@new_show_caption_above_media True, if new caption must be shown above the media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false @@ -4590,9 +4637,9 @@ inputMessageGame bot_user_id:int53 game_short_name:string = InputMessageContent; //@paid_media_caption Paid media caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string paid_media:inputPaidMedia paid_media_caption:formattedText = InputMessageContent; -//@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot +//@description A message with a poll. Polls can't be sent to secret chats and channel direct messages chats. Polls can be sent to a private chat only if the chat is a chat with a bot or the Saved Messages chat //@question Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users -//@options List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users +//@options List of poll answer options, 2-getOption("poll_answer_count_max") strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users //@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels //@type Type of the poll //@open_period Amount of time the poll will be active after creation, in seconds; for bots only @@ -4616,20 +4663,22 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_be_copied True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. //-For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message -//@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages +//@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options //@can_be_paid True, if the message can be paid using inputInvoiceMessage //@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage //@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage //@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage -//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options +//@can_be_saved True, if content of the message can be saved locally //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage //@can_edit_media True, if the message can be edited using the method editMessageMedia //@can_edit_scheduling_state True, if scheduling state of the message can be edited +//@can_get_author True, if author of the message sent on behalf of a chat can be received through getMessageAuthor //@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode //@can_get_link True, if a link can be generated for the message using getMessageLink //@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink @@ -4643,7 +4692,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -5291,7 +5340,7 @@ chatBoostSlots slots:vector = ChatBoostSlots; resendCodeReasonUserRequest = ResendCodeReason; //@description The code is re-sent, because device verification has failed -//@error_message Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, or APNS_INIT_FAILED +//@error_message Cause of the verification failure, for example, "PLAY_SERVICES_NOT_AVAILABLE", "APNS_RECEIVE_TIMEOUT", or "APNS_INIT_FAILED" resendCodeReasonVerificationFailed error_message:string = ResendCodeReason; @@ -7478,7 +7527,9 @@ internalLinkTypeEditProfileSettings = InternalLinkType; //@game_short_name Short name of the game internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkType; -//@description The link is a link to a group call that isn't bound to a chat. Call joinGroupCall with the given invite_link @invite_link Internal representation of the invite link +//@description The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. +//-Call joinGroupCall with the given invite_link to join the call +//@invite_link Internal representation of the invite link internalLinkTypeGroupCall invite_link:string = InternalLinkType; //@description The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. @@ -8247,7 +8298,7 @@ point x:double y:double = Point; //@description A straight line to a given point @end_point The end point of the straight line vectorPathCommandLine end_point:point = VectorPathCommand; -//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve +//@description A cubic Bézier curve to a given point @start_control_point The start control point of the curve @end_control_point The end control point of the curve @end_point The end point of the curve vectorPathCommandCubicBezierCurve start_control_point:point end_control_point:point end_point:point = VectorPathCommand; @@ -8494,6 +8545,16 @@ updateSavedMessagesTopic topic:savedMessagesTopic = Update; //@description Number of Saved Messages topics has changed @topic_count Approximate total number of Saved Messages topics updateSavedMessagesTopicCount topic_count:int32 = Update; +//@description Basic information about a topic in a channel direct messages chat administered by the current user has changed. This update is guaranteed to come before the topic identifier is returned to the application +//@topic New data about the topic +updateDirectMessagesChatTopic topic:directMessagesChatTopic = Update; + +//@description Number of messages in a topic has changed; for Saved Messages and channel direct messages chat topics only +//@chat_id Identifier of the chat in topic of which the number of messages has changed +//@topic_id Identifier of the topic +//@message_count Approximate number of messages in the topics +updateTopicMessageCount chat_id:int53 topic_id:MessageTopic message_count:int32 = Update; + //@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application //@shortcut New data about the shortcut updateQuickReplyShortcut shortcut:quickReplyShortcut = Update; @@ -8518,8 +8579,10 @@ updateForumTopicInfo info:forumTopicInfo = Update; //@is_pinned True, if the topic is pinned in the topic list //@last_read_inbox_message_id Identifier of the last read incoming message //@last_read_outbox_message_id Identifier of the last read outgoing message +//@unread_mention_count Number of unread messages with a mention/reply in the topic +//@unread_reaction_count Number of messages with unread reactions in the topic //@notification_settings Notification settings for the topic -updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 notification_settings:chatNotificationSettings = Update; +updateForumTopic chat_id:int53 message_thread_id:int53 is_pinned:Bool last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings = Update; //@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; @@ -9282,6 +9345,11 @@ getMessageReadDate chat_id:int53 message_id:int53 = MessageReadDate; //@message_id Identifier of the message getMessageViewers chat_id:int53 message_id:int53 = MessageViewers; +//@description Returns information about actual author of a message sent on behalf of a channel. The method can be called if messageProperties.can_get_author == true +//@chat_id Chat identifier +//@message_id Identifier of the message +getMessageAuthor chat_id:int53 message_id:int53 = User; + //@description Returns information about a file. This is an offline method @file_id Identifier of the file to get getFile file_id:int32 = File; @@ -9382,13 +9450,74 @@ checkCreatedPublicChatsLimit type:PublicChatType = Ok; //-To set a returned supergroup as a discussion group, access to its old messages must be enabled using toggleSupergroupIsAllHistoryAvailable first getSuitableDiscussionChats = Chats; -//@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium +//@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives the error "CHANNELS_TOO_MUCH". Also, the limit can be increased with Telegram Premium getInactiveSupergroupChats = Chats; //@description Returns a list of channel chats, which can be used as a personal chat getSuitablePersonalChats = Chats; +//@description Loads more topics in a channel direct messages chat administered by the current user. The loaded topics will be sent through updateDirectMessagesChatTopic. +//-Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +//@chat_id Chat identifier of the channel direct messages chat +//@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached +loadDirectMessagesChatTopics chat_id:int53 limit:int32 = Ok; + +//@description Returns information about the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic to get +getDirectMessagesChatTopic chat_id:int53 topic_id:int53 = DirectMessagesChatTopic; + +//@description Returns messages in the topic in a channel direct messages chat administered by the current user. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be fetched +//@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message +//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +getDirectMessagesChatTopicHistory chat_id:int53 topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; + +//@description Returns the last message sent in the topic in a channel direct messages chat administered by the current user no later than the specified date +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be fetched +//@date Point in time (Unix timestamp) relative to which to search for messages +getDirectMessagesChatTopicMessageByDate chat_id:int53 topic_id:int53 date:int32 = Message; + +//@description Deletes all messages in the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be deleted +deleteDirectMessagesChatTopicHistory chat_id:int53 topic_id:int53 = Ok; + +//@description Deletes all messages between the specified dates in the topic in a channel direct messages chat administered by the current user. Messages sent in the last 30 seconds will not be deleted +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Identifier of the topic which messages will be deleted +//@min_date The minimum date of the messages to delete +//@max_date The maximum date of the messages to delete +deleteDirectMessagesChatTopicMessagesByDate chat_id:int53 topic_id:int53 min_date:int32 max_date:int32 = Ok; + +//@description Changes the marked as unread state of the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier of the channel direct messages chat +//@topic_id Topic identifier +//@is_marked_as_unread New value of is_marked_as_unread +setDirectMessagesChatTopicIsMarkedAsUnread chat_id:int53 topic_id:int53 is_marked_as_unread:Bool = Ok; + +//@description Changes the draft message in the topic in a channel direct messages chat administered by the current user +//@chat_id Chat identifier +//@topic_id Topic identifier +//@draft_message New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored +setDirectMessagesChatTopicDraftMessage chat_id:int53 topic_id:int53 draft_message:draftMessage = Ok; + +//@description Removes all pinned messages from the topic in a channel direct messages chat administered by the current user +//@chat_id Identifier of the chat +//@topic_id Topic identifier +unpinAllDirectMessagesChatTopicMessages chat_id:int53 topic_id:int53 = Ok; + +//@description Removes all unread reactions in the topic in a channel direct messages chat administered by the current user +//@chat_id Identifier of the chat +//@topic_id Topic identifier +readAllDirectMessagesChatTopicReactions chat_id:int53 topic_id:int53 = Ok; + + //@description Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded //@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached loadSavedMessagesTopics limit:int32 = Ok; @@ -9464,8 +9593,9 @@ deleteChat chat_id:int53 = Ok; //@description Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query //-(searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. -//-A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation +//-A combination of query, sender_id, filter and topic_id search criteria is expected to be supported, only if it is required for Telegram official application implementation //@chat_id Identifier of the chat in which to search messages +//@topic_id Pass topic identifier to search messages only in specific topic; pass null to search for messages in all topics //@query Query to search for //@sender_id Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message @@ -9473,9 +9603,7 @@ deleteChat chat_id:int53 = Ok; //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages -//@message_thread_id If not 0, only messages in the specified thread will be returned; supergroups only -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages -searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = FoundChatMessages; +searchChatMessages chat_id:int53 topic_id:MessageTopic query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter = FoundChatMessages; //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit @@ -9577,25 +9705,24 @@ getChatSparseMessagePositions chat_id:int53 filter:SearchMessagesFilter from_mes //@description Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" //@chat_id Identifier of the chat in which to return information about messages +//@topic_id Pass topic identifier to get the result only in specific topic; pass null to get the result in all topics; forum topics aren't supported //@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about messages; use 0 to get results from the last message -//@saved_messages_topic_id If not0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages -getChatMessageCalendar chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 saved_messages_topic_id:int53 = MessageCalendar; +getChatMessageCalendar chat_id:int53 topic_id:MessageTopic filter:SearchMessagesFilter from_message_id:int53 = MessageCalendar; -//@description Returns approximate number of messages of the specified type in the chat +//@description Returns approximate number of messages of the specified type in the chat or its topic //@chat_id Identifier of the chat in which to count messages +//@topic_id Pass topic identifier to get number of messages only in specific topic; pass null to get number of messages in all topics //@filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages //@return_local Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally -getChatMessageCount chat_id:int53 filter:SearchMessagesFilter saved_messages_topic_id:int53 return_local:Bool = Count; +getChatMessageCount chat_id:int53 topic_id:MessageTopic filter:SearchMessagesFilter return_local:Bool = Count; -//@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats +//@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat and topic. Cannot be used in secret chats //@chat_id Identifier of the chat in which to find message position -//@message_id Message identifier +//@topic_id Pass topic identifier to get position among messages only in specific topic; pass null to get position among all chat messages //@filter Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function -//@message_thread_id If not 0, only messages in the specified thread will be considered; supergroups only -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages -getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = Count; +//@message_id Message identifier +getChatMessagePosition chat_id:int53 topic_id:MessageTopic filter:SearchMessagesFilter message_id:int53 = Count; //@description Returns all scheduled messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; @@ -9732,7 +9859,7 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:Inpu //@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if messageProperties.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options //@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. -//-Use messageProperties.can_be_saved and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable +//-Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; @@ -9754,7 +9881,7 @@ resendMessages chat_id:int53 message_ids:vector quote:inputTextQuote paid sendChatScreenshotTakenNotification chat_id:int53 = Ok; //@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message -//@chat_id Target chat +//@chat_id Target chat; channel direct messages chats aren't supported //@sender_id Identifier of the sender of the message //@reply_to Information about the message or story to be replied; pass null if none //@disable_notification Pass true to disable notification for the message @@ -10405,10 +10532,11 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats //@bot_user_id Identifier of the bot, providing the Web App. If the bot is restricted for the current user, then show an error instead of calling the method //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise -//@message_thread_id If not 0, the message thread identifier in which the message will be sent +//@message_thread_id If not 0, the message thread identifier to which the message will be sent +//@direct_messages_chat_topic_id If not 0, unique identifier of the topic of channel direct messages chat to which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none //@parameters Parameters to use to open the Web App -openWebApp chat_id:int53 bot_user_id:int53 url:string message_thread_id:int53 reply_to:InputMessageReplyTo parameters:webAppOpenParameters = WebAppInfo; +openWebApp chat_id:int53 bot_user_id:int53 url:string message_thread_id:int53 direct_messages_chat_topic_id:int53 reply_to:InputMessageReplyTo parameters:webAppOpenParameters = WebAppInfo; //@description Informs TDLib that a previously opened Web App was closed @web_app_launch_id Identifier of Web App launch, received from openWebApp closeWebApp web_app_launch_id:int64 = Ok; @@ -10754,6 +10882,13 @@ setChatDescription chat_id:int53 description:string = Ok; //-Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that setChatDiscussionGroup chat_id:int53 discussion_chat_id:int53 = Ok; +//@description Changes direct messages group settings for a channel chat; requires owner privileges in the chat +//@chat_id Identifier of the channel chat +//@is_enabled Pass true if the direct messages group is enabled for the channel chat; pass false otherwise +//@paid_message_star_count The new number of Telegram Stars that must be paid for each message that is sent to the direct messages chat unless the sender is an administrator of the channel chat; 0-getOption("paid_message_star_count_max"). +//-The channel will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. Requires supergroupFullInfo.can_enable_paid_messages for positive amounts +setChatDirectMessagesGroup chat_id:int53 is_enabled:Bool paid_message_star_count:int53 = Ok; + //@description Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use @chat_id Chat identifier @location New location for the chat; must be valid and not null setChatLocation chat_id:int53 location:chatLocation = Ok; @@ -11202,7 +11337,7 @@ searchFileDownloads query:string only_active:Bool only_completed:Bool offset:str //@description Application or reCAPTCHA verification has been completed. Can be called before authorization //@verification_id Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired //@token Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; -//-pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request +//-pass an empty string to abort verification and receive the error "VERIFICATION_FAILED" for the request setApplicationVerificationToken verification_id:int53 token:string = Ok; @@ -11462,11 +11597,11 @@ toggleGroupCallIsMyVideoPaused group_call_id:int32 is_my_video_paused:Bool = Ok; //@description Toggles whether current user's video is enabled @group_call_id Group call identifier @is_my_video_enabled Pass true if the current user's video is enabled toggleGroupCallIsMyVideoEnabled group_call_id:int32 is_my_video_enabled:Bool = Ok; -//@description Informs TDLib that speaking state of a participant of an active group call has changed +//@description Informs TDLib that speaking state of a participant of an active group call has changed. Returns identifier of the participant if it is found //@group_call_id Group call identifier //@audio_source Group call participant's synchronization audio source identifier, or 0 for the current user //@is_speaking Pass true if the user is speaking -setGroupCallParticipantIsSpeaking group_call_id:int32 audio_source:int32 is_speaking:Bool = Ok; +setGroupCallParticipantIsSpeaking group_call_id:int32 audio_source:int32 is_speaking:Bool = MessageSender; //@description Toggles whether a participant of an active group call is muted, unmuted, or allowed to unmute themselves //@group_call_id Group call identifier @@ -12164,8 +12299,11 @@ toggleSupergroupHasHiddenMembers supergroup_id:int53 has_hidden_members:Bool = O //@has_aggressive_anti_spam_enabled The new value of has_aggressive_anti_spam_enabled toggleSupergroupHasAggressiveAntiSpamEnabled supergroup_id:int53 has_aggressive_anti_spam_enabled:Bool = Ok; -//@description Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums @supergroup_id Identifier of the supergroup @is_forum New value of is_forum -toggleSupergroupIsForum supergroup_id:int53 is_forum:Bool = Ok; +//@description Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums +//@supergroup_id Identifier of the supergroup +//@is_forum New value of is_forum +//@has_forum_tabs New value of has_forum_tabs; ignored if is_forum is false +toggleSupergroupIsForum supergroup_id:int53 is_forum:Bool has_forum_tabs:Bool = Ok; //@description Upgrades supergroup to a broadcast group; requires owner privileges in the supergroup @supergroup_id Identifier of the supergroup toggleSupergroupIsBroadcastGroup supergroup_id:int53 = Ok; From 51f3ce0659570178da6a644de60f54b4e99fdde4 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Wed, 2 Jul 2025 23:52:52 +0800 Subject: [PATCH 03/11] Update to TDLib 1.8.51 --- client/function.go | 340 +++++++++++++++++++++++++++- client/type.go | 501 ++++++++++++++++++++++++++++++++++++++++-- client/unmarshaler.go | 197 ++++++++++++++++- data/td_api.tl | 187 ++++++++++++++-- 4 files changed, 1181 insertions(+), 44 deletions(-) diff --git a/client/function.go b/client/function.go index 072145a..c2e9384 100755 --- a/client/function.go +++ b/client/function.go @@ -1429,7 +1429,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively. Returns a 404 error if the message doesn't exist +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, the checklist message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, and topic messages without non-bundled replied message respectively. Returns a 404 error if the message doesn't exist func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -2768,6 +2768,70 @@ func (client *Client) ReadAllDirectMessagesChatTopicReactions(req *ReadAllDirect return UnmarshalOk(result.Data) } +type GetDirectMessagesChatTopicRevenueRequest struct { + // Chat identifier of the channel direct messages chat administered by the current user + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId int64 `json:"topic_id"` +} + +// Returns the total number of Telegram Stars received by the channel chat for direct messages from the given topic +func (client *Client) GetDirectMessagesChatTopicRevenue(req *GetDirectMessagesChatTopicRevenueRequest) (*StarCount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicRevenue", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarCount(result.Data) +} + +type ToggleDirectMessagesChatTopicCanSendUnpaidMessagesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId int64 `json:"topic_id"` + // Pass true to allow unpaid messages; pass false to disallow unpaid messages + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` + // Pass true to refund the user previously paid messages + RefundPayments bool `json:"refund_payments"` +} + +// Allows to send unpaid messages to the given topic of the channel direct messages chat administered by the current user +func (client *Client) ToggleDirectMessagesChatTopicCanSendUnpaidMessages(req *ToggleDirectMessagesChatTopicCanSendUnpaidMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleDirectMessagesChatTopicCanSendUnpaidMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "can_send_unpaid_messages": req.CanSendUnpaidMessages, + "refund_payments": req.RefundPayments, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type LoadSavedMessagesTopicsRequest struct { // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached Limit int32 `json:"limit"` @@ -4075,6 +4139,134 @@ func (client *Client) ReportSponsoredChat(req *ReportSponsoredChatRequest) (Repo } } +type GetVideoMessageAdvertisementsRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns advertisements to be shown while a video from a message is watched. Available only if messageProperties.can_get_video_advertisements +func (client *Client) GetVideoMessageAdvertisements(req *GetVideoMessageAdvertisementsRequest) (*VideoMessageAdvertisements, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getVideoMessageAdvertisements", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalVideoMessageAdvertisements(result.Data) +} + +type ViewVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` +} + +// Informs TDLib that the user viewed a video message advertisement +func (client *Client) ViewVideoMessageAdvertisement(req *ViewVideoMessageAdvertisementRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "viewVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ClickVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` +} + +// Informs TDLib that the user clicked a video message advertisement +func (client *Client) ClickVideoMessageAdvertisement(req *ClickVideoMessageAdvertisementRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clickVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` +} + +// Reports a video message advertisement to Telegram moderators +func (client *Client) ReportVideoMessageAdvertisement(req *ReportVideoMessageAdvertisementRequest) (ReportSponsoredResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + "option_id": req.OptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(result.Data) + + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(result.Data) + + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(result.Data) + + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(result.Data) + + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type RemoveNotificationRequest struct { // Identifier of notification group to which the notification belongs NotificationGroupId int32 `json:"notification_group_id"` @@ -4911,6 +5103,41 @@ func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationReques return UnmarshalMessage(result.Data) } +type EditMessageChecklistRequest struct { + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The new checklist. If some tasks were completed, this information will be kept + Checklist *InputChecklist `json:"checklist"` +} + +// Edits the message content of a checklist. Returns the edited message after the edit is completed on the server side +func (client *Client) EditMessageChecklist(req *EditMessageChecklistRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageChecklist", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "checklist": req.Checklist, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + type EditMessageMediaRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` @@ -5425,6 +5652,44 @@ func (client *Client) EditBusinessMessageLiveLocation(req *EditBusinessMessageLi return UnmarshalBusinessMessage(result.Data) } +type EditBusinessMessageChecklistRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The new checklist. If some tasks were completed, this information will be kept + Checklist *InputChecklist `json:"checklist"` +} + +// Edits the content of a checklist in a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageChecklist(req *EditBusinessMessageChecklistRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageChecklist", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "checklist": req.Checklist, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + type EditBusinessMessageMediaRequest struct { // Unique identifier of business connection on behalf of which the message was sent BusinessConnectionId string `json:"business_connection_id"` @@ -6137,7 +6402,7 @@ type AddQuickReplyShortcutMessageRequest struct { ShortcutName string `json:"shortcut_name"` // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` - // The content of the message to be added; inputMessagePoll, inputMessageForwarded and inputMessageLocation with live_period aren't supported + // The content of the message to be added; inputMessagePaidMedia, inputMessageForwarded and inputMessageLocation with live_period aren't supported InputMessageContent InputMessageContent `json:"input_message_content"` } @@ -6268,11 +6533,11 @@ type EditQuickReplyMessageRequest struct { ShortcutId int32 `json:"shortcut_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo + // New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageChecklist, inputMessageDocument, inputMessagePhoto, inputMessageText, or inputMessageVideo InputMessageContent InputMessageContent `json:"input_message_content"` } -// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Media message can be edited only to a media message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Media message can be edited only to a media message. Checklist messages can be edited only to a checklist message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa func (client *Client) EditQuickReplyMessage(req *EditQuickReplyMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7719,6 +7984,73 @@ func (client *Client) StopPoll(req *StopPollRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type AddChecklistTasksRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the checklist. Use messageProperties.can_add_tasks to check whether the tasks can be added + MessageId int64 `json:"message_id"` + // List of added tasks + Tasks []*InputChecklistTask `json:"tasks"` +} + +// Adds tasks to a checklist in a message +func (client *Client) AddChecklistTasks(req *AddChecklistTasksRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addChecklistTasks", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "tasks": req.Tasks, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type MarkChecklistTasksAsDoneRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the checklist. Use messageProperties.can_mark_tasks_as_done to check whether the tasks can be marked as done or not done + MessageId int64 `json:"message_id"` + // Identifiers of tasks that were marked as done + MarkedAsDoneTaskIds []int32 `json:"marked_as_done_task_ids"` + // Identifiers of tasks that were marked as not done + MarkedAsNotDoneTaskIds []int32 `json:"marked_as_not_done_task_ids"` +} + +// Adds tasks of a checklist in a message as done or not done +func (client *Client) MarkChecklistTasksAsDone(req *MarkChecklistTasksAsDoneRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "markChecklistTasksAsDone", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "marked_as_done_task_ids": req.MarkedAsDoneTaskIds, + "marked_as_not_done_task_ids": req.MarkedAsNotDoneTaskIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type HideSuggestedActionRequest struct { // Suggested action to hide Action SuggestedAction `json:"action"` diff --git a/client/type.go b/client/type.go index 2fd662d..9f487c5 100755 --- a/client/type.go +++ b/client/type.go @@ -200,6 +200,10 @@ const ( ClassClosedVectorPath = "ClosedVectorPath" ClassOutline = "Outline" ClassPollOption = "PollOption" + ClassChecklistTask = "ChecklistTask" + ClassInputChecklistTask = "InputChecklistTask" + ClassChecklist = "Checklist" + ClassInputChecklist = "InputChecklist" ClassAnimation = "Animation" ClassAudio = "Audio" ClassDocument = "Document" @@ -216,6 +220,7 @@ const ( ClassWebApp = "WebApp" ClassPoll = "Poll" ClassAlternativeVideo = "AlternativeVideo" + ClassVideoStoryboard = "VideoStoryboard" ClassBackground = "Background" ClassBackgrounds = "Backgrounds" ClassChatBackground = "ChatBackground" @@ -357,11 +362,13 @@ const ( ClassMessageCalendar = "MessageCalendar" ClassBusinessMessage = "BusinessMessage" ClassBusinessMessages = "BusinessMessages" - ClassMessageSponsor = "MessageSponsor" + ClassAdvertisementSponsor = "AdvertisementSponsor" ClassSponsoredMessage = "SponsoredMessage" ClassSponsoredMessages = "SponsoredMessages" ClassSponsoredChat = "SponsoredChat" ClassSponsoredChats = "SponsoredChats" + ClassVideoMessageAdvertisement = "VideoMessageAdvertisement" + ClassVideoMessageAdvertisements = "VideoMessageAdvertisements" ClassReportOption = "ReportOption" ClassFileDownload = "FileDownload" ClassDownloadedFileCounts = "DownloadedFileCounts" @@ -704,6 +711,10 @@ const ( TypePollOption = "pollOption" TypePollTypeRegular = "pollTypeRegular" TypePollTypeQuiz = "pollTypeQuiz" + TypeChecklistTask = "checklistTask" + TypeInputChecklistTask = "inputChecklistTask" + TypeChecklist = "checklist" + TypeInputChecklist = "inputChecklist" TypeAnimation = "animation" TypeAudio = "audio" TypeDocument = "document" @@ -720,6 +731,7 @@ const ( TypeWebApp = "webApp" TypePoll = "poll" TypeAlternativeVideo = "alternativeVideo" + TypeVideoStoryboard = "videoStoryboard" TypeBackground = "background" TypeBackgrounds = "backgrounds" TypeChatBackground = "chatBackground" @@ -1004,11 +1016,13 @@ const ( TypeMessageSourceNotification = "messageSourceNotification" TypeMessageSourceScreenshot = "messageSourceScreenshot" TypeMessageSourceOther = "messageSourceOther" - TypeMessageSponsor = "messageSponsor" + TypeAdvertisementSponsor = "advertisementSponsor" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" TypeSponsoredChat = "sponsoredChat" TypeSponsoredChats = "sponsoredChats" + TypeVideoMessageAdvertisement = "videoMessageAdvertisement" + TypeVideoMessageAdvertisements = "videoMessageAdvertisements" TypeReportOption = "reportOption" TypeReportSponsoredResultOk = "reportSponsoredResultOk" TypeReportSponsoredResultFailed = "reportSponsoredResultFailed" @@ -1344,6 +1358,7 @@ const ( TypeMessageGame = "messageGame" TypeMessagePoll = "messagePoll" TypeMessageStory = "messageStory" + TypeMessageChecklist = "messageChecklist" TypeMessageInvoice = "messageInvoice" TypeMessageCall = "messageCall" TypeMessageGroupCall = "messageGroupCall" @@ -1392,6 +1407,8 @@ const ( TypeMessagePaidMessagesRefunded = "messagePaidMessagesRefunded" TypeMessagePaidMessagePriceChanged = "messagePaidMessagePriceChanged" TypeMessageDirectMessagePriceChanged = "messageDirectMessagePriceChanged" + TypeMessageChecklistTasksDone = "messageChecklistTasksDone" + TypeMessageChecklistTasksAdded = "messageChecklistTasksAdded" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1453,6 +1470,7 @@ const ( TypeInputMessageInvoice = "inputMessageInvoice" TypeInputMessagePoll = "inputMessagePoll" TypeInputMessageStory = "inputMessageStory" + TypeInputMessageChecklist = "inputMessageChecklist" TypeInputMessageForwarded = "inputMessageForwarded" TypeMessageProperties = "messageProperties" TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty" @@ -1800,6 +1818,7 @@ const ( TypePremiumFeatureLastSeenTimes = "premiumFeatureLastSeenTimes" TypePremiumFeatureBusiness = "premiumFeatureBusiness" TypePremiumFeatureMessageEffects = "premiumFeatureMessageEffects" + TypePremiumFeatureChecklists = "premiumFeatureChecklists" TypeBusinessFeatureLocation = "businessFeatureLocation" TypeBusinessFeatureOpeningHours = "businessFeatureOpeningHours" TypeBusinessFeatureQuickReplies = "businessFeatureQuickReplies" @@ -1919,6 +1938,7 @@ const ( TypePushMessageContentSticker = "pushMessageContentSticker" TypePushMessageContentStory = "pushMessageContentStory" TypePushMessageContentText = "pushMessageContentText" + TypePushMessageContentChecklist = "pushMessageContentChecklist" TypePushMessageContentVideo = "pushMessageContentVideo" TypePushMessageContentVideoNote = "pushMessageContentVideoNote" TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote" @@ -1937,6 +1957,8 @@ const ( TypePushMessageContentRecurringPayment = "pushMessageContentRecurringPayment" TypePushMessageContentSuggestProfilePhoto = "pushMessageContentSuggestProfilePhoto" TypePushMessageContentProximityAlertTriggered = "pushMessageContentProximityAlertTriggered" + TypePushMessageContentChecklistTasksAdded = "pushMessageContentChecklistTasksAdded" + TypePushMessageContentChecklistTasksDone = "pushMessageContentChecklistTasksDone" TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards" TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum" TypeNotificationTypeNewMessage = "notificationTypeNewMessage" @@ -5493,6 +5515,122 @@ func (*PollTypeQuiz) PollTypeType() string { return TypePollTypeQuiz } +// Describes a task in a checklist +type ChecklistTask struct { + meta + // Unique identifier of the task + Id int32 `json:"id"` + // Text of the task; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Url, EmailAddress, Mention, Hashtag, Cashtag and PhoneNumber entities + Text *FormattedText `json:"text"` + // Identifier of the user that completed the task; 0 if the task isn't completed + CompletedByUserId int64 `json:"completed_by_user_id"` + // Point in time (Unix timestamp) when the task was completed; 0 if the task isn't completed + CompletionDate int32 `json:"completion_date"` +} + +func (entity *ChecklistTask) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChecklistTask + + return json.Marshal((*stub)(entity)) +} + +func (*ChecklistTask) GetClass() string { + return ClassChecklistTask +} + +func (*ChecklistTask) GetType() string { + return TypeChecklistTask +} + +// Describes a task in a checklist to be sent +type InputChecklistTask struct { + meta + // Unique identifier of the task; must be positive + Id int32 `json:"id"` + // Text of the task; 1-getOption("checklist_task_text_length_max") characters without line feeds. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Text *FormattedText `json:"text"` +} + +func (entity *InputChecklistTask) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChecklistTask + + return json.Marshal((*stub)(entity)) +} + +func (*InputChecklistTask) GetClass() string { + return ClassInputChecklistTask +} + +func (*InputChecklistTask) GetType() string { + return TypeInputChecklistTask +} + +// Describes a checklist +type Checklist struct { + meta + // Title of the checklist; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Title *FormattedText `json:"title"` + // List of tasks in the checklist + Tasks []*ChecklistTask `json:"tasks"` + // True, if users other than creator of the list can add tasks to the list + OthersCanAddTasks bool `json:"others_can_add_tasks"` + // True, if the current user can add tasks to the list if they have Telegram Premium subscription + CanAddTasks bool `json:"can_add_tasks"` + // True, if users other than creator of the list can mark tasks as done or not done. If true, then the checklist is called "group checklist" + OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done"` + // True, if the current user can mark tasks as done or not done if they have Telegram Premium subscription + CanMarkTasksAsDone bool `json:"can_mark_tasks_as_done"` +} + +func (entity *Checklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Checklist + + return json.Marshal((*stub)(entity)) +} + +func (*Checklist) GetClass() string { + return ClassChecklist +} + +func (*Checklist) GetType() string { + return TypeChecklist +} + +// Describes a checklist to be sent +type InputChecklist struct { + meta + // Title of the checklist; 1-getOption("checklist_title_length_max") characters. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Title *FormattedText `json:"title"` + // List of tasks in the checklist; 1-getOption("checklist_task_count_max") tasks + Tasks []*InputChecklistTask `json:"tasks"` + // True, if other users can add tasks to the list + OthersCanAddTasks bool `json:"others_can_add_tasks"` + // True, if other users can mark tasks as done or not done + OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done"` +} + +func (entity *InputChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*InputChecklist) GetClass() string { + return ClassInputChecklist +} + +func (*InputChecklist) GetType() string { + return TypeInputChecklist +} + // Describes an animation file. The animation must be encoded in GIF or MPEG4 format type Animation struct { meta @@ -6163,6 +6301,35 @@ func (*AlternativeVideo) GetType() string { return TypeAlternativeVideo } +// Describes a storyboard for a video +type VideoStoryboard struct { + meta + // A JPEG file that contains tiled previews of video + StoryboardFile *File `json:"storyboard_file"` + // Width of a tile + Width int32 `json:"width"` + // Height of a tile + Height int32 `json:"height"` + // File that describes mapping of position in the video to a tile in the JPEG file + MapFile *File `json:"map_file"` +} + +func (entity *VideoStoryboard) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoStoryboard + + return json.Marshal((*stub)(entity)) +} + +func (*VideoStoryboard) GetClass() string { + return ClassVideoStoryboard +} + +func (*VideoStoryboard) GetType() string { + return TypeVideoStoryboard +} + // Describes a chat background type Background struct { meta @@ -7600,7 +7767,7 @@ type ChatPermissions struct { CanSendVideoNotes bool `json:"can_send_video_notes"` // True, if the user can send voice notes CanSendVoiceNotes bool `json:"can_send_voice_notes"` - // True, if the user can send polls + // True, if the user can send polls and checklists CanSendPolls bool `json:"can_send_polls"` // True, if the user can send stickers. Implies can_send_messages permissions CanSendStickers bool `json:"can_send_stickers"` @@ -13352,6 +13519,8 @@ type SupergroupFullInfo struct { MyBoostCount int32 `json:"my_boost_count"` // Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` + // Number of Telegram Stars that must be paid by the current user for each sent message to the supergroup + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` // Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none StickerSetId JsonInt64 `json:"sticker_set_id"` // Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none @@ -14872,7 +15041,7 @@ type MessageReplyToMessage struct { Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat OriginSendDate int32 `json:"origin_send_date"` - // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote + // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote Content MessageContent `json:"content"` } @@ -15766,31 +15935,31 @@ func (*MessageSourceOther) MessageSourceType() string { return TypeMessageSourceOther } -// Information about the sponsor of a message -type MessageSponsor struct { +// Information about the sponsor of an advertisement +type AdvertisementSponsor struct { meta - // URL of the sponsor to be opened when the message is clicked + // URL of the sponsor to be opened when the advertisement is clicked Url string `json:"url"` // Photo of the sponsor; may be null if must not be shown Photo *Photo `json:"photo"` - // Additional optional information about the sponsor to be shown along with the message + // Additional optional information about the sponsor to be shown along with the advertisement Info string `json:"info"` } -func (entity *MessageSponsor) MarshalJSON() ([]byte, error) { +func (entity *AdvertisementSponsor) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageSponsor + type stub AdvertisementSponsor return json.Marshal((*stub)(entity)) } -func (*MessageSponsor) GetClass() string { - return ClassMessageSponsor +func (*AdvertisementSponsor) GetClass() string { + return ClassAdvertisementSponsor } -func (*MessageSponsor) GetType() string { - return TypeMessageSponsor +func (*AdvertisementSponsor) GetType() string { + return TypeAdvertisementSponsor } // Describes a sponsored message @@ -15805,7 +15974,7 @@ type SponsoredMessage struct { // Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo. Video messages can be viewed fullscreen Content MessageContent `json:"content"` // Information about the sponsor of the message - Sponsor *MessageSponsor `json:"sponsor"` + Sponsor *AdvertisementSponsor `json:"sponsor"` // Title of the sponsored message Title string `json:"title"` // Text for the message action button @@ -15840,7 +16009,7 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { IsRecommended bool `json:"is_recommended"` CanBeReported bool `json:"can_be_reported"` Content json.RawMessage `json:"content"` - Sponsor *MessageSponsor `json:"sponsor"` + Sponsor *AdvertisementSponsor `json:"sponsor"` Title string `json:"title"` ButtonText string `json:"button_text"` AccentColorId int32 `json:"accent_color_id"` @@ -15946,6 +16115,70 @@ func (*SponsoredChats) GetType() string { return TypeSponsoredChats } +// Describes an advertisent to be shown while a video from a message is watched +type VideoMessageAdvertisement struct { + meta + // Unique identifier of this result + UniqueId int64 `json:"unique_id"` + // Text of the advertisement + Text string `json:"text"` + // The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds + MinDisplayDuration int32 `json:"min_display_duration"` + // The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds + MaxDisplayDuration int32 `json:"max_display_duration"` + // True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement + CanBeReported bool `json:"can_be_reported"` + // Information about the sponsor of the advertisement + Sponsor *AdvertisementSponsor `json:"sponsor"` + // Title of the sponsored message + Title string `json:"title"` + // If non-empty, additional information about the sponsored message to be shown along with the message + AdditionalInfo string `json:"additional_info"` +} + +func (entity *VideoMessageAdvertisement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoMessageAdvertisement + + return json.Marshal((*stub)(entity)) +} + +func (*VideoMessageAdvertisement) GetClass() string { + return ClassVideoMessageAdvertisement +} + +func (*VideoMessageAdvertisement) GetType() string { + return TypeVideoMessageAdvertisement +} + +// Contains a list of advertisements to be shown while a video from a message is watched +type VideoMessageAdvertisements struct { + meta + // List of advertisements + Advertisements []*VideoMessageAdvertisement `json:"advertisements"` + // Delay before the first advertisement is shown, in seconds + StartDelay int32 `json:"start_delay"` + // Delay between consecutive advertisements, in seconds + BetweenDelay int32 `json:"between_delay"` +} + +func (entity *VideoMessageAdvertisements) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoMessageAdvertisements + + return json.Marshal((*stub)(entity)) +} + +func (*VideoMessageAdvertisements) GetClass() string { + return ClassVideoMessageAdvertisements +} + +func (*VideoMessageAdvertisements) GetType() string { + return TypeVideoMessageAdvertisements +} + // Describes an option to report an entity to Telegram type ReportOption struct { meta @@ -19168,6 +19401,8 @@ type DirectMessagesChatTopic struct { SenderId MessageSender `json:"sender_id"` // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order Order JsonInt64 `json:"order"` + // True, if the other party can send unpaid messages even if the chat has paid messages enabled + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` // True, if the forum topic is marked as unread IsMarkedAsUnread bool `json:"is_marked_as_unread"` // Number of unread messages in the chat @@ -19206,6 +19441,7 @@ func (directMessagesChatTopic *DirectMessagesChatTopic) UnmarshalJSON(data []byt Id int64 `json:"id"` SenderId json.RawMessage `json:"sender_id"` Order JsonInt64 `json:"order"` + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` IsMarkedAsUnread bool `json:"is_marked_as_unread"` UnreadCount int64 `json:"unread_count"` LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` @@ -19223,6 +19459,7 @@ func (directMessagesChatTopic *DirectMessagesChatTopic) UnmarshalJSON(data []byt directMessagesChatTopic.ChatId = tmp.ChatId directMessagesChatTopic.Id = tmp.Id directMessagesChatTopic.Order = tmp.Order + directMessagesChatTopic.CanSendUnpaidMessages = tmp.CanSendUnpaidMessages directMessagesChatTopic.IsMarkedAsUnread = tmp.IsMarkedAsUnread directMessagesChatTopic.UnreadCount = tmp.UnreadCount directMessagesChatTopic.LastReadInboxMessageId = tmp.LastReadInboxMessageId @@ -26677,6 +26914,8 @@ type MessageVideo struct { Video *Video `json:"video"` // Alternative qualities of the video AlternativeVideos []*AlternativeVideo `json:"alternative_videos"` + // Available storyboards for the video + Storyboards []*VideoStoryboard `json:"storyboards"` // Cover of the video; may be null if none Cover *Photo `json:"cover"` // Timestamp from which the video playing must start, in seconds @@ -27138,6 +27377,33 @@ func (*MessageStory) MessageContentType() string { return TypeMessageStory } +// A message with a checklist +type MessageChecklist struct { + meta + // The checklist description + List *Checklist `json:"list"` +} + +func (entity *MessageChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklist) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklist) GetType() string { + return TypeMessageChecklist +} + +func (*MessageChecklist) MessageContentType() string { + return TypeMessageChecklist +} + // A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice type MessageInvoice struct { meta @@ -28990,6 +29256,66 @@ func (*MessageDirectMessagePriceChanged) MessageContentType() string { return TypeMessageDirectMessagePriceChanged } +// Some tasks from a checklist were marked as done or not done +type MessageChecklistTasksDone struct { + meta + // Identifier of the message with the checklist; can be 0 if the message was deleted + ChecklistMessageId int64 `json:"checklist_message_id"` + // Identifiers of tasks that were marked as done + MarkedAsDoneTaskIds []int32 `json:"marked_as_done_task_ids"` + // Identifiers of tasks that were marked as not done + MarkedAsNotDoneTaskIds []int32 `json:"marked_as_not_done_task_ids"` +} + +func (entity *MessageChecklistTasksDone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklistTasksDone + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklistTasksDone) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklistTasksDone) GetType() string { + return TypeMessageChecklistTasksDone +} + +func (*MessageChecklistTasksDone) MessageContentType() string { + return TypeMessageChecklistTasksDone +} + +// Some tasks were added to a checklist +type MessageChecklistTasksAdded struct { + meta + // Identifier of the message with the checklist; can be 0 if the message was deleted + ChecklistMessageId int64 `json:"checklist_message_id"` + // List of tasks added to the checklist + Tasks []*ChecklistTask `json:"tasks"` +} + +func (entity *MessageChecklistTasksAdded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklistTasksAdded + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklistTasksAdded) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklistTasksAdded) GetType() string { + return TypeMessageChecklistTasksAdded +} + +func (*MessageChecklistTasksAdded) MessageContentType() string { + return TypeMessageChecklistTasksAdded +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -31227,6 +31553,33 @@ func (*InputMessageStory) InputMessageContentType() string { return TypeInputMessageStory } +// A message with a checklist. Checklists can't be sent to secret chats, channel chats and channel direct messages chats; for Telegram Premium users only +type InputMessageChecklist struct { + meta + // The checklist to send + Checklist *InputChecklist `json:"checklist"` +} + +func (entity *InputMessageChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageChecklist) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageChecklist) GetType() string { + return TypeInputMessageChecklist +} + +func (*InputMessageChecklist) InputMessageContentType() string { + return TypeInputMessageChecklist +} + // A forwarded message type InputMessageForwarded struct { meta @@ -31267,6 +31620,8 @@ func (*InputMessageForwarded) InputMessageContentType() string { // Contains properties of a message and describes actions that can be done with the message right now type MessageProperties struct { meta + // True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription + CanAddTasks bool `json:"can_add_tasks"` // True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options CanBeCopied bool `json:"can_be_copied"` // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options @@ -31275,7 +31630,7 @@ type MessageProperties struct { CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` // True, if the message can be deleted for all users using the method deleteMessages with revoke == true CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message + // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location, poll, and checklist messages this fields shows whether editMessageLiveLocation, stopPoll, or editMessageChecklist respectively can be used with this message CanBeEdited bool `json:"can_be_edited"` // True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options CanBeForwarded bool `json:"can_be_forwarded"` @@ -31309,8 +31664,12 @@ type MessageProperties struct { CanGetReadDate bool `json:"can_get_read_date"` // True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards CanGetStatistics bool `json:"can_get_statistics"` + // True, if advertisements for video of the message can be received though getVideoMessageAdvertisements + CanGetVideoAdvertisements bool `json:"can_get_video_advertisements"` // True, if chat members already viewed the message can be received through getMessageViewers CanGetViewers bool `json:"can_get_viewers"` + // True, if tasks can be marked as done or not done in the message's checklist using markChecklistTasksAsDone if the current user has Telegram Premium subscription + CanMarkTasksAsDone bool `json:"can_mark_tasks_as_done"` // True, if speech can be recognized for the message through recognizeSpeech CanRecognizeSpeech bool `json:"can_recognize_speech"` // True, if the message can be reported using reportChat @@ -42570,6 +42929,31 @@ func (*PremiumFeatureMessageEffects) PremiumFeatureType() string { return TypePremiumFeatureMessageEffects } +// The ability to create and use checklist messages +type PremiumFeatureChecklists struct{ + meta +} + +func (entity *PremiumFeatureChecklists) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureChecklists + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureChecklists) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureChecklists) GetType() string { + return TypePremiumFeatureChecklists +} + +func (*PremiumFeatureChecklists) PremiumFeatureType() string { + return TypePremiumFeatureChecklists +} + // The ability to set location type BusinessFeatureLocation struct{ meta @@ -46085,6 +46469,35 @@ func (*PushMessageContentText) PushMessageContentType() string { return TypePushMessageContentText } +// A message with a checklist +type PushMessageContentChecklist struct { + meta + // Checklist title + Title string `json:"title"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklist) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklist) GetType() string { + return TypePushMessageContentChecklist +} + +func (*PushMessageContentChecklist) PushMessageContentType() string { + return TypePushMessageContentChecklist +} + // A video message type PushMessageContentVideo struct { meta @@ -46575,6 +46988,60 @@ func (*PushMessageContentProximityAlertTriggered) PushMessageContentType() strin return TypePushMessageContentProximityAlertTriggered } +// Some tasks were added to a checklist +type PushMessageContentChecklistTasksAdded struct { + meta + // Number of added tasks + TaskCount int32 `json:"task_count"` +} + +func (entity *PushMessageContentChecklistTasksAdded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklistTasksAdded + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklistTasksAdded) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklistTasksAdded) GetType() string { + return TypePushMessageContentChecklistTasksAdded +} + +func (*PushMessageContentChecklistTasksAdded) PushMessageContentType() string { + return TypePushMessageContentChecklistTasksAdded +} + +// Some tasks from a checklist were marked as done or not done +type PushMessageContentChecklistTasksDone struct { + meta + // Number of changed tasks + TaskCount int32 `json:"task_count"` +} + +func (entity *PushMessageContentChecklistTasksDone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklistTasksDone + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklistTasksDone) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklistTasksDone) GetType() string { + return TypePushMessageContentChecklistTasksDone +} + +func (*PushMessageContentChecklistTasksDone) PushMessageContentType() string { + return TypePushMessageContentChecklistTasksDone +} + // A forwarded messages type PushMessageContentMessageForwards struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 6adae01..5991657 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -3507,6 +3507,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageStory: return UnmarshalMessageStory(data) + case TypeMessageChecklist: + return UnmarshalMessageChecklist(data) + case TypeMessageInvoice: return UnmarshalMessageInvoice(data) @@ -3651,6 +3654,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageDirectMessagePriceChanged: return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageChecklistTasksDone: + return UnmarshalMessageChecklistTasksDone(data) + + case TypeMessageChecklistTasksAdded: + return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -3962,6 +3971,9 @@ func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, er case TypeInputMessageStory: return UnmarshalInputMessageStory(data) + case TypeInputMessageChecklist: + return UnmarshalInputMessageChecklist(data) + case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) @@ -5803,6 +5815,9 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureMessageEffects: return UnmarshalPremiumFeatureMessageEffects(data) + case TypePremiumFeatureChecklists: + return UnmarshalPremiumFeatureChecklists(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6603,6 +6618,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentText: return UnmarshalPushMessageContentText(data) + case TypePushMessageContentChecklist: + return UnmarshalPushMessageContentChecklist(data) + case TypePushMessageContentVideo: return UnmarshalPushMessageContentVideo(data) @@ -6657,6 +6675,12 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentProximityAlertTriggered: return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentChecklistTasksAdded: + return UnmarshalPushMessageContentChecklistTasksAdded(data) + + case TypePushMessageContentChecklistTasksDone: + return UnmarshalPushMessageContentChecklistTasksDone(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -9429,6 +9453,38 @@ func UnmarshalPollTypeQuiz(data json.RawMessage) (*PollTypeQuiz, error) { return &resp, err } +func UnmarshalChecklistTask(data json.RawMessage) (*ChecklistTask, error) { + var resp ChecklistTask + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChecklistTask(data json.RawMessage) (*InputChecklistTask, error) { + var resp InputChecklistTask + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChecklist(data json.RawMessage) (*Checklist, error) { + var resp Checklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChecklist(data json.RawMessage) (*InputChecklist, error) { + var resp InputChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAnimation(data json.RawMessage) (*Animation, error) { var resp Animation @@ -9557,6 +9613,14 @@ func UnmarshalAlternativeVideo(data json.RawMessage) (*AlternativeVideo, error) return &resp, err } +func UnmarshalVideoStoryboard(data json.RawMessage) (*VideoStoryboard, error) { + var resp VideoStoryboard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBackground(data json.RawMessage) (*Background, error) { var resp Background @@ -11829,8 +11893,8 @@ func UnmarshalMessageSourceOther(data json.RawMessage) (*MessageSourceOther, err return &resp, err } -func UnmarshalMessageSponsor(data json.RawMessage) (*MessageSponsor, error) { - var resp MessageSponsor +func UnmarshalAdvertisementSponsor(data json.RawMessage) (*AdvertisementSponsor, error) { + var resp AdvertisementSponsor err := json.Unmarshal(data, &resp) @@ -11869,6 +11933,22 @@ func UnmarshalSponsoredChats(data json.RawMessage) (*SponsoredChats, error) { return &resp, err } +func UnmarshalVideoMessageAdvertisement(data json.RawMessage) (*VideoMessageAdvertisement, error) { + var resp VideoMessageAdvertisement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVideoMessageAdvertisements(data json.RawMessage) (*VideoMessageAdvertisements, error) { + var resp VideoMessageAdvertisements + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) { var resp ReportOption @@ -14549,6 +14629,14 @@ func UnmarshalMessageStory(data json.RawMessage) (*MessageStory, error) { return &resp, err } +func UnmarshalMessageChecklist(data json.RawMessage) (*MessageChecklist, error) { + var resp MessageChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageInvoice(data json.RawMessage) (*MessageInvoice, error) { var resp MessageInvoice @@ -14933,6 +15021,22 @@ func UnmarshalMessageDirectMessagePriceChanged(data json.RawMessage) (*MessageDi return &resp, err } +func UnmarshalMessageChecklistTasksDone(data json.RawMessage) (*MessageChecklistTasksDone, error) { + var resp MessageChecklistTasksDone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChecklistTasksAdded(data json.RawMessage) (*MessageChecklistTasksAdded, error) { + var resp MessageChecklistTasksAdded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -15421,6 +15525,14 @@ func UnmarshalInputMessageStory(data json.RawMessage) (*InputMessageStory, error return &resp, err } +func UnmarshalInputMessageChecklist(data json.RawMessage) (*InputMessageChecklist, error) { + var resp InputMessageChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputMessageForwarded(data json.RawMessage) (*InputMessageForwarded, error) { var resp InputMessageForwarded @@ -18197,6 +18309,14 @@ func UnmarshalPremiumFeatureMessageEffects(data json.RawMessage) (*PremiumFeatur return &resp, err } +func UnmarshalPremiumFeatureChecklists(data json.RawMessage) (*PremiumFeatureChecklists, error) { + var resp PremiumFeatureChecklists + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBusinessFeatureLocation(data json.RawMessage) (*BusinessFeatureLocation, error) { var resp BusinessFeatureLocation @@ -19149,6 +19269,14 @@ func UnmarshalPushMessageContentText(data json.RawMessage) (*PushMessageContentT return &resp, err } +func UnmarshalPushMessageContentChecklist(data json.RawMessage) (*PushMessageContentChecklist, error) { + var resp PushMessageContentChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentVideo(data json.RawMessage) (*PushMessageContentVideo, error) { var resp PushMessageContentVideo @@ -19293,6 +19421,22 @@ func UnmarshalPushMessageContentProximityAlertTriggered(data json.RawMessage) (* return &resp, err } +func UnmarshalPushMessageContentChecklistTasksAdded(data json.RawMessage) (*PushMessageContentChecklistTasksAdded, error) { + var resp PushMessageContentChecklistTasksAdded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChecklistTasksDone(data json.RawMessage) (*PushMessageContentChecklistTasksDone, error) { + var resp PushMessageContentChecklistTasksDone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentMessageForwards(data json.RawMessage) (*PushMessageContentMessageForwards, error) { var resp PushMessageContentMessageForwards @@ -23253,6 +23397,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePollTypeQuiz: return UnmarshalPollTypeQuiz(data) + case TypeChecklistTask: + return UnmarshalChecklistTask(data) + + case TypeInputChecklistTask: + return UnmarshalInputChecklistTask(data) + + case TypeChecklist: + return UnmarshalChecklist(data) + + case TypeInputChecklist: + return UnmarshalInputChecklist(data) + case TypeAnimation: return UnmarshalAnimation(data) @@ -23301,6 +23457,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAlternativeVideo: return UnmarshalAlternativeVideo(data) + case TypeVideoStoryboard: + return UnmarshalVideoStoryboard(data) + case TypeBackground: return UnmarshalBackground(data) @@ -24153,8 +24312,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSourceOther: return UnmarshalMessageSourceOther(data) - case TypeMessageSponsor: - return UnmarshalMessageSponsor(data) + case TypeAdvertisementSponsor: + return UnmarshalAdvertisementSponsor(data) case TypeSponsoredMessage: return UnmarshalSponsoredMessage(data) @@ -24168,6 +24327,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSponsoredChats: return UnmarshalSponsoredChats(data) + case TypeVideoMessageAdvertisement: + return UnmarshalVideoMessageAdvertisement(data) + + case TypeVideoMessageAdvertisements: + return UnmarshalVideoMessageAdvertisements(data) + case TypeReportOption: return UnmarshalReportOption(data) @@ -25173,6 +25338,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageStory: return UnmarshalMessageStory(data) + case TypeMessageChecklist: + return UnmarshalMessageChecklist(data) + case TypeMessageInvoice: return UnmarshalMessageInvoice(data) @@ -25317,6 +25485,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageDirectMessagePriceChanged: return UnmarshalMessageDirectMessagePriceChanged(data) + case TypeMessageChecklistTasksDone: + return UnmarshalMessageChecklistTasksDone(data) + + case TypeMessageChecklistTasksAdded: + return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -25500,6 +25674,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessageStory: return UnmarshalInputMessageStory(data) + case TypeInputMessageChecklist: + return UnmarshalInputMessageChecklist(data) + case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) @@ -26541,6 +26718,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureMessageEffects: return UnmarshalPremiumFeatureMessageEffects(data) + case TypePremiumFeatureChecklists: + return UnmarshalPremiumFeatureChecklists(data) + case TypeBusinessFeatureLocation: return UnmarshalBusinessFeatureLocation(data) @@ -26898,6 +27078,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentText: return UnmarshalPushMessageContentText(data) + case TypePushMessageContentChecklist: + return UnmarshalPushMessageContentChecklist(data) + case TypePushMessageContentVideo: return UnmarshalPushMessageContentVideo(data) @@ -26952,6 +27135,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentProximityAlertTriggered: return UnmarshalPushMessageContentProximityAlertTriggered(data) + case TypePushMessageContentChecklistTasksAdded: + return UnmarshalPushMessageContentChecklistTasksAdded(data) + + case TypePushMessageContentChecklistTasksDone: + return UnmarshalPushMessageContentChecklistTasksDone(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) diff --git a/data/td_api.tl b/data/td_api.tl index 5b4847b..29d016b 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -388,6 +388,35 @@ pollTypeRegular allow_multiple_answers:Bool = PollType; pollTypeQuiz correct_option_id:int32 explanation:formattedText = PollType; +//@description Describes a task in a checklist +//@id Unique identifier of the task +//@text Text of the task; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Url, EmailAddress, Mention, Hashtag, Cashtag and PhoneNumber entities +//@completed_by_user_id Identifier of the user that completed the task; 0 if the task isn't completed +//@completion_date Point in time (Unix timestamp) when the task was completed; 0 if the task isn't completed +checklistTask id:int32 text:formattedText completed_by_user_id:int53 completion_date:int32 = ChecklistTask; + +//@description Describes a task in a checklist to be sent +//@id Unique identifier of the task; must be positive +//@text Text of the task; 1-getOption("checklist_task_text_length_max") characters without line feeds. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +inputChecklistTask id:int32 text:formattedText = InputChecklistTask; + +//@description Describes a checklist +//@title Title of the checklist; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +//@tasks List of tasks in the checklist +//@others_can_add_tasks True, if users other than creator of the list can add tasks to the list +//@can_add_tasks True, if the current user can add tasks to the list if they have Telegram Premium subscription +//@others_can_mark_tasks_as_done True, if users other than creator of the list can mark tasks as done or not done. If true, then the checklist is called "group checklist" +//@can_mark_tasks_as_done True, if the current user can mark tasks as done or not done if they have Telegram Premium subscription +checklist title:formattedText tasks:vector others_can_add_tasks:Bool can_add_tasks:Bool others_can_mark_tasks_as_done:Bool can_mark_tasks_as_done:Bool = Checklist; + +//@description Describes a checklist to be sent +//@title Title of the checklist; 1-getOption("checklist_title_length_max") characters. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +//@tasks List of tasks in the checklist; 1-getOption("checklist_task_count_max") tasks +//@others_can_add_tasks True, if other users can add tasks to the list +//@others_can_mark_tasks_as_done True, if other users can mark tasks as done or not done +inputChecklist title:formattedText tasks:vector others_can_add_tasks:Bool others_can_mark_tasks_as_done:Bool = InputChecklist; + + //@description Describes an animation file. The animation must be encoded in GIF or MPEG4 format //@duration Duration of the animation, in seconds; as defined by the sender //@width Width of the animation @@ -541,6 +570,13 @@ poll id:int64 question:formattedText options:vector total_voter_coun //@video File containing the video alternativeVideo id:int64 width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; +//@description Describes a storyboard for a video +//@storyboard_file A JPEG file that contains tiled previews of video +//@width Width of a tile +//@height Height of a tile +//@map_file File that describes mapping of position in the video to a tile in the JPEG file +videoStoryboard storyboard_file:file width:int32 height:int32 map_file:file = VideoStoryboard; + //@description Describes a chat background //@id Unique background identifier @@ -825,7 +861,7 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; //@can_send_videos True, if the user can send videos //@can_send_video_notes True, if the user can send video notes //@can_send_voice_notes True, if the user can send voice notes -//@can_send_polls True, if the user can send polls +//@can_send_polls True, if the user can send polls and checklists //@can_send_stickers True, if the user can send stickers. Implies can_send_messages permissions //@can_send_animations True, if the user can send animations. Implies can_send_messages permissions //@can_send_games True, if the user can send games. Implies can_send_messages permissions @@ -1906,6 +1942,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@gift_count Number of saved to profile gifts for channels without can_post_messages administrator right, otherwise, the total number of received gifts //@my_boost_count Number of times the current user boosted the supergroup or channel //@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified +//@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the supergroup //@sticker_set_id Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none //@custom_emoji_sticker_set_id Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none //@location Location to which the supergroup is connected; may be null if none @@ -1914,7 +1951,7 @@ supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:Chat //@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 direct_messages_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 direct_messages_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_messages:Bool can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_send_gift:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool gift_count:int32 my_boost_count:int32 unrestrict_boost_count:int32 outgoing_paid_message_star_count:int53 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -2164,9 +2201,9 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. -//-Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, -//-messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, -//-messageVideoNote, or messageVoiceNote +//-Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, +//-messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, +//-messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message @story_poster_chat_id The identifier of the poster of the story @story_id The identifier of the story @@ -2303,11 +2340,11 @@ messageSourceScreenshot = MessageSource; messageSourceOther = MessageSource; -//@description Information about the sponsor of a message -//@url URL of the sponsor to be opened when the message is clicked +//@description Information about the sponsor of an advertisement +//@url URL of the sponsor to be opened when the advertisement is clicked //@photo Photo of the sponsor; may be null if must not be shown -//@info Additional optional information about the sponsor to be shown along with the message -messageSponsor url:string photo:photo info:string = MessageSponsor; +//@info Additional optional information about the sponsor to be shown along with the advertisement +advertisementSponsor url:string photo:photo info:string = AdvertisementSponsor; //@description Describes a sponsored message //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages @@ -2320,7 +2357,7 @@ messageSponsor url:string photo:photo info:string = MessageSponsor; //@accent_color_id Identifier of the accent color for title, button text and message background //@background_custom_emoji_id Identifier of a custom emoji to be shown on the message background; 0 if none //@additional_info If non-empty, additional information about the sponsored message to be shown along with the message -sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:messageSponsor title:string button_text:string accent_color_id:int32 background_custom_emoji_id:int64 additional_info:string = SponsoredMessage; +sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:advertisementSponsor title:string button_text:string accent_color_id:int32 background_custom_emoji_id:int64 additional_info:string = SponsoredMessage; //@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; @@ -2335,6 +2372,23 @@ sponsoredChat unique_id:int53 chat_id:int53 sponsor_info:string additional_info: //@description Contains a list of sponsored chats @chats List of sponsored chats sponsoredChats chats:vector = SponsoredChats; +//@description Describes an advertisent to be shown while a video from a message is watched +//@unique_id Unique identifier of this result +//@text Text of the advertisement +//@min_display_duration The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds +//@max_display_duration The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds +//@can_be_reported True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement +//@sponsor Information about the sponsor of the advertisement +//@title Title of the sponsored message +//@additional_info If non-empty, additional information about the sponsored message to be shown along with the message +videoMessageAdvertisement unique_id:int53 text:string min_display_duration:int32 max_display_duration:int32 can_be_reported:Bool sponsor:advertisementSponsor title:string additional_info:string = VideoMessageAdvertisement; + +//@description Contains a list of advertisements to be shown while a video from a message is watched +//@advertisements List of advertisements +//@start_delay Delay before the first advertisement is shown, in seconds +//@between_delay Delay between consecutive advertisements, in seconds +videoMessageAdvertisements advertisements:vector start_delay:int32 between_delay:int32 = VideoMessageAdvertisements; + //@description Describes an option to report an entity to Telegram @id Unique identifier of the option @text Text of the option reportOption id:bytes text:string = ReportOption; @@ -2917,6 +2971,7 @@ savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int //@id Unique topic identifier //@sender_id Identifier of the user or chat that sends the messages to the topic //@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order +//@can_send_unpaid_messages True, if the other party can send unpaid messages even if the chat has paid messages enabled //@is_marked_as_unread True, if the forum topic is marked as unread //@unread_count Number of unread messages in the chat //@last_read_inbox_message_id Identifier of the last read incoming message @@ -2924,7 +2979,7 @@ savedMessagesTopic id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int //@unread_reaction_count Number of messages with unread reactions in the chat //@last_message Last message in the topic; may be null if none or unknown //@draft_message A draft of a message in the topic; may be null if none -directMessagesChatTopic chat_id:int53 id:int53 sender_id:MessageSender order:int64 is_marked_as_unread:Bool unread_count:int53 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_reaction_count:int53 last_message:message draft_message:draftMessage = DirectMessagesChatTopic; +directMessagesChatTopic chat_id:int53 id:int53 sender_id:MessageSender order:int64 can_send_unpaid_messages:Bool is_marked_as_unread:Bool unread_count:int53 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_reaction_count:int53 last_message:message draft_message:draftMessage = DirectMessagesChatTopic; //@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none @@ -3987,13 +4042,14 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent; //@description A video message //@video The video description //@alternative_videos Alternative qualities of the video +//@storyboards Available storyboards for the video //@cover Cover of the video; may be null if none //@start_timestamp Timestamp from which the video playing must start, in seconds //@caption Video caption //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video //@has_spoiler True, if the video preview must be covered by a spoiler animation //@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped -messageVideo video:video alternative_videos:vector cover:photo start_timestamp:int32 caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; +messageVideo video:video alternative_videos:vector storyboards:vector cover:photo start_timestamp:int32 caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; //@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped messageVideoNote video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent; @@ -4050,6 +4106,9 @@ messagePoll poll:poll = MessageContent; //@via_mention True, if the story was automatically forwarded because of a mention of the user messageStory story_poster_chat_id:int53 story_id:int32 via_mention:Bool = MessageContent; +//@description A message with a checklist @list The checklist description +messageChecklist list:checklist = MessageContent; + //@description A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice //@product_info Information about the product //@currency Currency for the product price @@ -4329,6 +4388,17 @@ messagePaidMessagePriceChanged paid_message_star_count:int53 = MessageContent; //-0 if the direct messages group was disabled or the messages are free messageDirectMessagePriceChanged is_enabled:Bool paid_message_star_count:int53 = MessageContent; +//@description Some tasks from a checklist were marked as done or not done +//@checklist_message_id Identifier of the message with the checklist; can be 0 if the message was deleted +//@marked_as_done_task_ids Identifiers of tasks that were marked as done +//@marked_as_not_done_task_ids Identifiers of tasks that were marked as not done +messageChecklistTasksDone checklist_message_id:int53 marked_as_done_task_ids:vector marked_as_not_done_task_ids:vector = MessageContent; + +//@description Some tasks were added to a checklist +//@checklist_message_id Identifier of the message with the checklist; can be 0 if the message was deleted +//@tasks List of tasks added to the checklist +messageChecklistTasksAdded checklist_message_id:int53 tasks:vector = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4652,6 +4722,10 @@ inputMessagePoll question:formattedText options:vector is_anonymo //@story_id Story identifier inputMessageStory story_poster_chat_id:int53 story_id:int32 = InputMessageContent; +//@description A message with a checklist. Checklists can't be sent to secret chats, channel chats and channel direct messages chats; for Telegram Premium users only +//@checklist The checklist to send +inputMessageChecklist checklist:inputChecklist = InputMessageContent; + //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from //@message_id Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded @@ -4663,12 +4737,13 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_add_tasks True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription //@can_be_copied True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. -//-For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message +//-For live location, poll, and checklist messages this fields shows whether editMessageLiveLocation, stopPoll, or editMessageChecklist respectively can be used with this message //@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options //@can_be_paid True, if the message can be paid using inputInvoiceMessage //@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage @@ -4685,14 +4760,16 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory //@can_get_read_date True, if read date of the message can be received through getMessageReadDate //@can_get_statistics True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards +//@can_get_video_advertisements True, if advertisements for video of the message can be received though getVideoMessageAdvertisements //@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers +//@can_mark_tasks_as_done True, if tasks can be marked as done or not done in the message's checklist using markChecklistTasksAsDone if the current user has Telegram Premium subscription //@can_recognize_speech True, if speech can be recognized for the message through recognizeSpeech //@can_report_chat True, if the message can be reported using reportChat //@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_add_tasks:Bool can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_video_advertisements:Bool can_get_viewers:Bool can_mark_tasks_as_done:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -6445,6 +6522,9 @@ premiumFeatureBusiness = PremiumFeature; //@description The ability to use all available message effects premiumFeatureMessageEffects = PremiumFeature; +//@description The ability to create and use checklist messages +premiumFeatureChecklists = PremiumFeature; + //@class BusinessFeature @description Describes a feature available to Business user accounts @@ -6956,6 +7036,11 @@ pushMessageContentStory is_mention:Bool is_pinned:Bool = PushMessageContent; //@description A text message @text Message text @is_pinned True, if the message is a pinned message with the specified content pushMessageContentText text:string is_pinned:Bool = PushMessageContent; +//@description A message with a checklist +//@title Checklist title +//@is_pinned True, if the message is a pinned message with the specified content +pushMessageContentChecklist title:string is_pinned:Bool = PushMessageContent; + //@description A video message //@video Message content; may be null //@caption Video caption @@ -7021,6 +7106,12 @@ pushMessageContentSuggestProfilePhoto = PushMessageContent; //@description A user in the chat came within proximity alert range from the current user @distance The distance to the user pushMessageContentProximityAlertTriggered distance:int32 = PushMessageContent; +//@description Some tasks were added to a checklist @task_count Number of added tasks +pushMessageContentChecklistTasksAdded task_count:int32 = PushMessageContent; + +//@description Some tasks from a checklist were marked as done or not done @task_count Number of changed tasks +pushMessageContentChecklistTasksDone task_count:int32 = PushMessageContent; + //@description A forwarded messages @total_count Number of forwarded messages pushMessageContentMessageForwards total_count:int32 = PushMessageContent; @@ -9313,8 +9404,8 @@ getMessage chat_id:int53 message_id:int53 = Message; getMessageLocally chat_id:int53 message_id:int53 = Message; //@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, -//-the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types -//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively. +//-the message with a previously set same background, the giveaway message, the checklist message, and the topic creation message for messages of the types +//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, and topic messages without non-bundled replied message respectively. //-Returns a 404 error if the message doesn't exist //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message @@ -9517,6 +9608,18 @@ unpinAllDirectMessagesChatTopicMessages chat_id:int53 topic_id:int53 = Ok; //@topic_id Topic identifier readAllDirectMessagesChatTopicReactions chat_id:int53 topic_id:int53 = Ok; +//@description Returns the total number of Telegram Stars received by the channel chat for direct messages from the given topic +//@chat_id Chat identifier of the channel direct messages chat administered by the current user +//@topic_id Identifier of the topic +getDirectMessagesChatTopicRevenue chat_id:int53 topic_id:int53 = StarCount; + +//@description Allows to send unpaid messages to the given topic of the channel direct messages chat administered by the current user +//@chat_id Chat identifier +//@topic_id Identifier of the topic +//@can_send_unpaid_messages Pass true to allow unpaid messages; pass false to disallow unpaid messages +//@refund_payments Pass true to refund the user previously paid messages +toggleDirectMessagesChatTopicCanSendUnpaidMessages chat_id:int53 topic_id:int53 can_send_unpaid_messages:Bool refund_payments:Bool = Ok; + //@description Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded //@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached @@ -9757,6 +9860,22 @@ openSponsoredChat sponsored_chat_unique_id:int53 = Ok; //@option_id Option identifier chosen by the user; leave empty for the initial request reportSponsoredChat sponsored_chat_unique_id:int53 option_id:bytes = ReportSponsoredResult; +//@description Returns advertisements to be shown while a video from a message is watched. Available only if messageProperties.can_get_video_advertisements +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message +getVideoMessageAdvertisements chat_id:int53 message_id:int53 = VideoMessageAdvertisements; + +//@description Informs TDLib that the user viewed a video message advertisement @advertisement_unique_id Unique identifier of the advertisement +viewVideoMessageAdvertisement advertisement_unique_id:int53 = Ok; + +//@description Informs TDLib that the user clicked a video message advertisement @advertisement_unique_id Unique identifier of the advertisement +clickVideoMessageAdvertisement advertisement_unique_id:int53 = Ok; + +//@description Reports a video message advertisement to Telegram moderators +//@advertisement_unique_id Unique identifier of the advertisement +//@option_id Option identifier chosen by the user; leave empty for the initial request +reportVideoMessageAdvertisement advertisement_unique_id:int53 option_id:bytes = ReportSponsoredResult; + //@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user @notification_group_id Identifier of notification group to which the notification belongs @notification_id Identifier of removed notification removeNotification notification_group_id:int32 notification_id:int32 = Ok; @@ -9924,6 +10043,13 @@ editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_me //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Message; +//@description Edits the message content of a checklist. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited +//@reply_markup The new message reply markup; pass null if none; for bots only +//@checklist The new checklist. If some tasks were completed, this information will be kept +editMessageChecklist chat_id:int53 message_id:int53 reply_markup:ReplyMarkup checklist:inputChecklist = Message; + //@description Edits the media content of a message, including message caption. If only the caption needs to be edited, use editMessageCaption instead. //-The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to @@ -10036,6 +10162,14 @@ editBusinessMessageText business_connection_id:string chat_id:int53 message_id:i //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled editBusinessMessageLiveLocation business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = BusinessMessage; +//@description Edits the content of a checklist in a message sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +//@reply_markup The new message reply markup; pass null if none +//@checklist The new checklist. If some tasks were completed, this information will be kept +editBusinessMessageChecklist business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup checklist:inputChecklist = BusinessMessage; + //@description Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only //@business_connection_id Unique identifier of business connection on behalf of which the message was sent //@chat_id The chat the message belongs to @@ -10163,7 +10297,7 @@ deleteQuickReplyShortcutMessages shortcut_id:int32 message_ids:vector = O //-The shortcut must not contain more than getOption("quick_reply_shortcut_message_count_max") messages after adding the new message. Returns the added message //@shortcut_name Name of the target shortcut //@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none -//@input_message_content The content of the message to be added; inputMessagePoll, inputMessageForwarded and inputMessageLocation with live_period aren't supported +//@input_message_content The content of the message to be added; inputMessagePaidMedia, inputMessageForwarded and inputMessageLocation with live_period aren't supported addQuickReplyShortcutMessage shortcut_name:string reply_to_message_id:int53 input_message_content:InputMessageContent = QuickReplyMessage; //@description Adds a message to a quick reply shortcut via inline bot. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. @@ -10189,10 +10323,11 @@ addQuickReplyShortcutMessageAlbum shortcut_name:string reply_to_message_id:int53 readdQuickReplyShortcutMessages shortcut_name:string message_ids:vector = QuickReplyMessages; //@description Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. -//-Media message can be edited only to a media message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +//-Media message can be edited only to a media message. Checklist messages can be edited only to a checklist message. +//-The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa //@shortcut_id Unique identifier of the quick reply shortcut with the message //@message_id Identifier of the message -//@input_message_content New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo +//@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageChecklist, inputMessageDocument, inputMessagePhoto, inputMessageText, or inputMessageVideo editQuickReplyMessage shortcut_id:int32 message_id:int53 input_message_content:InputMessageContent = Ok; @@ -10412,6 +10547,20 @@ getPollVoters chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit: stopPoll chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; +//@description Adds tasks to a checklist in a message +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message containing the checklist. Use messageProperties.can_add_tasks to check whether the tasks can be added +//@tasks List of added tasks +addChecklistTasks chat_id:int53 message_id:int53 tasks:vector = Ok; + +//@description Adds tasks of a checklist in a message as done or not done +//@chat_id Identifier of the chat with the message +//@message_id Identifier of the message containing the checklist. Use messageProperties.can_mark_tasks_as_done to check whether the tasks can be marked as done or not done +//@marked_as_done_task_ids Identifiers of tasks that were marked as done +//@marked_as_not_done_task_ids Identifiers of tasks that were marked as not done +markChecklistTasksAsDone chat_id:int53 message_id:int53 marked_as_done_task_ids:vector marked_as_not_done_task_ids:vector = Ok; + + //@description Hides a suggested action @action Suggested action to hide hideSuggestedAction action:SuggestedAction = Ok; From 5c5078ec427b2444302480aa3526ea4c30332970 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 2 Sep 2025 18:58:30 +0800 Subject: [PATCH 04/11] Fix command parser --- client/extra.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/client/extra.go b/client/extra.go index c786893..9b32fc9 100644 --- a/client/extra.go +++ b/client/extra.go @@ -23,22 +23,18 @@ func IsCommand(text string) bool { func CheckCommand(text string, entities []*TextEntity) string { if IsCommand(text) { - var cmd string + cmd := text // e.g. ["/hello 123", "/hell o 123"] // Result: "/hello", "/hell" - if i := strings.Index(text, " "); i != -1 { - cmd = text[:i] + if i := strings.Index(cmd, " "); i != -1 { + cmd = cmd[:i] } // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] // Result: "/hello" - if i := strings.Index(text, "@"); i != -1 { - cmd = text[:i] - } - - if cmd == "" { - return text + if i := strings.Index(cmd, "@"); i != -1 { + cmd = cmd[:i] } return cmd From 14418433a409d1f0003bf6dbaa6f5445865d5b6e Mon Sep 17 00:00:00 2001 From: c0re100 Date: Tue, 2 Sep 2025 19:11:19 +0800 Subject: [PATCH 05/11] Update to TDLib 1.8.52 --- client/function.go | 205 +++++-- client/type.go | 1230 ++++++++++++++++++++++++++++++++++++++--- client/unmarshaler.go | 616 +++++++++++++++++++-- data/td_api.tl | 352 +++++++++--- 4 files changed, 2174 insertions(+), 229 deletions(-) diff --git a/client/function.go b/client/function.go index c2e9384..63ba51e 100755 --- a/client/function.go +++ b/client/function.go @@ -1429,7 +1429,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, the checklist message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, and topic messages without non-bundled replied message respectively. Returns a 404 error if the message doesn't exist +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message for messagePinMessage, the game message for messageGameScore, the invoice message for messagePaymentSuccessful, the message with a previously set same background for messageChatSetBackground, the giveaway message for messageGiveawayCompleted, the checklist message for messageChecklistTasksDone, messageChecklistTasksAdded, the message with suggested post information for messageSuggestedPostApprovalFailed, messageSuggestedPostApproved, messageSuggestedPostDeclined, messageSuggestedPostPaid, messageSuggestedPostRefunded, the message with the regular gift that was upgraded for messageUpgradedGift with origin of the type upgradedGiftOriginUpgrade, and the topic creation message for topic messages without non-bundled replied message. Returns a 404 error if the message doesn't exist func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -2519,9 +2519,9 @@ type GetDirectMessagesChatTopicHistoryRequest struct { TopicId int64 `json:"topic_id"` // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -2863,9 +2863,9 @@ type GetSavedMessagesTopicHistoryRequest struct { SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -3072,9 +3072,9 @@ type GetChatHistoryRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` // Pass true to get only messages that are available without sending network requests OnlyLocal bool `json:"only_local"` @@ -3112,9 +3112,9 @@ type GetMessageThreadHistoryRequest struct { MessageId int64 `json:"message_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -3212,9 +3212,9 @@ type SearchChatMessagesRequest struct { SenderId MessageSender `json:"sender_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` // Additional filter for messages to search; pass null to search for all messages Filter SearchMessagesFilter `json:"filter"` @@ -3342,9 +3342,9 @@ type SearchSavedMessagesRequest struct { Query string `json:"query"` // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } @@ -6071,7 +6071,7 @@ type SetBusinessAccountProfilePhotoRequest struct { BusinessConnectionId string `json:"business_connection_id"` // Profile photo to set; pass null to remove the photo Photo InputChatPhoto `json:"photo"` - // Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings + // Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings IsPublic bool `json:"is_public"` } @@ -6624,7 +6624,7 @@ type EditForumTopicRequest struct { IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` } -// Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +// Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic func (client *Client) EditForumTopic(req *EditForumTopicRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6789,7 +6789,7 @@ type ToggleForumTopicIsClosedRequest struct { IsClosed bool `json:"is_closed"` } -// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic func (client *Client) ToggleForumTopicIsClosed(req *ToggleForumTopicIsClosedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6819,7 +6819,7 @@ type ToggleGeneralForumTopicIsHiddenRequest struct { IsHidden bool `json:"is_hidden"` } -// Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics right in the supergroup +// Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup func (client *Client) ToggleGeneralForumTopicIsHidden(req *ToggleGeneralForumTopicIsHiddenRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6850,7 +6850,7 @@ type ToggleForumTopicIsPinnedRequest struct { IsPinned bool `json:"is_pinned"` } -// Changes the pinned state of a forum topic; requires can_manage_topics right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics +// Changes the pinned state of a forum topic; requires can_manage_topics administrator right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics func (client *Client) ToggleForumTopicIsPinned(req *ToggleForumTopicIsPinnedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6880,7 +6880,7 @@ type SetPinnedForumTopicsRequest struct { MessageThreadIds []int64 `json:"message_thread_ids"` } -// Changes the order of pinned forum topics; requires can_manage_topics right in the supergroup +// Changes the order of pinned forum topics; requires can_manage_topics administrator right in the supergroup func (client *Client) SetPinnedForumTopics(req *SetPinnedForumTopicsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -9163,7 +9163,7 @@ type ViewMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // Source of the message view; pass null to guess the source based on chat open state Source MessageSource `json:"source"` - // Pass true to mark as read the specified messages even the chat is closed + // Pass true to mark as read the specified messages even if the chat is closed ForceRead bool `json:"force_read"` } @@ -9383,6 +9383,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeMyStars: return UnmarshalInternalLinkTypeMyStars(result.Data) + case TypeInternalLinkTypeMyToncoins: + return UnmarshalInternalLinkTypeMyToncoins(result.Data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(result.Data) @@ -11189,7 +11192,7 @@ type SetChatSlowModeDelayRequest struct { SlowModeDelay int32 `json:"slow_mode_delay"` } -// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right +// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members administrator right func (client *Client) SetChatSlowModeDelay(req *SetChatSlowModeDelayRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -12087,7 +12090,7 @@ type CanPostStoryRequest struct { ChatId int64 `json:"chat_id"` } -// Checks whether the current user can post a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +// Checks whether the current user can post a story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats func (client *Client) CanPostStory(req *CanPostStoryRequest) (CanPostStoryResult, error) { result, err := client.Send(Request{ meta: meta{ @@ -12150,7 +12153,7 @@ type PostStoryRequest struct { ProtectContent bool `json:"protect_content"` } -// Posts a new story on behalf of a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story +// Posts a new story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats. Returns a temporary story func (client *Client) PostStory(req *PostStoryRequest) (*Story, error) { result, err := client.Send(Request{ meta: meta{ @@ -12480,7 +12483,7 @@ type GetChatArchivedStoriesRequest struct { Limit int32 `json:"limit"` } -// Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +// Returns the list of all stories posted by the given chat; requires can_edit_stories administrator right in the chat. The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib func (client *Client) GetChatArchivedStories(req *GetChatArchivedStoriesRequest) (*Stories, error) { result, err := client.Send(Request{ meta: meta{ @@ -12510,7 +12513,7 @@ type SetChatPinnedStoriesRequest struct { StoryIds []int32 `json:"story_ids"` } -// Changes the list of pinned stories on a chat page; requires can_edit_stories right in the chat +// Changes the list of pinned stories on a chat page; requires can_edit_stories administrator right in the chat func (client *Client) SetChatPinnedStories(req *SetChatPinnedStoriesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -13273,7 +13276,7 @@ func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatusCustomEmojis, e return UnmarshalEmojiStatusCustomEmojis(result.Data) } -// Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true +// Returns the list of emoji statuses, which can't be used as chat emoji status, even if they are from a sticker set with is_allowed_as_chat_emoji_status == true func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ @@ -14484,6 +14487,102 @@ func (client *Client) ProcessChatJoinRequests(req *ProcessChatJoinRequestsReques return UnmarshalOk(result.Data) } +type ApproveSuggestedPostRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message with the suggested post. Use messageProperties.can_be_approved to check whether the suggested post can be approved + MessageId int64 `json:"message_id"` + // Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date has already been chosen. If specified, then the date must be in the future, but at most getOption("suggested_post_send_delay_max") seconds in the future + SendDate int32 `json:"send_date"` +} + +// Approves a suggested post in a channel direct messages chat +func (client *Client) ApproveSuggestedPost(req *ApproveSuggestedPostRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "approveSuggestedPost", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "send_date": req.SendDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeclineSuggestedPostRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message with the suggested post. Use messageProperties.can_be_declined to check whether the suggested post can be declined + MessageId int64 `json:"message_id"` + // Comment for the creator of the suggested post; 0-128 characters + Comment string `json:"comment"` +} + +// Declines a suggested post in a channel direct messages chat +func (client *Client) DeclineSuggestedPost(req *DeclineSuggestedPostRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "declineSuggestedPost", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "comment": req.Comment, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddOfferRequest struct { + // Identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message in the chat which will be sent as suggested post. Use messageProperties.can_add_offer to check whether an offer can be added or messageProperties.can_edit_suggested_post_info to check whether price or time of sending of the post can be changed + MessageId int64 `json:"message_id"` + // Options to be used to send the message. New information about the suggested post must always be specified + Options *MessageSendOptions `json:"options"` +} + +// Sent a suggested post based on a previously sent message in a channel direct messages chat. Can be also used to suggest price or time change for an existing suggested post. Returns the sent message +func (client *Client) AddOffer(req *AddOfferRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addOffer", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "options": req.Options, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + type CreateCallRequest struct { // Identifier of the user to be called UserId int64 `json:"user_id"` @@ -17576,7 +17675,7 @@ func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) ( type SetProfilePhotoRequest struct { // Profile photo to set Photo InputChatPhoto `json:"photo"` - // Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings + // Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings IsPublic bool `json:"is_public"` } @@ -20481,7 +20580,7 @@ type SellGiftRequest struct { ReceivedGiftId string `json:"received_gift_id"` } -// Sells a gift for Telegram Stars +// Sells a gift for Telegram Stars; requires owner privileges for gifts owned by a chat func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -20894,7 +20993,7 @@ type SearchGiftsForResaleRequest struct { Limit int32 `json:"limit"` } -// Returns upgraded gifts that can be bought from other owners +// Returns upgraded gifts that can be bought from other owners using sendResoldGift func (client *Client) SearchGiftsForResale(req *SearchGiftsForResaleRequest) (*GiftsForResale, error) { result, err := client.Send(Request{ meta: meta{ @@ -22206,9 +22305,9 @@ func (client *Client) GetChatRevenueWithdrawalUrl(req *GetChatRevenueWithdrawalU type GetChatRevenueTransactionsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Number of transactions to skip - Offset int32 `json:"offset"` - // The maximum number of transactions to be returned; up to 200 + // Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of transactions to be returned; up to 100 Limit int32 `json:"limit"` } @@ -22235,6 +22334,38 @@ func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactions return UnmarshalChatRevenueTransactions(result.Data) } +type GetTonTransactionsRequest struct { + // Direction of the transactions to receive; pass null to get all transactions + Direction TransactionDirection `json:"direction"` + // Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of transactions to return + Limit int32 `json:"limit"` +} + +// Returns the list of Toncoin transactions of the current user +func (client *Client) GetTonTransactions(req *GetTonTransactionsRequest) (*TonTransactions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonTransactions", + }, + Data: map[string]interface{}{ + "direction": req.Direction, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTonTransactions(result.Data) +} + type GetStarRevenueStatisticsRequest struct { // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true OwnerId MessageSender `json:"owner_id"` @@ -22267,7 +22398,7 @@ func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequ type GetStarWithdrawalUrlRequest struct { // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat OwnerId MessageSender `json:"owner_id"` - // The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") + // The number of Telegram Stars to withdraw; must be between getOption("star_withdrawal_count_min") and getOption("star_withdrawal_count_max") StarCount int64 `json:"star_count"` // The 2-step verification password of the current user Password string `json:"password"` @@ -24271,7 +24402,7 @@ type GetStarTransactionsRequest struct { // If non-empty, only transactions related to the Star Subscription will be returned SubscriptionId string `json:"subscription_id"` // Direction of the transactions to receive; pass null to get all transactions - Direction StarTransactionDirection `json:"direction"` + Direction TransactionDirection `json:"direction"` // Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` // The maximum number of transactions to return @@ -25970,6 +26101,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(result.Data) + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(result.Data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(result.Data) @@ -26315,6 +26449,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(result.Data) + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(result.Data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(result.Data) diff --git a/client/type.go b/client/type.go index 9f487c5..a98e665 100755 --- a/client/type.go +++ b/client/type.go @@ -23,14 +23,19 @@ const ( ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" + ClassSuggestedPostPrice = "SuggestedPostPrice" + ClassSuggestedPostState = "SuggestedPostState" + ClassSuggestedPostRefundReason = "SuggestedPostRefundReason" ClassStarSubscriptionType = "StarSubscriptionType" ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassUpgradedGiftOrigin = "UpgradedGiftOrigin" ClassUpgradedGiftAttributeId = "UpgradedGiftAttributeId" ClassGiftForResaleOrder = "GiftForResaleOrder" ClassSentGift = "SentGift" - ClassStarTransactionDirection = "StarTransactionDirection" + ClassTransactionDirection = "TransactionDirection" ClassStarTransactionType = "StarTransactionType" + ClassTonTransactionType = "TonTransactionType" ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" ClassGiveawayInfo = "GiveawayInfo" ClassGiveawayPrize = "GiveawayPrize" @@ -256,6 +261,8 @@ const ( ClassChatPhotos = "ChatPhotos" ClassChatPermissions = "ChatPermissions" ClassChatAdministratorRights = "ChatAdministratorRights" + ClassSuggestedPostInfo = "SuggestedPostInfo" + ClassInputSuggestedPostInfo = "InputSuggestedPostInfo" ClassStarAmount = "StarAmount" ClassStarSubscriptionPricing = "StarSubscriptionPricing" ClassStarSubscription = "StarSubscription" @@ -302,6 +309,8 @@ const ( ClassGiftUpgradePreview = "GiftUpgradePreview" ClassStarTransaction = "StarTransaction" ClassStarTransactions = "StarTransactions" + ClassTonTransaction = "TonTransaction" + ClassTonTransactions = "TonTransactions" ClassAccentColor = "AccentColor" ClassProfileAccentColors = "ProfileAccentColors" ClassProfileAccentColor = "ProfileAccentColor" @@ -780,6 +789,15 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeSuggestedPostPriceStar = "suggestedPostPriceStar" + TypeSuggestedPostPriceTon = "suggestedPostPriceTon" + TypeSuggestedPostStatePending = "suggestedPostStatePending" + TypeSuggestedPostStateApproved = "suggestedPostStateApproved" + TypeSuggestedPostStateDeclined = "suggestedPostStateDeclined" + TypeSuggestedPostInfo = "suggestedPostInfo" + TypeInputSuggestedPostInfo = "inputSuggestedPostInfo" + TypeSuggestedPostRefundReasonPostDeleted = "suggestedPostRefundReasonPostDeleted" + TypeSuggestedPostRefundReasonPaymentRefunded = "suggestedPostRefundReasonPaymentRefunded" TypeStarAmount = "starAmount" TypeStarSubscriptionTypeChannel = "starSubscriptionTypeChannel" TypeStarSubscriptionTypeBot = "starSubscriptionTypeBot" @@ -814,6 +832,9 @@ const ( TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" TypeAcceptedGiftTypes = "acceptedGiftTypes" TypeGiftSettings = "giftSettings" + TypeUpgradedGiftOriginUpgrade = "upgradedGiftOriginUpgrade" + TypeUpgradedGiftOriginTransfer = "upgradedGiftOriginTransfer" + TypeUpgradedGiftOriginResale = "upgradedGiftOriginResale" TypeUpgradedGiftModel = "upgradedGiftModel" TypeUpgradedGiftSymbol = "upgradedGiftSymbol" TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" @@ -840,8 +861,8 @@ const ( TypeReceivedGift = "receivedGift" TypeReceivedGifts = "receivedGifts" TypeGiftUpgradePreview = "giftUpgradePreview" - TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" - TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" + TypeTransactionDirectionIncoming = "transactionDirectionIncoming" + TypeTransactionDirectionOutgoing = "transactionDirectionOutgoing" TypeStarTransactionTypePremiumBotDeposit = "starTransactionTypePremiumBotDeposit" TypeStarTransactionTypeAppStoreDeposit = "starTransactionTypeAppStoreDeposit" TypeStarTransactionTypeGooglePlayDeposit = "starTransactionTypeGooglePlayDeposit" @@ -872,12 +893,19 @@ const ( TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" TypeStarTransactionTypePaidMessageSend = "starTransactionTypePaidMessageSend" TypeStarTransactionTypePaidMessageReceive = "starTransactionTypePaidMessageReceive" + TypeStarTransactionTypeSuggestedPostPaymentSend = "starTransactionTypeSuggestedPostPaymentSend" + TypeStarTransactionTypeSuggestedPostPaymentReceive = "starTransactionTypeSuggestedPostPaymentReceive" TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" TypeStarTransactionTypeBusinessBotTransferSend = "starTransactionTypeBusinessBotTransferSend" TypeStarTransactionTypeBusinessBotTransferReceive = "starTransactionTypeBusinessBotTransferReceive" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" + TypeTonTransactionTypeFragmentDeposit = "tonTransactionTypeFragmentDeposit" + TypeTonTransactionTypeSuggestedPostPayment = "tonTransactionTypeSuggestedPostPayment" + TypeTonTransactionTypeUnsupported = "tonTransactionTypeUnsupported" + TypeTonTransaction = "tonTransaction" + TypeTonTransactions = "tonTransactions" TypeGiveawayParticipantStatusEligible = "giveawayParticipantStatusEligible" TypeGiveawayParticipantStatusParticipating = "giveawayParticipantStatusParticipating" TypeGiveawayParticipantStatusAlreadyWasMember = "giveawayParticipantStatusAlreadyWasMember" @@ -1400,6 +1428,7 @@ const ( TypeMessageGiveawayCompleted = "messageGiveawayCompleted" TypeMessageGiveawayWinners = "messageGiveawayWinners" TypeMessageGiftedStars = "messageGiftedStars" + TypeMessageGiftedTon = "messageGiftedTon" TypeMessageGiveawayPrizeStars = "messageGiveawayPrizeStars" TypeMessageGift = "messageGift" TypeMessageUpgradedGift = "messageUpgradedGift" @@ -1409,6 +1438,11 @@ const ( TypeMessageDirectMessagePriceChanged = "messageDirectMessagePriceChanged" TypeMessageChecklistTasksDone = "messageChecklistTasksDone" TypeMessageChecklistTasksAdded = "messageChecklistTasksAdded" + TypeMessageSuggestedPostApprovalFailed = "messageSuggestedPostApprovalFailed" + TypeMessageSuggestedPostApproved = "messageSuggestedPostApproved" + TypeMessageSuggestedPostDeclined = "messageSuggestedPostDeclined" + TypeMessageSuggestedPostPaid = "messageSuggestedPostPaid" + TypeMessageSuggestedPostRefunded = "messageSuggestedPostRefunded" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -2087,6 +2121,7 @@ const ( TypeInternalLinkTypeMessage = "internalLinkTypeMessage" TypeInternalLinkTypeMessageDraft = "internalLinkTypeMessageDraft" TypeInternalLinkTypeMyStars = "internalLinkTypeMyStars" + TypeInternalLinkTypeMyToncoins = "internalLinkTypeMyToncoins" TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" @@ -2231,9 +2266,11 @@ const ( TypeRevenueWithdrawalStatePending = "revenueWithdrawalStatePending" TypeRevenueWithdrawalStateSucceeded = "revenueWithdrawalStateSucceeded" TypeRevenueWithdrawalStateFailed = "revenueWithdrawalStateFailed" - TypeChatRevenueTransactionTypeEarnings = "chatRevenueTransactionTypeEarnings" - TypeChatRevenueTransactionTypeWithdrawal = "chatRevenueTransactionTypeWithdrawal" - TypeChatRevenueTransactionTypeRefund = "chatRevenueTransactionTypeRefund" + TypeChatRevenueTransactionTypeUnsupported = "chatRevenueTransactionTypeUnsupported" + TypeChatRevenueTransactionTypeSponsoredMessageEarnings = "chatRevenueTransactionTypeSponsoredMessageEarnings" + TypeChatRevenueTransactionTypeSuggestedPostEarnings = "chatRevenueTransactionTypeSuggestedPostEarnings" + TypeChatRevenueTransactionTypeFragmentWithdrawal = "chatRevenueTransactionTypeFragmentWithdrawal" + TypeChatRevenueTransactionTypeFragmentRefund = "chatRevenueTransactionTypeFragmentRefund" TypeChatRevenueTransaction = "chatRevenueTransaction" TypeChatRevenueTransactions = "chatRevenueTransactions" TypeStarRevenueStatus = "starRevenueStatus" @@ -2264,6 +2301,7 @@ const ( TypeUpdateMessageMentionRead = "updateMessageMentionRead" TypeUpdateMessageUnreadReactions = "updateMessageUnreadReactions" TypeUpdateMessageFactCheck = "updateMessageFactCheck" + TypeUpdateMessageSuggestedPostInfo = "updateMessageSuggestedPostInfo" TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" TypeUpdateVideoPublished = "updateVideoPublished" TypeUpdateNewChat = "updateNewChat" @@ -2379,6 +2417,7 @@ const ( TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" TypeUpdateActiveLiveLocationMessages = "updateActiveLiveLocationMessages" TypeUpdateOwnedStarCount = "updateOwnedStarCount" + TypeUpdateOwnedTonCount = "updateOwnedTonCount" TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" TypeUpdateStarRevenueStatus = "updateStarRevenueStatus" TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" @@ -2506,6 +2545,21 @@ type InputChatPhoto interface { InputChatPhotoType() string } +// Describes price of a suggested post +type SuggestedPostPrice interface { + SuggestedPostPriceType() string +} + +// Describes state of a suggested post +type SuggestedPostState interface { + SuggestedPostStateType() string +} + +// Describes reason for refund of the payment for a suggested post +type SuggestedPostRefundReason interface { + SuggestedPostRefundReasonType() string +} + // Describes type of subscription paid in Telegram Stars type StarSubscriptionType interface { StarSubscriptionTypeType() string @@ -2521,6 +2575,11 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Describes origin from which the upgraded gift was obtained +type UpgradedGiftOrigin interface { + UpgradedGiftOriginType() string +} + // Contains identifier of an upgraded gift attribute to search for type UpgradedGiftAttributeId interface { UpgradedGiftAttributeIdType() string @@ -2536,9 +2595,9 @@ type SentGift interface { SentGiftType() string } -// Describes direction of a transaction with Telegram Stars -type StarTransactionDirection interface { - StarTransactionDirectionType() string +// Describes direction of transactions in a transaction list +type TransactionDirection interface { + TransactionDirectionType() string } // Describes type of transaction with Telegram Stars @@ -2546,6 +2605,11 @@ type StarTransactionType interface { StarTransactionTypeType() string } +// Describes type of transaction with Toncoins +type TonTransactionType interface { + TonTransactionTypeType() string +} + // Contains information about status of a user in a giveaway type GiveawayParticipantStatus interface { GiveawayParticipantStatusType() string @@ -7558,7 +7622,7 @@ type ChatPhoto struct { Sizes []*PhotoSize `json:"sizes"` // A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null Animation *AnimatedChatPhoto `json:"animation"` - // A small (160x160) animated variant of the photo in MPEG4 format; may be null even the big animation is available + // A small (160x160) animated variant of the photo in MPEG4 format; may be null even if the big animation is available SmallAnimation *AnimatedChatPhoto `json:"small_animation"` // Sticker-based version of the chat photo; may be null Sticker *ChatPhotoSticker `json:"sticker"` @@ -7812,7 +7876,7 @@ type ChatAdministratorRights struct { CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` - // True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only + // True, if the administrator can create channel posts, approve suggested channel posts, or view channel statistics; applicable to channels only CanPostMessages bool `json:"can_post_messages"` // True, if the administrator can edit messages of other users and pin messages; applicable to channels only CanEditMessages bool `json:"can_edit_messages"` @@ -7836,6 +7900,8 @@ type ChatAdministratorRights struct { CanEditStories bool `json:"can_edit_stories"` // True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only CanDeleteStories bool `json:"can_delete_stories"` + // True, if the administrator can answer to channel direct messages; applicable to channels only + CanManageDirectMessages bool `json:"can_manage_direct_messages"` // True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only IsAnonymous bool `json:"is_anonymous"` } @@ -7856,6 +7922,287 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes price of a suggested post in Telegram Stars +type SuggestedPostPriceStar struct { + meta + // The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") + StarCount int64 `json:"star_count"` +} + +func (entity *SuggestedPostPriceStar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostPriceStar + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostPriceStar) GetClass() string { + return ClassSuggestedPostPrice +} + +func (*SuggestedPostPriceStar) GetType() string { + return TypeSuggestedPostPriceStar +} + +func (*SuggestedPostPriceStar) SuggestedPostPriceType() string { + return TypeSuggestedPostPriceStar +} + +// Describes price of a suggested post in Toncoins +type SuggestedPostPriceTon struct { + meta + // The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") + ToncoinCentCount int64 `json:"toncoin_cent_count"` +} + +func (entity *SuggestedPostPriceTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostPriceTon + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostPriceTon) GetClass() string { + return ClassSuggestedPostPrice +} + +func (*SuggestedPostPriceTon) GetType() string { + return TypeSuggestedPostPriceTon +} + +func (*SuggestedPostPriceTon) SuggestedPostPriceType() string { + return TypeSuggestedPostPriceTon +} + +// The post must be approved or declined +type SuggestedPostStatePending struct{ + meta +} + +func (entity *SuggestedPostStatePending) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStatePending + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStatePending) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStatePending) GetType() string { + return TypeSuggestedPostStatePending +} + +func (*SuggestedPostStatePending) SuggestedPostStateType() string { + return TypeSuggestedPostStatePending +} + +// The post was approved +type SuggestedPostStateApproved struct{ + meta +} + +func (entity *SuggestedPostStateApproved) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStateApproved + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStateApproved) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStateApproved) GetType() string { + return TypeSuggestedPostStateApproved +} + +func (*SuggestedPostStateApproved) SuggestedPostStateType() string { + return TypeSuggestedPostStateApproved +} + +// The post was declined +type SuggestedPostStateDeclined struct{ + meta +} + +func (entity *SuggestedPostStateDeclined) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStateDeclined + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStateDeclined) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStateDeclined) GetType() string { + return TypeSuggestedPostStateDeclined +} + +func (*SuggestedPostStateDeclined) SuggestedPostStateType() string { + return TypeSuggestedPostStateDeclined +} + +// Contains information about a suggested post. If the post can be approved or declined, then changes to the post can be also suggested. Use sendMessage with reply to the message and suggested post information to suggest message changes. Use addOffer to suggest price or time changes +type SuggestedPostInfo struct { + meta + // Price of the suggested post; may be null if the post is non-paid + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published; 0 if the specific date isn't set yet + SendDate int32 `json:"send_date"` + // State of the post + State SuggestedPostState `json:"state"` + // True, if the suggested post can be approved by the current user using approveSuggestedPost; updates aren't sent when value of this field changes + CanBeApproved bool `json:"can_be_approved"` + // True, if the suggested post can be declined by the current user using declineSuggestedPost; updates aren't sent when value of this field changes + CanBeDeclined bool `json:"can_be_declined"` +} + +func (entity *SuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostInfo) GetClass() string { + return ClassSuggestedPostInfo +} + +func (*SuggestedPostInfo) GetType() string { + return TypeSuggestedPostInfo +} + +func (suggestedPostInfo *SuggestedPostInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + State json.RawMessage `json:"state"` + CanBeApproved bool `json:"can_be_approved"` + CanBeDeclined bool `json:"can_be_declined"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + suggestedPostInfo.SendDate = tmp.SendDate + suggestedPostInfo.CanBeApproved = tmp.CanBeApproved + suggestedPostInfo.CanBeDeclined = tmp.CanBeDeclined + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + suggestedPostInfo.Price = fieldPrice + + fieldState, _ := UnmarshalSuggestedPostState(tmp.State) + suggestedPostInfo.State = fieldState + + return nil +} + +// Contains information about a post to suggest +type InputSuggestedPostInfo struct { + meta + // Price of the suggested post; pass null to suggest a post without payment. If the current user isn't an administrator of the channel direct messages chat and has no enough funds to pay for the post, then the error "BALANCE_TOO_LOW" will be returned immediately + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date isn't restricted. If specified, then the date must be getOption("suggested_post_send_delay_min")-getOption("suggested_post_send_delay_max") seconds in the future + SendDate int32 `json:"send_date"` +} + +func (entity *InputSuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputSuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*InputSuggestedPostInfo) GetClass() string { + return ClassInputSuggestedPostInfo +} + +func (*InputSuggestedPostInfo) GetType() string { + return TypeInputSuggestedPostInfo +} + +func (inputSuggestedPostInfo *InputSuggestedPostInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputSuggestedPostInfo.SendDate = tmp.SendDate + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + inputSuggestedPostInfo.Price = fieldPrice + + return nil +} + +// The post was refunded, because it was deleted by channel administrators in less than getOption("suggested_post_lifetime_min") seconds +type SuggestedPostRefundReasonPostDeleted struct{ + meta +} + +func (entity *SuggestedPostRefundReasonPostDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostRefundReasonPostDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostRefundReasonPostDeleted) GetClass() string { + return ClassSuggestedPostRefundReason +} + +func (*SuggestedPostRefundReasonPostDeleted) GetType() string { + return TypeSuggestedPostRefundReasonPostDeleted +} + +func (*SuggestedPostRefundReasonPostDeleted) SuggestedPostRefundReasonType() string { + return TypeSuggestedPostRefundReasonPostDeleted +} + +// The post was refunded, because the payment for the post was refunded +type SuggestedPostRefundReasonPaymentRefunded struct{ + meta +} + +func (entity *SuggestedPostRefundReasonPaymentRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostRefundReasonPaymentRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostRefundReasonPaymentRefunded) GetClass() string { + return ClassSuggestedPostRefundReason +} + +func (*SuggestedPostRefundReasonPaymentRefunded) GetType() string { + return TypeSuggestedPostRefundReasonPaymentRefunded +} + +func (*SuggestedPostRefundReasonPaymentRefunded) SuggestedPostRefundReasonType() string { + return TypeSuggestedPostRefundReasonPaymentRefunded +} + // Describes a possibly non-integer amount of Telegram Stars type StarAmount struct { meta @@ -8897,6 +9244,85 @@ func (*GiftSettings) GetType() string { return TypeGiftSettings } +// The gift was obtained by upgrading of a previously received gift +type UpgradedGiftOriginUpgrade struct { + meta + // Identifier of the message with the regular gift that was upgraded; can be 0 or an identifier of a deleted message + GiftMessageId int64 `json:"gift_message_id"` +} + +func (entity *UpgradedGiftOriginUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginUpgrade) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginUpgrade) GetType() string { + return TypeUpgradedGiftOriginUpgrade +} + +func (*UpgradedGiftOriginUpgrade) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginUpgrade +} + +// The gift was transferred from another owner +type UpgradedGiftOriginTransfer struct{ + meta +} + +func (entity *UpgradedGiftOriginTransfer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginTransfer + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginTransfer) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginTransfer) GetType() string { + return TypeUpgradedGiftOriginTransfer +} + +func (*UpgradedGiftOriginTransfer) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginTransfer +} + +// The gift was bought from another user +type UpgradedGiftOriginResale struct { + meta + // Number of Telegram Stars that were paid by the sender for the gift + StarCount int64 `json:"star_count"` +} + +func (entity *UpgradedGiftOriginResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginResale + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginResale) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginResale) GetType() string { + return TypeUpgradedGiftOriginResale +} + +func (*UpgradedGiftOriginResale) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginResale +} + // Describes a model of an upgraded gift type UpgradedGiftModel struct { meta @@ -9068,6 +9494,8 @@ type Gift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` + // Identifier of the chat that published the gift; 0 if none + PublisherChatId int64 `json:"publisher_chat_id"` // The sticker representing the gift Sticker *Sticker `json:"sticker"` // Number of Telegram Stars that must be paid for the gift @@ -9109,6 +9537,8 @@ type UpgradedGift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` + // Identifier of the chat that published the gift; 0 if none + PublisherChatId int64 `json:"publisher_chat_id"` // The title of the upgraded gift Title string `json:"title"` // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift @@ -9158,6 +9588,7 @@ func (*UpgradedGift) GetType() string { func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { var tmp struct { Id JsonInt64 `json:"id"` + PublisherChatId int64 `json:"publisher_chat_id"` Title string `json:"title"` Name string `json:"name"` Number int32 `json:"number"` @@ -9180,6 +9611,7 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { } upgradedGift.Id = tmp.Id + upgradedGift.PublisherChatId = tmp.PublisherChatId upgradedGift.Title = tmp.Title upgradedGift.Name = tmp.Name upgradedGift.Number = tmp.Number @@ -9794,54 +10226,54 @@ func (*GiftUpgradePreview) GetType() string { return TypeGiftUpgradePreview } -// The transaction is incoming and increases the number of owned Telegram Stars -type StarTransactionDirectionIncoming struct{ +// The transaction is incoming and increases the amount of owned currency +type TransactionDirectionIncoming struct{ meta } -func (entity *StarTransactionDirectionIncoming) MarshalJSON() ([]byte, error) { +func (entity *TransactionDirectionIncoming) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionDirectionIncoming + type stub TransactionDirectionIncoming return json.Marshal((*stub)(entity)) } -func (*StarTransactionDirectionIncoming) GetClass() string { - return ClassStarTransactionDirection +func (*TransactionDirectionIncoming) GetClass() string { + return ClassTransactionDirection } -func (*StarTransactionDirectionIncoming) GetType() string { - return TypeStarTransactionDirectionIncoming +func (*TransactionDirectionIncoming) GetType() string { + return TypeTransactionDirectionIncoming } -func (*StarTransactionDirectionIncoming) StarTransactionDirectionType() string { - return TypeStarTransactionDirectionIncoming +func (*TransactionDirectionIncoming) TransactionDirectionType() string { + return TypeTransactionDirectionIncoming } -// The transaction is outgoing and decreases the number of owned Telegram Stars -type StarTransactionDirectionOutgoing struct{ +// The transaction is outgoing and decreases the amount of owned currency +type TransactionDirectionOutgoing struct{ meta } -func (entity *StarTransactionDirectionOutgoing) MarshalJSON() ([]byte, error) { +func (entity *TransactionDirectionOutgoing) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StarTransactionDirectionOutgoing + type stub TransactionDirectionOutgoing return json.Marshal((*stub)(entity)) } -func (*StarTransactionDirectionOutgoing) GetClass() string { - return ClassStarTransactionDirection +func (*TransactionDirectionOutgoing) GetClass() string { + return ClassTransactionDirection } -func (*StarTransactionDirectionOutgoing) GetType() string { - return TypeStarTransactionDirectionOutgoing +func (*TransactionDirectionOutgoing) GetType() string { + return TypeTransactionDirectionOutgoing } -func (*StarTransactionDirectionOutgoing) StarTransactionDirectionType() string { - return TypeStarTransactionDirectionOutgoing +func (*TransactionDirectionOutgoing) TransactionDirectionType() string { + return TypeTransactionDirectionOutgoing } // The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only @@ -10877,6 +11309,60 @@ func (starTransactionTypePaidMessageReceive *StarTransactionTypePaidMessageRecei return nil } +// The transaction is a payment for a suggested post; for regular users only +type StarTransactionTypeSuggestedPostPaymentSend struct { + meta + // Identifier of the channel chat that posted the post + ChatId int64 `json:"chat_id"` +} + +func (entity *StarTransactionTypeSuggestedPostPaymentSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeSuggestedPostPaymentSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) GetType() string { + return TypeStarTransactionTypeSuggestedPostPaymentSend +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) StarTransactionTypeType() string { + return TypeStarTransactionTypeSuggestedPostPaymentSend +} + +// The transaction is a receiving of a payment for a suggested post by the channel chat; for channel chats only +type StarTransactionTypeSuggestedPostPaymentReceive struct { + meta + // Identifier of the user that paid for the suggested post + UserId int64 `json:"user_id"` +} + +func (entity *StarTransactionTypeSuggestedPostPaymentReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeSuggestedPostPaymentReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) GetType() string { + return TypeStarTransactionTypeSuggestedPostPaymentReceive +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypeSuggestedPostPaymentReceive +} + // The transaction is a purchase of Telegram Premium subscription; for regular users and bots only type StarTransactionTypePremiumPurchase struct { meta @@ -11070,6 +11556,170 @@ func (*StarTransactions) GetType() string { return TypeStarTransactions } +// The transaction is a deposit of Toncoins from Fragment +type TonTransactionTypeFragmentDeposit struct { + meta + // True, if the transaction is a gift from another user + IsGift bool `json:"is_gift"` + // The sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *TonTransactionTypeFragmentDeposit) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeFragmentDeposit + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeFragmentDeposit) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeFragmentDeposit) GetType() string { + return TypeTonTransactionTypeFragmentDeposit +} + +func (*TonTransactionTypeFragmentDeposit) TonTransactionTypeType() string { + return TypeTonTransactionTypeFragmentDeposit +} + +// The transaction is a payment for a suggested post +type TonTransactionTypeSuggestedPostPayment struct { + meta + // Identifier of the channel chat that posted the post + ChatId int64 `json:"chat_id"` +} + +func (entity *TonTransactionTypeSuggestedPostPayment) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeSuggestedPostPayment + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeSuggestedPostPayment) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeSuggestedPostPayment) GetType() string { + return TypeTonTransactionTypeSuggestedPostPayment +} + +func (*TonTransactionTypeSuggestedPostPayment) TonTransactionTypeType() string { + return TypeTonTransactionTypeSuggestedPostPayment +} + +// The transaction is a transaction of an unsupported type +type TonTransactionTypeUnsupported struct{ + meta +} + +func (entity *TonTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUnsupported) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUnsupported) GetType() string { + return TypeTonTransactionTypeUnsupported +} + +func (*TonTransactionTypeUnsupported) TonTransactionTypeType() string { + return TypeTonTransactionTypeUnsupported +} + +// Represents a transaction changing the amount of owned Toncoins +type TonTransaction struct { + meta + // Unique identifier of the transaction + Id string `json:"id"` + // The amount of added owned Toncoins; negative for outgoing transactions + TonAmount int64 `json:"ton_amount"` + // True, if the transaction is a refund of a previous transaction + IsRefund bool `json:"is_refund"` + // Point in time (Unix timestamp) when the transaction was completed + Date int32 `json:"date"` + // Type of the transaction + Type TonTransactionType `json:"type"` +} + +func (entity *TonTransaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransaction + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransaction) GetClass() string { + return ClassTonTransaction +} + +func (*TonTransaction) GetType() string { + return TypeTonTransaction +} + +func (tonTransaction *TonTransaction) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + TonAmount int64 `json:"ton_amount"` + IsRefund bool `json:"is_refund"` + Date int32 `json:"date"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + tonTransaction.Id = tmp.Id + tonTransaction.TonAmount = tmp.TonAmount + tonTransaction.IsRefund = tmp.IsRefund + tonTransaction.Date = tmp.Date + + fieldType, _ := UnmarshalTonTransactionType(tmp.Type) + tonTransaction.Type = fieldType + + return nil +} + +// Represents a list of Toncoin transactions +type TonTransactions struct { + meta + // The total amount of owned Toncoins + TonAmount int64 `json:"ton_amount"` + // List of Toncoin transactions + Transactions []*TonTransaction `json:"transactions"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *TonTransactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactions + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactions) GetClass() string { + return ClassTonTransactions +} + +func (*TonTransactions) GetType() string { + return TypeTonTransactions +} + // The user is eligible for the giveaway type GiveawayParticipantStatusEligible struct{ meta @@ -13335,7 +13985,7 @@ type Supergroup struct { SignMessages bool `json:"sign_messages"` // True, if messages sent to the channel have information about the sender user. This field is only applicable to channels ShowMessageSender bool `json:"show_message_sender"` - // True, if users need to join the supergroup before they can send messages. Always true for channels and non-discussion supergroups + // True, if users need to join the supergroup before they can send messages. May be false only for discussion supergroups and channel direct messages groups JoinToSendMessages bool `json:"join_to_send_messages"` // True, if all users directly joining the supergroup need to be approved by supergroup administrators. Always false for channels and supergroups without username, location, or a linked chat JoinByRequest bool `json:"join_by_request"` @@ -15037,6 +15687,8 @@ type MessageReplyToMessage struct { MessageId int64 `json:"message_id"` // Chosen quote from the replied message; may be null if none Quote *TextQuote `json:"quote"` + // Identifier of the checklist task in the original message that was replied; 0 if none + ChecklistTaskId int32 `json:"checklist_task_id"` // Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat @@ -15070,6 +15722,7 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e ChatId int64 `json:"chat_id"` MessageId int64 `json:"message_id"` Quote *TextQuote `json:"quote"` + ChecklistTaskId int32 `json:"checklist_task_id"` Origin json.RawMessage `json:"origin"` OriginSendDate int32 `json:"origin_send_date"` Content json.RawMessage `json:"content"` @@ -15083,6 +15736,7 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e messageReplyToMessage.ChatId = tmp.ChatId messageReplyToMessage.MessageId = tmp.MessageId messageReplyToMessage.Quote = tmp.Quote + messageReplyToMessage.ChecklistTaskId = tmp.ChecklistTaskId messageReplyToMessage.OriginSendDate = tmp.OriginSendDate fieldOrigin, _ := UnmarshalMessageOrigin(tmp.Origin) @@ -15130,6 +15784,8 @@ type InputMessageReplyToMessage struct { MessageId int64 `json:"message_id"` // Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats Quote *InputTextQuote `json:"quote"` + // Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message + ChecklistTaskId int32 `json:"checklist_task_id"` } func (entity *InputMessageReplyToMessage) MarshalJSON() ([]byte, error) { @@ -15161,6 +15817,8 @@ type InputMessageReplyToExternalMessage struct { MessageId int64 `json:"message_id"` // Quote from the message to be replied; pass null if none Quote *InputTextQuote `json:"quote"` + // Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message + ChecklistTaskId int32 `json:"checklist_task_id"` } func (entity *InputMessageReplyToExternalMessage) MarshalJSON() ([]byte, error) { @@ -15262,6 +15920,10 @@ type Message struct { HasTimestampedMedia bool `json:"has_timestamped_media"` // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts IsChannelPost bool `json:"is_channel_post"` + // True, if the message is a suggested channel post which was paid in Telegram Stars; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending + IsPaidStarSuggestedPost bool `json:"is_paid_star_suggested_post"` + // True, if the message is a suggested channel post which was paid in Toncoins; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending + IsPaidTonSuggestedPost bool `json:"is_paid_ton_suggested_post"` // True, if the message contains an unread mention for the current user ContainsUnreadMention bool `json:"contains_unread_mention"` // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages @@ -15278,6 +15940,8 @@ type Message struct { UnreadReactions []*UnreadReaction `json:"unread_reactions"` // Information about fact-check added to the message; may be null if none FactCheck *FactCheck `json:"fact_check"` + // Information about the suggested post; may be null if the message isn't a suggested post + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` // Information about the message or the story this message is replying to; may be null if none ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs @@ -15343,6 +16007,8 @@ func (message *Message) UnmarshalJSON(data []byte) error { CanBeSaved bool `json:"can_be_saved"` HasTimestampedMedia bool `json:"has_timestamped_media"` IsChannelPost bool `json:"is_channel_post"` + IsPaidStarSuggestedPost bool `json:"is_paid_star_suggested_post"` + IsPaidTonSuggestedPost bool `json:"is_paid_ton_suggested_post"` ContainsUnreadMention bool `json:"contains_unread_mention"` Date int32 `json:"date"` EditDate int32 `json:"edit_date"` @@ -15351,6 +16017,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { InteractionInfo *MessageInteractionInfo `json:"interaction_info"` UnreadReactions []*UnreadReaction `json:"unread_reactions"` FactCheck *FactCheck `json:"fact_check"` + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` TopicId json.RawMessage `json:"topic_id"` @@ -15383,6 +16050,8 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.CanBeSaved = tmp.CanBeSaved message.HasTimestampedMedia = tmp.HasTimestampedMedia message.IsChannelPost = tmp.IsChannelPost + message.IsPaidStarSuggestedPost = tmp.IsPaidStarSuggestedPost + message.IsPaidTonSuggestedPost = tmp.IsPaidTonSuggestedPost message.ContainsUnreadMention = tmp.ContainsUnreadMention message.Date = tmp.Date message.EditDate = tmp.EditDate @@ -15391,6 +16060,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.InteractionInfo = tmp.InteractionInfo message.UnreadReactions = tmp.UnreadReactions message.FactCheck = tmp.FactCheck + message.SuggestedPostInfo = tmp.SuggestedPostInfo message.MessageThreadId = tmp.MessageThreadId message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn @@ -16122,9 +16792,9 @@ type VideoMessageAdvertisement struct { UniqueId int64 `json:"unique_id"` // Text of the advertisement Text string `json:"text"` - // The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds + // The minimum amount of time the advertisement must be displayed before it can be hidden by the user, in seconds MinDisplayDuration int32 `json:"min_display_duration"` - // The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds + // The maximum amount of time the advertisement must be displayed before it must be automatically hidden, in seconds MaxDisplayDuration int32 `json:"max_display_duration"` // True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement CanBeReported bool `json:"can_be_reported"` @@ -16725,6 +17395,8 @@ type DraftMessage struct { InputMessageText InputMessageContent `json:"input_message_text"` // Identifier of the effect to apply to the message when it is sent; 0 if none EffectId JsonInt64 `json:"effect_id"` + // Information about the suggested post; may be null if none + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` } func (entity *DraftMessage) MarshalJSON() ([]byte, error) { @@ -16749,6 +17421,7 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { Date int32 `json:"date"` InputMessageText json.RawMessage `json:"input_message_text"` EffectId JsonInt64 `json:"effect_id"` + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` } err := json.Unmarshal(data, &tmp) @@ -16758,6 +17431,7 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { draftMessage.Date = tmp.Date draftMessage.EffectId = tmp.EffectId + draftMessage.SuggestedPostInfo = tmp.SuggestedPostInfo fieldReplyTo, _ := UnmarshalInputMessageReplyTo(tmp.ReplyTo) draftMessage.ReplyTo = fieldReplyTo @@ -17636,7 +18310,7 @@ type Chat struct { LastMessage *Message `json:"last_message"` // Positions of the chat in chat lists Positions []*ChatPosition `json:"positions"` - // Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even it doesn't belong to the chat list and have no position in a chat list even it belongs to the chat list + // Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even if it doesn't belong to the chat list and have no position in a chat list even if it belongs to the chat list ChatLists []ChatList `json:"chat_lists"` // Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender MessageSenderId MessageSender `json:"message_sender_id"` @@ -19520,7 +20194,7 @@ type ForumTopicInfo struct { IsGeneral bool `json:"is_general"` // True, if the topic was created by the current user IsOutgoing bool `json:"is_outgoing"` - // True, if the topic is closed + // True, if the topic is closed. If the topic is closed, then the user must have can_manage_topics administrator right in the supergroup or must be the creator of the topic to send messages there IsClosed bool `json:"is_closed"` // True, if the topic is hidden above the topic list and closed; for General topic only IsHidden bool `json:"is_hidden"` @@ -23064,6 +23738,8 @@ type LinkPreviewTypeVideoChat struct { Photo *ChatPhoto `json:"photo"` // True, if the video chat is expected to be a live stream in a channel or a broadcast group IsLiveStream bool `json:"is_live_stream"` + // True, if the user can use the link to join the video chat without being muted by administrators + JoinsAsSpeaker bool `json:"joins_as_speaker"` } func (entity *LinkPreviewTypeVideoChat) MarshalJSON() ([]byte, error) { @@ -24482,7 +25158,7 @@ func (*PaidMediaUnsupported) PaidMediaType() string { // Describes parameters of a giveaway type GiveawayParameters struct { meta - // Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, or for the specified time. If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup + // Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, or for the specified time. If the chat is a channel, then can_post_messages administrator right is required in the channel, otherwise, the user must be an administrator in the supergroup BoostedChatId int64 `json:"boosted_chat_id"` // Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats AdditionalChatIds []int64 `json:"additional_chat_ids"` @@ -28884,6 +29560,41 @@ func (*MessageGiftedStars) MessageContentType() string { return TypeMessageGiftedStars } +// Toncoins were gifted to a user +type MessageGiftedTon struct { + meta + // The identifier of a user that gifted Toncoins; 0 if the gift was anonymous or is outgoing + GifterUserId int64 `json:"gifter_user_id"` + // The identifier of a user that received Toncoins; 0 if the gift is incoming + ReceiverUserId int64 `json:"receiver_user_id"` + // The received amount of Toncoins, in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` + // Identifier of the transaction for Toncoin credit; for receiver only + TransactionId string `json:"transaction_id"` + // A sticker to be shown in the message; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageGiftedTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGiftedTon + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGiftedTon) GetClass() string { + return ClassMessageContent +} + +func (*MessageGiftedTon) GetType() string { + return TypeMessageGiftedTon +} + +func (*MessageGiftedTon) MessageContentType() string { + return TypeMessageGiftedTon +} + // A Telegram Stars were received by the current user from a giveaway type MessageGiveawayPrizeStars struct { meta @@ -29028,18 +29739,16 @@ type MessageUpgradedGift struct { SenderId MessageSender `json:"sender_id"` // Receiver of the gift ReceiverId MessageSender `json:"receiver_id"` + // Origin of the upgraded gift + Origin UpgradedGiftOrigin `json:"origin"` // Unique identifier of the received gift for the current user; only for the receiver of the gift ReceivedGiftId string `json:"received_gift_id"` - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift - IsUpgrade bool `json:"is_upgrade"` // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` // True, if the gift can be transferred to another owner; only for the receiver of the gift CanBeTransferred bool `json:"can_be_transferred"` - // True, if the gift was transferred to another owner; only for the receiver of the gift + // True, if the gift has already been transferred to another owner; only for the receiver of the gift WasTransferred bool `json:"was_transferred"` - // Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred - LastResaleStarCount int64 `json:"last_resale_star_count"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift @@ -29075,12 +29784,11 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error Gift *UpgradedGift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` ReceiverId json.RawMessage `json:"receiver_id"` + Origin json.RawMessage `json:"origin"` ReceivedGiftId string `json:"received_gift_id"` - IsUpgrade bool `json:"is_upgrade"` IsSaved bool `json:"is_saved"` CanBeTransferred bool `json:"can_be_transferred"` WasTransferred bool `json:"was_transferred"` - LastResaleStarCount int64 `json:"last_resale_star_count"` TransferStarCount int64 `json:"transfer_star_count"` NextTransferDate int32 `json:"next_transfer_date"` NextResaleDate int32 `json:"next_resale_date"` @@ -29094,11 +29802,9 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error messageUpgradedGift.Gift = tmp.Gift messageUpgradedGift.ReceivedGiftId = tmp.ReceivedGiftId - messageUpgradedGift.IsUpgrade = tmp.IsUpgrade messageUpgradedGift.IsSaved = tmp.IsSaved messageUpgradedGift.CanBeTransferred = tmp.CanBeTransferred messageUpgradedGift.WasTransferred = tmp.WasTransferred - messageUpgradedGift.LastResaleStarCount = tmp.LastResaleStarCount messageUpgradedGift.TransferStarCount = tmp.TransferStarCount messageUpgradedGift.NextTransferDate = tmp.NextTransferDate messageUpgradedGift.NextResaleDate = tmp.NextResaleDate @@ -29110,6 +29816,9 @@ func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) messageUpgradedGift.ReceiverId = fieldReceiverId + fieldOrigin, _ := UnmarshalUpgradedGiftOrigin(tmp.Origin) + messageUpgradedGift.Origin = fieldOrigin + return nil } @@ -29316,6 +30025,214 @@ func (*MessageChecklistTasksAdded) MessageContentType() string { return TypeMessageChecklistTasksAdded } +// Approval of suggested post has failed, because the user which proposed the post had no enough funds +type MessageSuggestedPostApprovalFailed struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Price of the suggested post + Price SuggestedPostPrice `json:"price"` +} + +func (entity *MessageSuggestedPostApprovalFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostApprovalFailed + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostApprovalFailed) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostApprovalFailed) GetType() string { + return TypeMessageSuggestedPostApprovalFailed +} + +func (*MessageSuggestedPostApprovalFailed) MessageContentType() string { + return TypeMessageSuggestedPostApprovalFailed +} + +func (messageSuggestedPostApprovalFailed *MessageSuggestedPostApprovalFailed) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostApprovalFailed.SuggestedPostMessageId = tmp.SuggestedPostMessageId + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + messageSuggestedPostApprovalFailed.Price = fieldPrice + + return nil +} + +// A suggested post was approved +type MessageSuggestedPostApproved struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Price of the suggested post; may be null if the post is non-paid + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published + SendDate int32 `json:"send_date"` +} + +func (entity *MessageSuggestedPostApproved) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostApproved + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostApproved) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostApproved) GetType() string { + return TypeMessageSuggestedPostApproved +} + +func (*MessageSuggestedPostApproved) MessageContentType() string { + return TypeMessageSuggestedPostApproved +} + +func (messageSuggestedPostApproved *MessageSuggestedPostApproved) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostApproved.SuggestedPostMessageId = tmp.SuggestedPostMessageId + messageSuggestedPostApproved.SendDate = tmp.SendDate + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + messageSuggestedPostApproved.Price = fieldPrice + + return nil +} + +// A suggested post was declined +type MessageSuggestedPostDeclined struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Comment added by administrator of the channel when the post was declined + Comment string `json:"comment"` +} + +func (entity *MessageSuggestedPostDeclined) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostDeclined + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostDeclined) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostDeclined) GetType() string { + return TypeMessageSuggestedPostDeclined +} + +func (*MessageSuggestedPostDeclined) MessageContentType() string { + return TypeMessageSuggestedPostDeclined +} + +// A suggested post was published for getOption("suggested_post_lifetime_min") seconds and payment for the post was received +type MessageSuggestedPostPaid struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // The amount of received Telegram Stars + StarAmount *StarAmount `json:"star_amount"` + // The amount of received Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` +} + +func (entity *MessageSuggestedPostPaid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostPaid + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostPaid) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostPaid) GetType() string { + return TypeMessageSuggestedPostPaid +} + +func (*MessageSuggestedPostPaid) MessageContentType() string { + return TypeMessageSuggestedPostPaid +} + +// A suggested post was refunded +type MessageSuggestedPostRefunded struct { + meta + // Identifier of the message with the suggested post; can be 0 if the message was deleted + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Reason of the refund + Reason SuggestedPostRefundReason `json:"reason"` +} + +func (entity *MessageSuggestedPostRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostRefunded) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostRefunded) GetType() string { + return TypeMessageSuggestedPostRefunded +} + +func (*MessageSuggestedPostRefunded) MessageContentType() string { + return TypeMessageSuggestedPostRefunded +} + +func (messageSuggestedPostRefunded *MessageSuggestedPostRefunded) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Reason json.RawMessage `json:"reason"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostRefunded.SuggestedPostMessageId = tmp.SuggestedPostMessageId + + fieldReason, _ := UnmarshalSuggestedPostRefundReason(tmp.Reason) + messageSuggestedPostRefunded.Reason = fieldReason + + return nil +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -30536,6 +31453,8 @@ type MessageSendOptions struct { meta // Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` + // Information about the suggested post; pass null if none. For messages to channel direct messages chat only. Applicable only to sendMessage and addOffer + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` // Pass true to disable notification for the message DisableNotification bool `json:"disable_notification"` // Pass true if the message is sent from the background @@ -30577,6 +31496,7 @@ func (*MessageSendOptions) GetType() string { func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { var tmp struct { DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` DisableNotification bool `json:"disable_notification"` FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` @@ -30595,6 +31515,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { } messageSendOptions.DirectMessagesChatTopicId = tmp.DirectMessagesChatTopicId + messageSendOptions.SuggestedPostInfo = tmp.SuggestedPostInfo messageSendOptions.DisableNotification = tmp.DisableNotification messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent @@ -31620,12 +32541,18 @@ func (*InputMessageForwarded) InputMessageContentType() string { // Contains properties of a message and describes actions that can be done with the message right now type MessageProperties struct { meta + // True, if an offer can be added to the message using addOffer + CanAddOffer bool `json:"can_add_offer"` // True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription CanAddTasks bool `json:"can_add_tasks"` + // True, if the message is a suggested post that can be approved by the user using approveSuggestedPost + CanBeApproved bool `json:"can_be_approved"` // True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options CanBeCopied bool `json:"can_be_copied"` // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options CanBeCopiedToSecretChat bool `json:"can_be_copied_to_secret_chat"` + // True, if the message is a suggested post that can be declined by the user using declineSuggestedPost + CanBeDeclined bool `json:"can_be_declined"` // True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` // True, if the message can be deleted for all users using the method deleteMessages with revoke == true @@ -31650,6 +32577,8 @@ type MessageProperties struct { CanEditMedia bool `json:"can_edit_media"` // True, if scheduling state of the message can be edited CanEditSchedulingState bool `json:"can_edit_scheduling_state"` + // True, if another price or post send time can be suggested using addOffer + CanEditSuggestedPostInfo bool `json:"can_edit_suggested_post_info"` // True, if author of the message sent on behalf of a chat can be received through getMessageAuthor CanGetAuthor bool `json:"can_get_author"` // True, if code for message embedding can be received using getMessageEmbeddingCode @@ -42854,7 +43783,7 @@ func (*PremiumFeatureMessagePrivacy) PremiumFeatureType() string { return TypePremiumFeatureMessagePrivacy } -// The ability to view last seen and read times of other users even they can't view last seen or read time for the current user +// The ability to view last seen and read times of other users even if they can't view last seen or read time for the current user type PremiumFeatureLastSeenTimes struct{ meta } @@ -50661,6 +51590,31 @@ func (*InternalLinkTypeMyStars) InternalLinkTypeType() string { return TypeInternalLinkTypeMyStars } +// The link is a link to the screen with information about Toncoin balance and transactions of the current user +type InternalLinkTypeMyToncoins struct{ + meta +} + +func (entity *InternalLinkTypeMyToncoins) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeMyToncoins + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeMyToncoins) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeMyToncoins) GetType() string { + return TypeInternalLinkTypeMyToncoins +} + +func (*InternalLinkTypeMyToncoins) InternalLinkTypeType() string { + return TypeInternalLinkTypeMyToncoins +} + // The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it type InternalLinkTypePassportDataRequest struct { meta @@ -54970,8 +55924,33 @@ func (*RevenueWithdrawalStateFailed) RevenueWithdrawalStateType() string { return TypeRevenueWithdrawalStateFailed } +// Describes an unsupported transaction +type ChatRevenueTransactionTypeUnsupported struct{ + meta +} + +func (entity *ChatRevenueTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeUnsupported) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeUnsupported) GetType() string { + return TypeChatRevenueTransactionTypeUnsupported +} + +func (*ChatRevenueTransactionTypeUnsupported) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeUnsupported +} + // Describes earnings from sponsored messages in a chat in some time frame -type ChatRevenueTransactionTypeEarnings struct { +type ChatRevenueTransactionTypeSponsoredMessageEarnings struct { meta // Point in time (Unix timestamp) when the earnings started StartDate int32 `json:"start_date"` @@ -54979,61 +55958,85 @@ type ChatRevenueTransactionTypeEarnings struct { EndDate int32 `json:"end_date"` } -func (entity *ChatRevenueTransactionTypeEarnings) MarshalJSON() ([]byte, error) { +func (entity *ChatRevenueTransactionTypeSponsoredMessageEarnings) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueTransactionTypeEarnings + type stub ChatRevenueTransactionTypeSponsoredMessageEarnings return json.Marshal((*stub)(entity)) } -func (*ChatRevenueTransactionTypeEarnings) GetClass() string { +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) GetClass() string { return ClassChatRevenueTransactionType } -func (*ChatRevenueTransactionTypeEarnings) GetType() string { - return TypeChatRevenueTransactionTypeEarnings +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) GetType() string { + return TypeChatRevenueTransactionTypeSponsoredMessageEarnings } -func (*ChatRevenueTransactionTypeEarnings) ChatRevenueTransactionTypeType() string { - return TypeChatRevenueTransactionTypeEarnings +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeSponsoredMessageEarnings } -// Describes a withdrawal of earnings -type ChatRevenueTransactionTypeWithdrawal struct { +// Describes earnings from a published suggested post +type ChatRevenueTransactionTypeSuggestedPostEarnings struct { + meta + // Identifier of the user that paid for the suggested post + UserId int64 `json:"user_id"` +} + +func (entity *ChatRevenueTransactionTypeSuggestedPostEarnings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeSuggestedPostEarnings + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) GetType() string { + return TypeChatRevenueTransactionTypeSuggestedPostEarnings +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeSuggestedPostEarnings +} + +// Describes a withdrawal of earnings through Fragment +type ChatRevenueTransactionTypeFragmentWithdrawal struct { meta // Point in time (Unix timestamp) when the earnings withdrawal started WithdrawalDate int32 `json:"withdrawal_date"` - // Name of the payment provider - Provider string `json:"provider"` // State of the withdrawal State RevenueWithdrawalState `json:"state"` } -func (entity *ChatRevenueTransactionTypeWithdrawal) MarshalJSON() ([]byte, error) { +func (entity *ChatRevenueTransactionTypeFragmentWithdrawal) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueTransactionTypeWithdrawal + type stub ChatRevenueTransactionTypeFragmentWithdrawal return json.Marshal((*stub)(entity)) } -func (*ChatRevenueTransactionTypeWithdrawal) GetClass() string { +func (*ChatRevenueTransactionTypeFragmentWithdrawal) GetClass() string { return ClassChatRevenueTransactionType } -func (*ChatRevenueTransactionTypeWithdrawal) GetType() string { - return TypeChatRevenueTransactionTypeWithdrawal +func (*ChatRevenueTransactionTypeFragmentWithdrawal) GetType() string { + return TypeChatRevenueTransactionTypeFragmentWithdrawal } -func (*ChatRevenueTransactionTypeWithdrawal) ChatRevenueTransactionTypeType() string { - return TypeChatRevenueTransactionTypeWithdrawal +func (*ChatRevenueTransactionTypeFragmentWithdrawal) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeFragmentWithdrawal } -func (chatRevenueTransactionTypeWithdrawal *ChatRevenueTransactionTypeWithdrawal) UnmarshalJSON(data []byte) error { +func (chatRevenueTransactionTypeFragmentWithdrawal *ChatRevenueTransactionTypeFragmentWithdrawal) UnmarshalJSON(data []byte) error { var tmp struct { WithdrawalDate int32 `json:"withdrawal_date"` - Provider string `json:"provider"` State json.RawMessage `json:"state"` } @@ -55042,42 +56045,39 @@ func (chatRevenueTransactionTypeWithdrawal *ChatRevenueTransactionTypeWithdrawal return err } - chatRevenueTransactionTypeWithdrawal.WithdrawalDate = tmp.WithdrawalDate - chatRevenueTransactionTypeWithdrawal.Provider = tmp.Provider + chatRevenueTransactionTypeFragmentWithdrawal.WithdrawalDate = tmp.WithdrawalDate fieldState, _ := UnmarshalRevenueWithdrawalState(tmp.State) - chatRevenueTransactionTypeWithdrawal.State = fieldState + chatRevenueTransactionTypeFragmentWithdrawal.State = fieldState return nil } -// Describes a refund for failed withdrawal of earnings -type ChatRevenueTransactionTypeRefund struct { +// Describes a refund for failed withdrawal of earnings through Fragment +type ChatRevenueTransactionTypeFragmentRefund struct { meta // Point in time (Unix timestamp) when the transaction was refunded RefundDate int32 `json:"refund_date"` - // Name of the payment provider - Provider string `json:"provider"` } -func (entity *ChatRevenueTransactionTypeRefund) MarshalJSON() ([]byte, error) { +func (entity *ChatRevenueTransactionTypeFragmentRefund) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatRevenueTransactionTypeRefund + type stub ChatRevenueTransactionTypeFragmentRefund return json.Marshal((*stub)(entity)) } -func (*ChatRevenueTransactionTypeRefund) GetClass() string { +func (*ChatRevenueTransactionTypeFragmentRefund) GetClass() string { return ClassChatRevenueTransactionType } -func (*ChatRevenueTransactionTypeRefund) GetType() string { - return TypeChatRevenueTransactionTypeRefund +func (*ChatRevenueTransactionTypeFragmentRefund) GetType() string { + return TypeChatRevenueTransactionTypeFragmentRefund } -func (*ChatRevenueTransactionTypeRefund) ChatRevenueTransactionTypeType() string { - return TypeChatRevenueTransactionTypeRefund +func (*ChatRevenueTransactionTypeFragmentRefund) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeFragmentRefund } // Contains a chat revenue transactions @@ -55131,10 +56131,12 @@ func (chatRevenueTransaction *ChatRevenueTransaction) UnmarshalJSON(data []byte) // Contains a list of chat revenue transactions type ChatRevenueTransactions struct { meta - // Total number of transactions - TotalCount int32 `json:"total_count"` + // The amount of owned Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` // List of transactions Transactions []*ChatRevenueTransaction `json:"transactions"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` } func (entity *ChatRevenueTransactions) MarshalJSON() ([]byte, error) { @@ -56028,6 +57030,37 @@ func (*UpdateMessageFactCheck) UpdateType() string { return TypeUpdateMessageFactCheck } +// Information about suggested post of a message was changed +type UpdateMessageSuggestedPostInfo struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // The new information about the suggested post + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` +} + +func (entity *UpdateMessageSuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageSuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageSuggestedPostInfo) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageSuggestedPostInfo) GetType() string { + return TypeUpdateMessageSuggestedPostInfo +} + +func (*UpdateMessageSuggestedPostInfo) UpdateType() string { + return TypeUpdateMessageSuggestedPostInfo +} + // A message with a live location was viewed. When the update is received, the application is expected to update the live location type UpdateMessageLiveLocationViewed struct { meta @@ -58511,7 +59544,7 @@ type UpdateGroupCallParticipants struct { meta // Identifier of the group call GroupCallId int32 `json:"group_call_id"` - // New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. The participants must be shown in the list of group call participants even there is no information about them + // New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. The participants must be shown in the list of group call participants even if there is no information about them ParticipantUserIds []JsonInt64 `json:"participant_user_ids"` } @@ -59837,6 +60870,33 @@ func (*UpdateOwnedStarCount) UpdateType() string { return TypeUpdateOwnedStarCount } +// The number of Toncoins owned by the current user has changed +type UpdateOwnedTonCount struct { + meta + // The new amount of owned Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` +} + +func (entity *UpdateOwnedTonCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateOwnedTonCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateOwnedTonCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateOwnedTonCount) GetType() string { + return TypeUpdateOwnedTonCount +} + +func (*UpdateOwnedTonCount) UpdateType() string { + return TypeUpdateOwnedTonCount +} + // The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions type UpdateChatRevenueAmount struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 5991657..829ea95 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -662,6 +662,111 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } +func UnmarshalSuggestedPostPrice(data json.RawMessage) (SuggestedPostPrice, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostPriceStar: + return UnmarshalSuggestedPostPriceStar(data) + + case TypeSuggestedPostPriceTon: + return UnmarshalSuggestedPostPriceTon(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostPrice(dataList []json.RawMessage) ([]SuggestedPostPrice, error) { + list := []SuggestedPostPrice{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostPrice(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSuggestedPostState(data json.RawMessage) (SuggestedPostState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostStatePending: + return UnmarshalSuggestedPostStatePending(data) + + case TypeSuggestedPostStateApproved: + return UnmarshalSuggestedPostStateApproved(data) + + case TypeSuggestedPostStateDeclined: + return UnmarshalSuggestedPostStateDeclined(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostState(dataList []json.RawMessage) ([]SuggestedPostState, error) { + list := []SuggestedPostState{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSuggestedPostRefundReason(data json.RawMessage) (SuggestedPostRefundReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostRefundReasonPostDeleted: + return UnmarshalSuggestedPostRefundReasonPostDeleted(data) + + case TypeSuggestedPostRefundReasonPaymentRefunded: + return UnmarshalSuggestedPostRefundReasonPaymentRefunded(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostRefundReason(dataList []json.RawMessage) ([]SuggestedPostRefundReason, error) { + list := []SuggestedPostRefundReason{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostRefundReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarSubscriptionType(data json.RawMessage) (StarSubscriptionType, error) { var meta meta @@ -770,6 +875,43 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalUpgradedGiftOrigin(data json.RawMessage) (UpgradedGiftOrigin, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUpgradedGiftOriginUpgrade: + return UnmarshalUpgradedGiftOriginUpgrade(data) + + case TypeUpgradedGiftOriginTransfer: + return UnmarshalUpgradedGiftOriginTransfer(data) + + case TypeUpgradedGiftOriginResale: + return UnmarshalUpgradedGiftOriginResale(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUpgradedGiftOrigin(dataList []json.RawMessage) ([]UpgradedGiftOrigin, error) { + list := []UpgradedGiftOrigin{} + + for _, data := range dataList { + entity, err := UnmarshalUpgradedGiftOrigin(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUpgradedGiftAttributeId(data json.RawMessage) (UpgradedGiftAttributeId, error) { var meta meta @@ -878,7 +1020,7 @@ func UnmarshalListOfSentGift(dataList []json.RawMessage) ([]SentGift, error) { return list, nil } -func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDirection, error) { +func UnmarshalTransactionDirection(data json.RawMessage) (TransactionDirection, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -887,22 +1029,22 @@ func UnmarshalStarTransactionDirection(data json.RawMessage) (StarTransactionDir } switch meta.Type { - case TypeStarTransactionDirectionIncoming: - return UnmarshalStarTransactionDirectionIncoming(data) + case TypeTransactionDirectionIncoming: + return UnmarshalTransactionDirectionIncoming(data) - case TypeStarTransactionDirectionOutgoing: - return UnmarshalStarTransactionDirectionOutgoing(data) + case TypeTransactionDirectionOutgoing: + return UnmarshalTransactionDirectionOutgoing(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfStarTransactionDirection(dataList []json.RawMessage) ([]StarTransactionDirection, error) { - list := []StarTransactionDirection{} +func UnmarshalListOfTransactionDirection(dataList []json.RawMessage) ([]TransactionDirection, error) { + list := []TransactionDirection{} for _, data := range dataList { - entity, err := UnmarshalStarTransactionDirection(data) + entity, err := UnmarshalTransactionDirection(data) if err != nil { return nil, err } @@ -1011,6 +1153,12 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypePaidMessageReceive: return UnmarshalStarTransactionTypePaidMessageReceive(data) + case TypeStarTransactionTypeSuggestedPostPaymentSend: + return UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data) + + case TypeStarTransactionTypeSuggestedPostPaymentReceive: + return UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data) + case TypeStarTransactionTypePremiumPurchase: return UnmarshalStarTransactionTypePremiumPurchase(data) @@ -1042,6 +1190,43 @@ func UnmarshalListOfStarTransactionType(dataList []json.RawMessage) ([]StarTrans return list, nil } +func UnmarshalTonTransactionType(data json.RawMessage) (TonTransactionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTonTransactionTypeFragmentDeposit: + return UnmarshalTonTransactionTypeFragmentDeposit(data) + + case TypeTonTransactionTypeSuggestedPostPayment: + return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + + case TypeTonTransactionTypeUnsupported: + return UnmarshalTonTransactionTypeUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTonTransactionType(dataList []json.RawMessage) ([]TonTransactionType, error) { + list := []TonTransactionType{} + + for _, data := range dataList { + entity, err := UnmarshalTonTransactionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalGiveawayParticipantStatus(data json.RawMessage) (GiveawayParticipantStatus, error) { var meta meta @@ -3633,6 +3818,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageGiftedStars: return UnmarshalMessageGiftedStars(data) + case TypeMessageGiftedTon: + return UnmarshalMessageGiftedTon(data) + case TypeMessageGiveawayPrizeStars: return UnmarshalMessageGiveawayPrizeStars(data) @@ -3660,6 +3848,21 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageChecklistTasksAdded: return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageSuggestedPostApprovalFailed: + return UnmarshalMessageSuggestedPostApprovalFailed(data) + + case TypeMessageSuggestedPostApproved: + return UnmarshalMessageSuggestedPostApproved(data) + + case TypeMessageSuggestedPostDeclined: + return UnmarshalMessageSuggestedPostDeclined(data) + + case TypeMessageSuggestedPostPaid: + return UnmarshalMessageSuggestedPostPaid(data) + + case TypeMessageSuggestedPostRefunded: + return UnmarshalMessageSuggestedPostRefunded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -7384,6 +7587,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeMyStars: return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypeMyToncoins: + return UnmarshalInternalLinkTypeMyToncoins(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -8147,14 +8353,20 @@ func UnmarshalChatRevenueTransactionType(data json.RawMessage) (ChatRevenueTrans } switch meta.Type { - case TypeChatRevenueTransactionTypeEarnings: - return UnmarshalChatRevenueTransactionTypeEarnings(data) + case TypeChatRevenueTransactionTypeUnsupported: + return UnmarshalChatRevenueTransactionTypeUnsupported(data) - case TypeChatRevenueTransactionTypeWithdrawal: - return UnmarshalChatRevenueTransactionTypeWithdrawal(data) + case TypeChatRevenueTransactionTypeSponsoredMessageEarnings: + return UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data) - case TypeChatRevenueTransactionTypeRefund: - return UnmarshalChatRevenueTransactionTypeRefund(data) + case TypeChatRevenueTransactionTypeSuggestedPostEarnings: + return UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data) + + case TypeChatRevenueTransactionTypeFragmentWithdrawal: + return UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data) + + case TypeChatRevenueTransactionTypeFragmentRefund: + return UnmarshalChatRevenueTransactionTypeFragmentRefund(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) @@ -8343,6 +8555,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(data) + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) @@ -8688,6 +8903,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(data) + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(data) @@ -10005,6 +10223,78 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalSuggestedPostPriceStar(data json.RawMessage) (*SuggestedPostPriceStar, error) { + var resp SuggestedPostPriceStar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostPriceTon(data json.RawMessage) (*SuggestedPostPriceTon, error) { + var resp SuggestedPostPriceTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStatePending(data json.RawMessage) (*SuggestedPostStatePending, error) { + var resp SuggestedPostStatePending + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStateApproved(data json.RawMessage) (*SuggestedPostStateApproved, error) { + var resp SuggestedPostStateApproved + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStateDeclined(data json.RawMessage) (*SuggestedPostStateDeclined, error) { + var resp SuggestedPostStateDeclined + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostInfo(data json.RawMessage) (*SuggestedPostInfo, error) { + var resp SuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputSuggestedPostInfo(data json.RawMessage) (*InputSuggestedPostInfo, error) { + var resp InputSuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostRefundReasonPostDeleted(data json.RawMessage) (*SuggestedPostRefundReasonPostDeleted, error) { + var resp SuggestedPostRefundReasonPostDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostRefundReasonPaymentRefunded(data json.RawMessage) (*SuggestedPostRefundReasonPaymentRefunded, error) { + var resp SuggestedPostRefundReasonPaymentRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarAmount(data json.RawMessage) (*StarAmount, error) { var resp StarAmount @@ -10277,6 +10567,30 @@ func UnmarshalGiftSettings(data json.RawMessage) (*GiftSettings, error) { return &resp, err } +func UnmarshalUpgradedGiftOriginUpgrade(data json.RawMessage) (*UpgradedGiftOriginUpgrade, error) { + var resp UpgradedGiftOriginUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginTransfer(data json.RawMessage) (*UpgradedGiftOriginTransfer, error) { + var resp UpgradedGiftOriginTransfer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginResale(data json.RawMessage) (*UpgradedGiftOriginResale, error) { + var resp UpgradedGiftOriginResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { var resp UpgradedGiftModel @@ -10485,16 +10799,16 @@ func UnmarshalGiftUpgradePreview(data json.RawMessage) (*GiftUpgradePreview, err return &resp, err } -func UnmarshalStarTransactionDirectionIncoming(data json.RawMessage) (*StarTransactionDirectionIncoming, error) { - var resp StarTransactionDirectionIncoming +func UnmarshalTransactionDirectionIncoming(data json.RawMessage) (*TransactionDirectionIncoming, error) { + var resp TransactionDirectionIncoming err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalStarTransactionDirectionOutgoing(data json.RawMessage) (*StarTransactionDirectionOutgoing, error) { - var resp StarTransactionDirectionOutgoing +func UnmarshalTransactionDirectionOutgoing(data json.RawMessage) (*TransactionDirectionOutgoing, error) { + var resp TransactionDirectionOutgoing err := json.Unmarshal(data, &resp) @@ -10741,6 +11055,22 @@ func UnmarshalStarTransactionTypePaidMessageReceive(data json.RawMessage) (*Star return &resp, err } +func UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data json.RawMessage) (*StarTransactionTypeSuggestedPostPaymentSend, error) { + var resp StarTransactionTypeSuggestedPostPaymentSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data json.RawMessage) (*StarTransactionTypeSuggestedPostPaymentReceive, error) { + var resp StarTransactionTypeSuggestedPostPaymentReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypePremiumPurchase(data json.RawMessage) (*StarTransactionTypePremiumPurchase, error) { var resp StarTransactionTypePremiumPurchase @@ -10789,6 +11119,46 @@ func UnmarshalStarTransactions(data json.RawMessage) (*StarTransactions, error) return &resp, err } +func UnmarshalTonTransactionTypeFragmentDeposit(data json.RawMessage) (*TonTransactionTypeFragmentDeposit, error) { + var resp TonTransactionTypeFragmentDeposit + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeSuggestedPostPayment(data json.RawMessage) (*TonTransactionTypeSuggestedPostPayment, error) { + var resp TonTransactionTypeSuggestedPostPayment + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeUnsupported(data json.RawMessage) (*TonTransactionTypeUnsupported, error) { + var resp TonTransactionTypeUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransaction(data json.RawMessage) (*TonTransaction, error) { + var resp TonTransaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactions(data json.RawMessage) (*TonTransactions, error) { + var resp TonTransactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalGiveawayParticipantStatusEligible(data json.RawMessage) (*GiveawayParticipantStatusEligible, error) { var resp GiveawayParticipantStatusEligible @@ -14965,6 +15335,14 @@ func UnmarshalMessageGiftedStars(data json.RawMessage) (*MessageGiftedStars, err return &resp, err } +func UnmarshalMessageGiftedTon(data json.RawMessage) (*MessageGiftedTon, error) { + var resp MessageGiftedTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageGiveawayPrizeStars(data json.RawMessage) (*MessageGiveawayPrizeStars, error) { var resp MessageGiveawayPrizeStars @@ -15037,6 +15415,46 @@ func UnmarshalMessageChecklistTasksAdded(data json.RawMessage) (*MessageChecklis return &resp, err } +func UnmarshalMessageSuggestedPostApprovalFailed(data json.RawMessage) (*MessageSuggestedPostApprovalFailed, error) { + var resp MessageSuggestedPostApprovalFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostApproved(data json.RawMessage) (*MessageSuggestedPostApproved, error) { + var resp MessageSuggestedPostApproved + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostDeclined(data json.RawMessage) (*MessageSuggestedPostDeclined, error) { + var resp MessageSuggestedPostDeclined + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostPaid(data json.RawMessage) (*MessageSuggestedPostPaid, error) { + var resp MessageSuggestedPostPaid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostRefunded(data json.RawMessage) (*MessageSuggestedPostRefunded, error) { + var resp MessageSuggestedPostRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -20461,6 +20879,14 @@ func UnmarshalInternalLinkTypeMyStars(data json.RawMessage) (*InternalLinkTypeMy return &resp, err } +func UnmarshalInternalLinkTypeMyToncoins(data json.RawMessage) (*InternalLinkTypeMyToncoins, error) { + var resp InternalLinkTypeMyToncoins + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypePassportDataRequest(data json.RawMessage) (*InternalLinkTypePassportDataRequest, error) { var resp InternalLinkTypePassportDataRequest @@ -21613,24 +22039,40 @@ func UnmarshalRevenueWithdrawalStateFailed(data json.RawMessage) (*RevenueWithdr return &resp, err } -func UnmarshalChatRevenueTransactionTypeEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeEarnings, error) { - var resp ChatRevenueTransactionTypeEarnings +func UnmarshalChatRevenueTransactionTypeUnsupported(data json.RawMessage) (*ChatRevenueTransactionTypeUnsupported, error) { + var resp ChatRevenueTransactionTypeUnsupported err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatRevenueTransactionTypeWithdrawal(data json.RawMessage) (*ChatRevenueTransactionTypeWithdrawal, error) { - var resp ChatRevenueTransactionTypeWithdrawal +func UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeSponsoredMessageEarnings, error) { + var resp ChatRevenueTransactionTypeSponsoredMessageEarnings err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatRevenueTransactionTypeRefund(data json.RawMessage) (*ChatRevenueTransactionTypeRefund, error) { - var resp ChatRevenueTransactionTypeRefund +func UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeSuggestedPostEarnings, error) { + var resp ChatRevenueTransactionTypeSuggestedPostEarnings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data json.RawMessage) (*ChatRevenueTransactionTypeFragmentWithdrawal, error) { + var resp ChatRevenueTransactionTypeFragmentWithdrawal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeFragmentRefund(data json.RawMessage) (*ChatRevenueTransactionTypeFragmentRefund, error) { + var resp ChatRevenueTransactionTypeFragmentRefund err := json.Unmarshal(data, &resp) @@ -21877,6 +22319,14 @@ func UnmarshalUpdateMessageFactCheck(data json.RawMessage) (*UpdateMessageFactCh return &resp, err } +func UnmarshalUpdateMessageSuggestedPostInfo(data json.RawMessage) (*UpdateMessageSuggestedPostInfo, error) { + var resp UpdateMessageSuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateMessageLiveLocationViewed(data json.RawMessage) (*UpdateMessageLiveLocationViewed, error) { var resp UpdateMessageLiveLocationViewed @@ -22797,6 +23247,14 @@ func UnmarshalUpdateOwnedStarCount(data json.RawMessage) (*UpdateOwnedStarCount, return &resp, err } +func UnmarshalUpdateOwnedTonCount(data json.RawMessage) (*UpdateOwnedTonCount, error) { + var resp UpdateOwnedTonCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatRevenueAmount(data json.RawMessage) (*UpdateChatRevenueAmount, error) { var resp UpdateChatRevenueAmount @@ -23604,6 +24062,33 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeSuggestedPostPriceStar: + return UnmarshalSuggestedPostPriceStar(data) + + case TypeSuggestedPostPriceTon: + return UnmarshalSuggestedPostPriceTon(data) + + case TypeSuggestedPostStatePending: + return UnmarshalSuggestedPostStatePending(data) + + case TypeSuggestedPostStateApproved: + return UnmarshalSuggestedPostStateApproved(data) + + case TypeSuggestedPostStateDeclined: + return UnmarshalSuggestedPostStateDeclined(data) + + case TypeSuggestedPostInfo: + return UnmarshalSuggestedPostInfo(data) + + case TypeInputSuggestedPostInfo: + return UnmarshalInputSuggestedPostInfo(data) + + case TypeSuggestedPostRefundReasonPostDeleted: + return UnmarshalSuggestedPostRefundReasonPostDeleted(data) + + case TypeSuggestedPostRefundReasonPaymentRefunded: + return UnmarshalSuggestedPostRefundReasonPaymentRefunded(data) + case TypeStarAmount: return UnmarshalStarAmount(data) @@ -23706,6 +24191,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftSettings: return UnmarshalGiftSettings(data) + case TypeUpgradedGiftOriginUpgrade: + return UnmarshalUpgradedGiftOriginUpgrade(data) + + case TypeUpgradedGiftOriginTransfer: + return UnmarshalUpgradedGiftOriginTransfer(data) + + case TypeUpgradedGiftOriginResale: + return UnmarshalUpgradedGiftOriginResale(data) + case TypeUpgradedGiftModel: return UnmarshalUpgradedGiftModel(data) @@ -23784,11 +24278,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftUpgradePreview: return UnmarshalGiftUpgradePreview(data) - case TypeStarTransactionDirectionIncoming: - return UnmarshalStarTransactionDirectionIncoming(data) + case TypeTransactionDirectionIncoming: + return UnmarshalTransactionDirectionIncoming(data) - case TypeStarTransactionDirectionOutgoing: - return UnmarshalStarTransactionDirectionOutgoing(data) + case TypeTransactionDirectionOutgoing: + return UnmarshalTransactionDirectionOutgoing(data) case TypeStarTransactionTypePremiumBotDeposit: return UnmarshalStarTransactionTypePremiumBotDeposit(data) @@ -23880,6 +24374,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypePaidMessageReceive: return UnmarshalStarTransactionTypePaidMessageReceive(data) + case TypeStarTransactionTypeSuggestedPostPaymentSend: + return UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data) + + case TypeStarTransactionTypeSuggestedPostPaymentReceive: + return UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data) + case TypeStarTransactionTypePremiumPurchase: return UnmarshalStarTransactionTypePremiumPurchase(data) @@ -23898,6 +24398,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactions: return UnmarshalStarTransactions(data) + case TypeTonTransactionTypeFragmentDeposit: + return UnmarshalTonTransactionTypeFragmentDeposit(data) + + case TypeTonTransactionTypeSuggestedPostPayment: + return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + + case TypeTonTransactionTypeUnsupported: + return UnmarshalTonTransactionTypeUnsupported(data) + + case TypeTonTransaction: + return UnmarshalTonTransaction(data) + + case TypeTonTransactions: + return UnmarshalTonTransactions(data) + case TypeGiveawayParticipantStatusEligible: return UnmarshalGiveawayParticipantStatusEligible(data) @@ -25464,6 +25979,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageGiftedStars: return UnmarshalMessageGiftedStars(data) + case TypeMessageGiftedTon: + return UnmarshalMessageGiftedTon(data) + case TypeMessageGiveawayPrizeStars: return UnmarshalMessageGiveawayPrizeStars(data) @@ -25491,6 +26009,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageChecklistTasksAdded: return UnmarshalMessageChecklistTasksAdded(data) + case TypeMessageSuggestedPostApprovalFailed: + return UnmarshalMessageSuggestedPostApprovalFailed(data) + + case TypeMessageSuggestedPostApproved: + return UnmarshalMessageSuggestedPostApproved(data) + + case TypeMessageSuggestedPostDeclined: + return UnmarshalMessageSuggestedPostDeclined(data) + + case TypeMessageSuggestedPostPaid: + return UnmarshalMessageSuggestedPostPaid(data) + + case TypeMessageSuggestedPostRefunded: + return UnmarshalMessageSuggestedPostRefunded(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -27525,6 +28058,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeMyStars: return UnmarshalInternalLinkTypeMyStars(data) + case TypeInternalLinkTypeMyToncoins: + return UnmarshalInternalLinkTypeMyToncoins(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) @@ -27957,14 +28493,20 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeRevenueWithdrawalStateFailed: return UnmarshalRevenueWithdrawalStateFailed(data) - case TypeChatRevenueTransactionTypeEarnings: - return UnmarshalChatRevenueTransactionTypeEarnings(data) + case TypeChatRevenueTransactionTypeUnsupported: + return UnmarshalChatRevenueTransactionTypeUnsupported(data) - case TypeChatRevenueTransactionTypeWithdrawal: - return UnmarshalChatRevenueTransactionTypeWithdrawal(data) + case TypeChatRevenueTransactionTypeSponsoredMessageEarnings: + return UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data) - case TypeChatRevenueTransactionTypeRefund: - return UnmarshalChatRevenueTransactionTypeRefund(data) + case TypeChatRevenueTransactionTypeSuggestedPostEarnings: + return UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data) + + case TypeChatRevenueTransactionTypeFragmentWithdrawal: + return UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data) + + case TypeChatRevenueTransactionTypeFragmentRefund: + return UnmarshalChatRevenueTransactionTypeFragmentRefund(data) case TypeChatRevenueTransaction: return UnmarshalChatRevenueTransaction(data) @@ -28056,6 +28598,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(data) + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) @@ -28401,6 +28946,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateOwnedStarCount: return UnmarshalUpdateOwnedStarCount(data) + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(data) + case TypeUpdateChatRevenueAmount: return UnmarshalUpdateChatRevenueAmount(data) diff --git a/data/td_api.tl b/data/td_api.tl index 29d016b..deb1b8f 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -828,7 +828,7 @@ animatedChatPhoto length:int32 file:file main_frame_timestamp:double = AnimatedC //@minithumbnail Photo minithumbnail; may be null //@sizes Available variants of the photo in JPEG format, in different size //@animation A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null -//@small_animation A small (160x160) animated variant of the photo in MPEG4 format; may be null even the big animation is available +//@small_animation A small (160x160) animated variant of the photo in MPEG4 format; may be null even if the big animation is available //@sticker Sticker-based version of the chat photo; may be null chatPhoto id:int64 added_date:int32 minithumbnail:minithumbnail sizes:vector animation:animatedChatPhoto small_animation:animatedChatPhoto sticker:chatPhotoSticker = ChatPhoto; @@ -877,7 +877,7 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum //@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, //-ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only //@can_change_info True, if the administrator can change the chat title, photo, and other settings -//@can_post_messages True, if the administrator can create channel posts, answer to channel direct messages, or view channel statistics; applicable to channels only +//@can_post_messages True, if the administrator can create channel posts, approve suggested channel posts, or view channel statistics; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only //@can_delete_messages True, if the administrator can delete messages of other users //@can_invite_users True, if the administrator can invite new users to the chat @@ -889,8 +889,58 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum //@can_post_stories True, if the administrator can create new chat stories, or edit and delete posted stories; applicable to supergroups and channels only //@can_edit_stories True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access story archive; applicable to supergroups and channels only //@can_delete_stories True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only +//@can_manage_direct_messages True, if the administrator can answer to channel direct messages; applicable to channels only //@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only -chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; +chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool can_manage_direct_messages:Bool is_anonymous:Bool = ChatAdministratorRights; + + +//@class SuggestedPostPrice @description Describes price of a suggested post + +//@description Describes price of a suggested post in Telegram Stars +//@star_count The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") +suggestedPostPriceStar star_count:int53 = SuggestedPostPrice; + +//@description Describes price of a suggested post in Toncoins +//@toncoin_cent_count The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") +suggestedPostPriceTon toncoin_cent_count:int53 = SuggestedPostPrice; + + +//@class SuggestedPostState @description Describes state of a suggested post + +//@description The post must be approved or declined +suggestedPostStatePending = SuggestedPostState; + +//@description The post was approved +suggestedPostStateApproved = SuggestedPostState; + +//@description The post was declined +suggestedPostStateDeclined = SuggestedPostState; + + +//@description Contains information about a suggested post. If the post can be approved or declined, then changes to the post can be also suggested. Use sendMessage with reply to the message +//-and suggested post information to suggest message changes. Use addOffer to suggest price or time changes +//@price Price of the suggested post; may be null if the post is non-paid +//@send_date Point in time (Unix timestamp) when the post is expected to be published; 0 if the specific date isn't set yet +//@state State of the post +//@can_be_approved True, if the suggested post can be approved by the current user using approveSuggestedPost; updates aren't sent when value of this field changes +//@can_be_declined True, if the suggested post can be declined by the current user using declineSuggestedPost; updates aren't sent when value of this field changes +suggestedPostInfo price:SuggestedPostPrice send_date:int32 state:SuggestedPostState can_be_approved:Bool can_be_declined:Bool = SuggestedPostInfo; + +//@description Contains information about a post to suggest +//@price Price of the suggested post; pass null to suggest a post without payment. If the current user isn't an administrator of the channel direct messages chat +//-and has no enough funds to pay for the post, then the error "BALANCE_TOO_LOW" will be returned immediately +//@send_date Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date isn't restricted. If specified, +//-then the date must be getOption("suggested_post_send_delay_min")-getOption("suggested_post_send_delay_max") seconds in the future +inputSuggestedPostInfo price:SuggestedPostPrice send_date:int32 = InputSuggestedPostInfo; + + +//@class SuggestedPostRefundReason @description Describes reason for refund of the payment for a suggested post + +//@description The post was refunded, because it was deleted by channel administrators in less than getOption("suggested_post_lifetime_min") seconds +suggestedPostRefundReasonPostDeleted = SuggestedPostRefundReason; + +//@description The post was refunded, because the payment for the post was refunded +suggestedPostRefundReasonPaymentRefunded = SuggestedPostRefundReason; //@description Describes a possibly non-integer amount of Telegram Stars @@ -1110,6 +1160,20 @@ acceptedGiftTypes unlimited_gifts:Bool limited_gifts:Bool upgraded_gifts:Bool pr //@accepted_gift_types Types of gifts accepted by the user; for Telegram Premium users only giftSettings show_gift_button:Bool accepted_gift_types:acceptedGiftTypes = GiftSettings; + +//@class UpgradedGiftOrigin @description Describes origin from which the upgraded gift was obtained + +//@description The gift was obtained by upgrading of a previously received gift +//@gift_message_id Identifier of the message with the regular gift that was upgraded; can be 0 or an identifier of a deleted message +upgradedGiftOriginUpgrade gift_message_id:int53 = UpgradedGiftOrigin; + +//@description The gift was transferred from another owner +upgradedGiftOriginTransfer = UpgradedGiftOrigin; + +//@description The gift was bought from another user @star_count Number of Telegram Stars that were paid by the sender for the gift +upgradedGiftOriginResale star_count:int53 = UpgradedGiftOrigin; + + //@description Describes a model of an upgraded gift //@name Name of the model //@sticker The sticker representing the upgraded gift @@ -1145,6 +1209,7 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@description Describes a gift that can be sent to another user or channel chat //@id Unique identifier of the gift +//@publisher_chat_id Identifier of the chat that published the gift; 0 if none //@sticker The sticker representing the gift //@star_count Number of Telegram Stars that must be paid for the gift //@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed @@ -1154,10 +1219,11 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@total_count Number of total times the gift can be purchased; 0 if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; //@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift +//@publisher_chat_id Identifier of the chat that published the gift; 0 if none //@title The title of the upgraded gift //@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift @@ -1172,7 +1238,7 @@ gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upg //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown //@resale_star_count Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible -upgradedGift id:int64 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; +upgradedGift id:int64 publisher_chat_id:int53 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1288,13 +1354,13 @@ receivedGifts total_count:int32 gifts:vector are_notifications_ena giftUpgradePreview models:vector symbols:vector backdrops:vector = GiftUpgradePreview; -//@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars +//@class TransactionDirection @description Describes direction of transactions in a transaction list -//@description The transaction is incoming and increases the number of owned Telegram Stars -starTransactionDirectionIncoming = StarTransactionDirection; +//@description The transaction is incoming and increases the amount of owned currency +transactionDirectionIncoming = TransactionDirection; -//@description The transaction is outgoing and decreases the number of owned Telegram Stars -starTransactionDirectionOutgoing = StarTransactionDirection; +//@description The transaction is outgoing and decreases the amount of owned currency +transactionDirectionOutgoing = TransactionDirection; //@class StarTransactionType @description Describes type of transaction with Telegram Stars @@ -1437,6 +1503,14 @@ starTransactionTypePaidMessageSend chat_id:int53 message_count:int32 = StarTrans //@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds starTransactionTypePaidMessageReceive sender_id:MessageSender message_count:int32 commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; +//@description The transaction is a payment for a suggested post; for regular users only +//@chat_id Identifier of the channel chat that posted the post +starTransactionTypeSuggestedPostPaymentSend chat_id:int53 = StarTransactionType; + +//@description The transaction is a receiving of a payment for a suggested post by the channel chat; for channel chats only +//@user_id Identifier of the user that paid for the suggested post +starTransactionTypeSuggestedPostPaymentReceive user_id:int53 = StarTransactionType; + //@description The transaction is a purchase of Telegram Premium subscription; for regular users and bots only //@user_id Identifier of the user that received the Telegram Premium subscription //@month_count Number of months the Telegram Premium subscription will be active @@ -1468,6 +1542,35 @@ starTransaction id:string star_amount:starAmount is_refund:Bool date:int32 type: starTransactions star_amount:starAmount transactions:vector next_offset:string = StarTransactions; +//@class TonTransactionType @description Describes type of transaction with Toncoins + +//@description The transaction is a deposit of Toncoins from Fragment +//@is_gift True, if the transaction is a gift from another user +//@sticker The sticker to be shown in the transaction information; may be null if unknown +tonTransactionTypeFragmentDeposit is_gift:Bool sticker:sticker = TonTransactionType; + +//@description The transaction is a payment for a suggested post @chat_id Identifier of the channel chat that posted the post +tonTransactionTypeSuggestedPostPayment chat_id:int53 = TonTransactionType; + +//@description The transaction is a transaction of an unsupported type +tonTransactionTypeUnsupported = TonTransactionType; + + +//@description Represents a transaction changing the amount of owned Toncoins +//@id Unique identifier of the transaction +//@ton_amount The amount of added owned Toncoins; negative for outgoing transactions +//@is_refund True, if the transaction is a refund of a previous transaction +//@date Point in time (Unix timestamp) when the transaction was completed +//@type Type of the transaction +tonTransaction id:string ton_amount:int53 is_refund:Bool date:int32 type:TonTransactionType = TonTransaction; + +//@description Represents a list of Toncoin transactions +//@ton_amount The total amount of owned Toncoins +//@transactions List of Toncoin transactions +//@next_offset The offset for the next request. If empty, then there are no more results +tonTransactions ton_amount:int53 transactions:vector next_offset:string = TonTransactions; + + //@class GiveawayParticipantStatus @description Contains information about status of a user in a giveaway //@description The user is eligible for the giveaway @@ -1892,7 +1995,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup //@sign_messages True, if messages sent to the channel contains name of the sender. This field is only applicable to channels //@show_message_sender True, if messages sent to the channel have information about the sender user. This field is only applicable to channels -//@join_to_send_messages True, if users need to join the supergroup before they can send messages. Always true for channels and non-discussion supergroups +//@join_to_send_messages True, if users need to join the supergroup before they can send messages. May be false only for discussion supergroups and channel direct messages groups //@join_by_request True, if all users directly joining the supergroup need to be approved by supergroup administrators. Always false for channels and supergroups without username, location, or a linked chat //@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup //@is_channel True, if the supergroup is a channel @@ -2198,13 +2301,14 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //@chat_id The identifier of the chat to which the message belongs; may be 0 if the replied message is in unknown chat //@message_id The identifier of the message; may be 0 if the replied message is in unknown chat //@quote Chosen quote from the replied message; may be null if none +//@checklist_task_id Identifier of the checklist task in the original message that was replied; 0 if none //@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. //-Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, //-messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageSticker, messageStory, //-messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote -messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; +messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote checklist_task_id:int32 origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; //@description Describes a story replied by a given message @story_poster_chat_id The identifier of the poster of the story @story_id The identifier of the story messageReplyToStory story_poster_chat_id:int53 story_id:int32 = MessageReplyTo; @@ -2215,13 +2319,15 @@ messageReplyToStory story_poster_chat_id:int53 story_id:int32 = MessageReplyTo; //@description Describes a message to be replied in the same chat and forum topic //@message_id The identifier of the message to be replied in the same chat and forum topic. A message can be replied in the same chat and forum topic only if messageProperties.can_be_replied //@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats -inputMessageReplyToMessage message_id:int53 quote:inputTextQuote = InputMessageReplyTo; +//@checklist_task_id Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message +inputMessageReplyToMessage message_id:int53 quote:inputTextQuote checklist_task_id:int32 = InputMessageReplyTo; //@description Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats //@chat_id The identifier of the chat to which the message to be replied belongs //@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or forum topic only if messageProperties.can_be_replied_in_another_chat //@quote Quote from the message to be replied; pass null if none -inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; +//@checklist_task_id Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message +inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote checklist_task_id:int32 = InputMessageReplyTo; //@description Describes a story to be replied //@story_poster_chat_id The identifier of the poster of the story. Currently, stories can be replied only in the chat that posted the story; channel stories can't be replied @@ -2247,6 +2353,8 @@ factCheck text:formattedText country_code:string = FactCheck; //@can_be_saved True, if content of the message can be saved locally //@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message //@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts +//@is_paid_star_suggested_post True, if the message is a suggested channel post which was paid in Telegram Stars; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending +//@is_paid_ton_suggested_post True, if the message is a suggested channel post which was paid in Toncoins; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending //@contains_unread_mention True, if the message contains an unread mention for the current user //@date Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages //@edit_date Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages @@ -2255,6 +2363,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@interaction_info Information about interactions with the message; may be null if none //@unread_reactions Information about unread reactions added to the message //@fact_check Information about fact-check added to the message; may be null if none +//@suggested_post_info Information about the suggested post; may be null if the message isn't a suggested post //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs //@topic_id Identifier of the topic within the chat to which the message belongs; may be null if none @@ -2272,7 +2381,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_paid_star_suggested_post:Bool is_paid_ton_suggested_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck suggested_post_info:suggestedPostInfo reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2375,8 +2484,8 @@ sponsoredChats chats:vector = SponsoredChats; //@description Describes an advertisent to be shown while a video from a message is watched //@unique_id Unique identifier of this result //@text Text of the advertisement -//@min_display_duration The minimum amount of time the advertisement must be dispalyed before it can be hidden by the user, in seconds -//@max_display_duration The maximum amount of time the advertisement must be dispalyed before it must be automatically hidden, in seconds +//@min_display_duration The minimum amount of time the advertisement must be displayed before it can be hidden by the user, in seconds +//@max_display_duration The maximum amount of time the advertisement must be displayed before it must be automatically hidden, in seconds //@can_be_reported True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement //@sponsor Information about the sponsor of the advertisement //@title Title of the sponsored message @@ -2502,7 +2611,8 @@ reactionNotificationSettings message_reaction_source:ReactionNotificationSource //@date Point in time (Unix timestamp) when the draft was created //@input_message_text Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote //@effect_id Identifier of the effect to apply to the message when it is sent; 0 if none -draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent effect_id:int64 = DraftMessage; +//@suggested_post_info Information about the suggested post; may be null if none +draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent effect_id:int64 suggested_post_info:inputSuggestedPostInfo = DraftMessage; //@class ChatType @description Describes the type of chat @@ -2663,7 +2773,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@permissions Actions that non-administrator chat members are allowed to take in the chat //@last_message Last message in the chat; may be null if none or unknown //@positions Positions of the chat in chat lists -//@chat_lists Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even it doesn't belong to the chat list and have no position in a chat list even it belongs to the chat list +//@chat_lists Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even if it doesn't belong to the chat list and have no position in a chat list even if it belongs to the chat list //@message_sender_id Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender //@block_list Block list to which the chat is added; may be null if none //@has_protected_content True, if chat content can't be saved locally, forwarded, or copied @@ -2995,7 +3105,7 @@ forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; //@creator_id Identifier of the creator of the topic //@is_general True, if the topic is the General topic list //@is_outgoing True, if the topic was created by the current user -//@is_closed True, if the topic is closed +//@is_closed True, if the topic is closed. If the topic is closed, then the user must have can_manage_topics administrator right in the supergroup or must be the creator of the topic to send messages there //@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only forumTopicInfo chat_id:int53 forum_topic_id:int53 message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; @@ -3447,7 +3557,8 @@ linkPreviewTypeVideo video:video cover:photo start_timestamp:int32 = LinkPreview //@description The link is a link to a video chat //@photo Photo of the chat with the video chat; may be null if none //@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group -linkPreviewTypeVideoChat photo:chatPhoto is_live_stream:Bool = LinkPreviewType; +//@joins_as_speaker True, if the user can use the link to join the video chat without being muted by administrators +linkPreviewTypeVideoChat photo:chatPhoto is_live_stream:Bool joins_as_speaker:Bool = LinkPreviewType; //@description The link is a link to a video note message @video_note The video note linkPreviewTypeVideoNote video_note:videoNote = LinkPreviewType; @@ -3708,7 +3819,7 @@ paidMediaUnsupported = PaidMedia; //@description Describes parameters of a giveaway //@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, -//-or for the specified time. If the chat is a channel, then can_post_messages right is required in the channel, otherwise, the user must be an administrator in the supergroup +//-or for the specified time. If the chat is a channel, then can_post_messages administrator right is required in the channel, otherwise, the user must be an administrator in the supergroup //@additional_chat_ids Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats //@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways //@only_new_members True, if only new members of the chats will be eligible for the giveaway @@ -4327,6 +4438,14 @@ messageGiveawayWinners boosted_chat_id:int53 giveaway_message_id:int53 additiona //@sticker A sticker to be shown in the message; may be null if unknown messageGiftedStars gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 star_count:int53 transaction_id:string sticker:sticker = MessageContent; +//@description Toncoins were gifted to a user +//@gifter_user_id The identifier of a user that gifted Toncoins; 0 if the gift was anonymous or is outgoing +//@receiver_user_id The identifier of a user that received Toncoins; 0 if the gift is incoming +//@ton_amount The received amount of Toncoins, in the smallest units of the cryptocurrency +//@transaction_id Identifier of the transaction for Toncoin credit; for receiver only +//@sticker A sticker to be shown in the message; may be null if unknown +messageGiftedTon gifter_user_id:int53 receiver_user_id:int53 ton_amount:int53 transaction_id:string sticker:sticker = MessageContent; + //@description A Telegram Stars were received by the current user from a giveaway //@star_count Number of Telegram Stars that were received //@transaction_id Identifier of the transaction for Telegram Stars credit @@ -4357,17 +4476,16 @@ messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received //@gift The gift //@sender_id Sender of the gift; may be null for anonymous gifts //@receiver_id Receiver of the gift +//@origin Origin of the upgraded gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift //@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift -//@was_transferred True, if the gift was transferred to another owner; only for the receiver of the gift -//@last_resale_star_count Number of Telegram Stars that were paid by the sender for the gift; 0 if the gift was upgraded or transferred +//@was_transferred True, if the gift has already been transferred to another owner; only for the receiver of the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift //@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift //@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift //@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool last_resale_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; +messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender origin:UpgradedGiftOrigin received_gift_id:string is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded //@gift The gift @@ -4399,6 +4517,33 @@ messageChecklistTasksDone checklist_message_id:int53 marked_as_done_task_ids:vec //@tasks List of tasks added to the checklist messageChecklistTasksAdded checklist_message_id:int53 tasks:vector = MessageContent; +//@description Approval of suggested post has failed, because the user which proposed the post had no enough funds +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@price Price of the suggested post +messageSuggestedPostApprovalFailed suggested_post_message_id:int53 price:SuggestedPostPrice = MessageContent; + +//@description A suggested post was approved +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@price Price of the suggested post; may be null if the post is non-paid +//@send_date Point in time (Unix timestamp) when the post is expected to be published +messageSuggestedPostApproved suggested_post_message_id:int53 price:SuggestedPostPrice send_date:int32 = MessageContent; + +//@description A suggested post was declined +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@comment Comment added by administrator of the channel when the post was declined +messageSuggestedPostDeclined suggested_post_message_id:int53 comment:string = MessageContent; + +//@description A suggested post was published for getOption("suggested_post_lifetime_min") seconds and payment for the post was received +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@star_amount The amount of received Telegram Stars +//@ton_amount The amount of received Toncoins; in the smallest units of the cryptocurrency +messageSuggestedPostPaid suggested_post_message_id:int53 star_amount:starAmount ton_amount:int53 = MessageContent; + +//@description A suggested post was refunded +//@suggested_post_message_id Identifier of the message with the suggested post; can be 0 if the message was deleted +//@reason Reason of the refund +messageSuggestedPostRefunded suggested_post_message_id:int53 reason:SuggestedPostRefundReason = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -4553,6 +4698,7 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@description Options to be used when a message is sent //@direct_messages_chat_topic_id Unique identifier of the topic in a channel direct messages chat administered by the current user; pass 0 if the chat isn't a channel direct messages chat administered by the current user +//@suggested_post_info Information about the suggested post; pass null if none. For messages to channel direct messages chat only. Applicable only to sendMessage and addOffer //@disable_notification Pass true to disable notification for the message //@from_background Pass true if the message is sent from the background //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only @@ -4564,7 +4710,7 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions direct_messages_chat_topic_id:int53 disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; +messageSendOptions direct_messages_chat_topic_id:int53 suggested_post_info:inputSuggestedPostInfo disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool paid_message_star_count:int53 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. @@ -4737,9 +4883,12 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@description Contains properties of a message and describes actions that can be done with the message right now +//@can_add_offer True, if an offer can be added to the message using addOffer //@can_add_tasks True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription +//@can_be_approved True, if the message is a suggested post that can be approved by the user using approveSuggestedPost //@can_be_copied True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options //@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options +//@can_be_declined True, if the message is a suggested post that can be declined by the user using declineSuggestedPost //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false //@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. @@ -4753,6 +4902,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage //@can_edit_media True, if the message can be edited using the method editMessageMedia //@can_edit_scheduling_state True, if scheduling state of the message can be edited +//@can_edit_suggested_post_info True, if another price or post send time can be suggested using addOffer //@can_get_author True, if author of the message sent on behalf of a chat can be received through getMessageAuthor //@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode //@can_get_link True, if a link can be generated for the message using getMessageLink @@ -4769,7 +4919,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam //@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck //@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties can_add_tasks:Bool can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_video_advertisements:Bool can_get_viewers:Bool can_mark_tasks_as_done:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; +messageProperties can_add_offer:Bool can_add_tasks:Bool can_be_approved:Bool can_be_copied:Bool can_be_copied_to_secret_chat:Bool can_be_declined:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_edit_suggested_post_info:Bool can_get_author:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_video_advertisements:Bool can_get_viewers:Bool can_mark_tasks_as_done:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -6513,7 +6663,7 @@ premiumFeatureSavedMessagesTags = PremiumFeature; //-and to restrict incoming messages from non-contacts using setNewChatPrivacySettings premiumFeatureMessagePrivacy = PremiumFeature; -//@description The ability to view last seen and read times of other users even they can't view last seen or read time for the current user +//@description The ability to view last seen and read times of other users even if they can't view last seen or read time for the current user premiumFeatureLastSeenTimes = PremiumFeature; //@description The ability to use Business features @@ -7663,6 +7813,9 @@ internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLin //@description The link is a link to the screen with information about Telegram Star balance and transactions of the current user internalLinkTypeMyStars = InternalLinkType; +//@description The link is a link to the screen with information about Toncoin balance and transactions of the current user +internalLinkTypeMyToncoins = InternalLinkType; + //@description The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it //@bot_user_id User identifier of the service's bot; the corresponding user may be unknown yet //@scope Telegram Passport element types requested by the service @@ -8339,21 +8492,26 @@ revenueWithdrawalStateFailed = RevenueWithdrawalState; //@class ChatRevenueTransactionType @description Describes type of transaction for revenue earned from sponsored messages in a chat +//@description Describes an unsupported transaction +chatRevenueTransactionTypeUnsupported = ChatRevenueTransactionType; + //@description Describes earnings from sponsored messages in a chat in some time frame //@start_date Point in time (Unix timestamp) when the earnings started //@end_date Point in time (Unix timestamp) when the earnings ended -chatRevenueTransactionTypeEarnings start_date:int32 end_date:int32 = ChatRevenueTransactionType; +chatRevenueTransactionTypeSponsoredMessageEarnings start_date:int32 end_date:int32 = ChatRevenueTransactionType; -//@description Describes a withdrawal of earnings +//@description Describes earnings from a published suggested post @user_id Identifier of the user that paid for the suggested post +chatRevenueTransactionTypeSuggestedPostEarnings user_id:int53 = ChatRevenueTransactionType; + +//@description Describes a withdrawal of earnings through Fragment //@withdrawal_date Point in time (Unix timestamp) when the earnings withdrawal started -//@provider Name of the payment provider //@state State of the withdrawal -chatRevenueTransactionTypeWithdrawal withdrawal_date:int32 provider:string state:RevenueWithdrawalState = ChatRevenueTransactionType; +chatRevenueTransactionTypeFragmentWithdrawal withdrawal_date:int32 state:RevenueWithdrawalState = ChatRevenueTransactionType; -//@description Describes a refund for failed withdrawal of earnings +//@description Describes a refund for failed withdrawal of earnings through Fragment //@refund_date Point in time (Unix timestamp) when the transaction was refunded -//@provider Name of the payment provider -chatRevenueTransactionTypeRefund refund_date:int32 provider:string = ChatRevenueTransactionType; +chatRevenueTransactionTypeFragmentRefund refund_date:int32 = ChatRevenueTransactionType; + //@description Contains a chat revenue transactions //@cryptocurrency Cryptocurrency in which revenue is calculated @@ -8361,8 +8519,11 @@ chatRevenueTransactionTypeRefund refund_date:int32 provider:string = ChatRevenue //@type Type of the transaction chatRevenueTransaction cryptocurrency:string cryptocurrency_amount:int64 type:ChatRevenueTransactionType = ChatRevenueTransaction; -//@description Contains a list of chat revenue transactions @total_count Total number of transactions @transactions List of transactions -chatRevenueTransactions total_count:int32 transactions:vector = ChatRevenueTransactions; +//@description Contains a list of chat revenue transactions +//@ton_amount The amount of owned Toncoins; in the smallest units of the cryptocurrency +//@transactions List of transactions +//@next_offset The offset for the next request. If empty, then there are no more results +chatRevenueTransactions ton_amount:int53 transactions:vector next_offset:string = ChatRevenueTransactions; //@description Contains information about Telegram Stars earned by a bot or a chat @@ -8491,6 +8652,12 @@ updateMessageUnreadReactions chat_id:int53 message_id:int53 unread_reactions:vec //@fact_check The new fact-check updateMessageFactCheck chat_id:int53 message_id:int53 fact_check:factCheck = Update; +//@description Information about suggested post of a message was changed +//@chat_id Chat identifier +//@message_id Message identifier +//@suggested_post_info The new information about the suggested post +updateMessageSuggestedPostInfo chat_id:int53 message_id:int53 suggested_post_info:suggestedPostInfo = Update; + //@description A message with a live location was viewed. When the update is received, the application is expected to update the live location //@chat_id Identifier of the chat with the live location message //@message_id Identifier of the message with live location @@ -8809,7 +8976,7 @@ updateGroupCallParticipant group_call_id:int32 participant:groupCallParticipant //@description The list of group call participants that can send and receive encrypted call data has changed; for group calls not bound to a chat only //@group_call_id Identifier of the group call //@participant_user_ids New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. -//-The participants must be shown in the list of group call participants even there is no information about them +//-The participants must be shown in the list of group call participants even if there is no information about them updateGroupCallParticipants group_call_id:int32 participant_user_ids:vector = Update; //@description The verification state of an encrypted group call has changed; for group calls not bound to a chat only @@ -8958,6 +9125,9 @@ updateActiveLiveLocationMessages messages:vector = Update; //@description The number of Telegram Stars owned by the current user has changed @star_amount The new amount of owned Telegram Stars updateOwnedStarCount star_amount:starAmount = Update; +//@description The number of Toncoins owned by the current user has changed @ton_amount The new amount of owned Toncoins; in the smallest units of the cryptocurrency +updateOwnedTonCount ton_amount:int53 = Update; + //@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions //@chat_id Identifier of the chat //@revenue_amount New amount of earned revenue @@ -9403,10 +9573,12 @@ getMessage chat_id:int53 message_id:int53 = Message; //@message_id Identifier of the message to get getMessageLocally chat_id:int53 message_id:int53 = Message; -//@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, -//-the message with a previously set same background, the giveaway message, the checklist message, and the topic creation message for messages of the types -//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted, messageChecklistTasksDone and messageChecklistTasksAdded, and topic messages without non-bundled replied message respectively. -//-Returns a 404 error if the message doesn't exist +//@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message for messagePinMessage, +//-the game message for messageGameScore, the invoice message for messagePaymentSuccessful, the message with a previously set same background for messageChatSetBackground, +//-the giveaway message for messageGiveawayCompleted, the checklist message for messageChecklistTasksDone, messageChecklistTasksAdded, the message with suggested post information +//-for messageSuggestedPostApprovalFailed, messageSuggestedPostApproved, messageSuggestedPostDeclined, messageSuggestedPostPaid, messageSuggestedPostRefunded, +//-the message with the regular gift that was upgraded for messageUpgradedGift with origin of the type upgradedGiftOriginUpgrade, +//-and the topic creation message for topic messages without non-bundled replied message. Returns a 404 error if the message doesn't exist //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message getRepliedMessage chat_id:int53 message_id:int53 = Message; @@ -9563,8 +9735,8 @@ getDirectMessagesChatTopic chat_id:int53 topic_id:int53 = DirectMessagesChatTopi //@chat_id Chat identifier of the channel direct messages chat //@topic_id Identifier of the topic which messages will be fetched //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getDirectMessagesChatTopicHistory chat_id:int53 topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; @@ -9628,8 +9800,8 @@ loadSavedMessagesTopics limit:int32 = Ok; //@description Returns messages in a Saved Messages topic. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) //@saved_messages_topic_id Identifier of Saved Messages topic which messages will be fetched //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getSavedMessagesTopicHistory saved_messages_topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; @@ -9667,8 +9839,8 @@ getGroupsInCommon user_id:int53 offset_chat_id:int53 limit:int32 = Chats; //-For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true //@chat_id Chat identifier //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@only_local Pass true to get only messages that are available without sending network requests getChatHistory chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only_local:Bool = Messages; @@ -9678,8 +9850,8 @@ getChatHistory chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only //@chat_id Chat identifier //@message_id Message identifier, which thread history needs to be returned //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getMessageThreadHistory chat_id:int53 message_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; @@ -9702,8 +9874,8 @@ deleteChat chat_id:int53 = Ok; //@query Query to search for //@sender_id Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages searchChatMessages chat_id:int53 topic_id:MessageTopic query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter = FoundChatMessages; @@ -9735,8 +9907,8 @@ searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter //@tag Tag to search for; pass null to return all suitable messages //@query Query to search for //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. +//@offset Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit searchSavedMessages saved_messages_topic_id:int53 tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; @@ -10247,7 +10419,7 @@ setBusinessAccountBio business_connection_id:string bio:string = Ok; //@description Changes a profile photo of a business account; for bots only //@business_connection_id Unique identifier of business connection //@photo Profile photo to set; pass null to remove the photo -//@is_public Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings +//@is_public Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings setBusinessAccountProfilePhoto business_connection_id:string photo:InputChatPhoto is_public:Bool = Ok; //@description Changes the editable username of a business account; for bots only @@ -10340,7 +10512,7 @@ getForumTopicDefaultIcons = Stickers; //@icon Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, other users can use only a custom emoji returned by getForumTopicDefaultIcons createForumTopic chat_id:int53 name:string icon:forumTopicIcon = ForumTopicInfo; -//@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +//@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic //@chat_id Identifier of the chat //@message_thread_id Message thread identifier of the forum topic //@name New name of the topic; 0-128 characters. If empty, the previous topic name is kept @@ -10369,24 +10541,24 @@ getForumTopics chat_id:int53 query:string offset_date:int32 offset_message_id:in //@notification_settings New notification settings for the forum topic. If the topic is muted for more than 366 days, it is considered to be muted forever setForumTopicNotificationSettings chat_id:int53 message_thread_id:int53 notification_settings:chatNotificationSettings = Ok; -//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic +//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic //@chat_id Identifier of the chat //@message_thread_id Message thread identifier of the forum topic //@is_closed Pass true to close the topic; pass false to reopen it toggleForumTopicIsClosed chat_id:int53 message_thread_id:int53 is_closed:Bool = Ok; -//@description Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics right in the supergroup +//@description Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup //@chat_id Identifier of the chat //@is_hidden Pass true to hide and close the General topic; pass false to unhide it toggleGeneralForumTopicIsHidden chat_id:int53 is_hidden:Bool = Ok; -//@description Changes the pinned state of a forum topic; requires can_manage_topics right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics +//@description Changes the pinned state of a forum topic; requires can_manage_topics administrator right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics //@chat_id Chat identifier //@message_thread_id Message thread identifier of the forum topic //@is_pinned Pass true to pin the topic; pass false to unpin it toggleForumTopicIsPinned chat_id:int53 message_thread_id:int53 is_pinned:Bool = Ok; -//@description Changes the order of pinned forum topics; requires can_manage_topics right in the supergroup @chat_id Chat identifier @message_thread_ids The new list of pinned forum topics +//@description Changes the order of pinned forum topics; requires can_manage_topics administrator right in the supergroup @chat_id Chat identifier @message_thread_ids The new list of pinned forum topics setPinnedForumTopics chat_id:int53 message_thread_ids:vector = Ok; //@description Deletes all messages in a forum topic; requires can_delete_messages administrator right in the supergroup unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages @@ -10773,7 +10945,7 @@ closeChat chat_id:int53 = Ok; //@chat_id Chat identifier //@message_ids The identifiers of the messages being viewed //@source Source of the message view; pass null to guess the source based on chat open state -//@force_read Pass true to mark as read the specified messages even the chat is closed +//@force_read Pass true to mark as read the specified messages even if the chat is closed viewMessages chat_id:int53 message_ids:vector source:MessageSource force_read:Bool = Ok; //@description Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). @@ -11041,7 +11213,7 @@ setChatDirectMessagesGroup chat_id:int53 is_enabled:Bool paid_message_star_count //@description Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use @chat_id Chat identifier @location New location for the chat; must be valid and not null setChatLocation chat_id:int53 location:chatLocation = Ok; -//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right @chat_id Chat identifier @slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 +//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members administrator right @chat_id Chat identifier @slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 setChatSlowModeDelay chat_id:int53 slow_mode_delay:int32 = Ok; //@description Pins a message in a chat. A message can be pinned only if messageProperties.can_be_pinned @@ -11180,11 +11352,11 @@ getStory story_poster_chat_id:int53 story_id:int32 only_local:Bool = Story; //@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canPostStory before actually trying to post a story there getChatsToPostStories = Chats; -//@description Checks whether the current user can post a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +//@description Checks whether the current user can post a story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats //@chat_id Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user canPostStory chat_id:int53 = CanPostStoryResult; -//@description Posts a new story on behalf of a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story +//@description Posts a new story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats. Returns a temporary story //@chat_id Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user //@content Content of the story //@areas Clickable rectangle areas to be shown on the story media; pass null if none @@ -11248,7 +11420,7 @@ getChatActiveStories chat_id:int53 = ChatActiveStories; //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatPostedToChatPageStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; -//@description Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. +//@description Returns the list of all stories posted by the given chat; requires can_edit_stories administrator right in the chat. //-The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib //@chat_id Chat identifier //@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story @@ -11256,7 +11428,7 @@ getChatPostedToChatPageStories chat_id:int53 from_story_id:int32 limit:int32 = S //-For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit getChatArchivedStories chat_id:int53 from_story_id:int32 limit:int32 = Stories; -//@description Changes the list of pinned stories on a chat page; requires can_edit_stories right in the chat +//@description Changes the list of pinned stories on a chat page; requires can_edit_stories administrator right in the chat //@chat_id Identifier of the chat that posted the stories //@story_ids New list of pinned stories. All stories must be posted to the chat page first. There can be up to getOption("pinned_story_count_max") pinned stories on a chat page setChatPinnedStories chat_id:int53 story_ids:vector = Ok; @@ -11391,7 +11563,7 @@ getThemedChatEmojiStatuses = EmojiStatusCustomEmojis; //@description Returns default emoji statuses for chats getDefaultChatEmojiStatuses = EmojiStatusCustomEmojis; -//@description Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true +//@description Returns the list of emoji statuses, which can't be used as chat emoji status, even if they are from a sticker set with is_allowed_as_chat_emoji_status == true getDisallowedChatEmojiStatuses = EmojiStatusCustomEmojis; @@ -11602,6 +11774,28 @@ processChatJoinRequest chat_id:int53 user_id:int53 approve:Bool = Ok; processChatJoinRequests chat_id:int53 invite_link:string approve:Bool = Ok; +//@description Approves a suggested post in a channel direct messages chat +//@chat_id Chat identifier of the channel direct messages chat +//@message_id Identifier of the message with the suggested post. Use messageProperties.can_be_approved to check whether the suggested post can be approved +//@send_date Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date has already been chosen. If specified, +//-then the date must be in the future, but at most getOption("suggested_post_send_delay_max") seconds in the future +approveSuggestedPost chat_id:int53 message_id:int53 send_date:int32 = Ok; + +//@description Declines a suggested post in a channel direct messages chat +//@chat_id Chat identifier of the channel direct messages chat +//@message_id Identifier of the message with the suggested post. Use messageProperties.can_be_declined to check whether the suggested post can be declined +//@comment Comment for the creator of the suggested post; 0-128 characters +declineSuggestedPost chat_id:int53 message_id:int53 comment:string = Ok; + +//@description Sent a suggested post based on a previously sent message in a channel direct messages chat. Can be also used to suggest price or time change for an existing suggested post. +//-Returns the sent message +//@chat_id Identifier of the channel direct messages chat +//@message_id Identifier of the message in the chat which will be sent as suggested post. Use messageProperties.can_add_offer to check whether an offer can be added +//-or messageProperties.can_edit_suggested_post_info to check whether price or time of sending of the post can be changed +//@options Options to be used to send the message. New information about the suggested post must always be specified +addOffer chat_id:int53 message_id:int53 options:messageSendOptions = Message; + + //@description Creates a new call //@user_id Identifier of the user to be called //@protocol The call protocols supported by the application @@ -12078,7 +12272,7 @@ getWebPageInstantView url:string only_local:Bool = WebPageInstantView; //@description Changes a profile photo for the current user //@photo Profile photo to set -//@is_public Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings +//@is_public Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings setProfilePhoto photo:InputChatPhoto is_public:Bool = Ok; //@description Deletes a profile photo @profile_photo_id Identifier of the profile photo to delete @@ -12541,7 +12735,7 @@ getAvailableGifts = AvailableGifts; //@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free sendGift gift_id:int64 owner_id:MessageSender text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; -//@description Sells a gift for Telegram Stars +//@description Sells a gift for Telegram Stars; requires owner privileges for gifts owned by a chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@received_gift_id Identifier of the gift sellGift business_connection_id:string received_gift_id:string = Ok; @@ -12615,7 +12809,7 @@ getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; //-The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; -//@description Returns upgraded gifts that can be bought from other owners +//@description Returns upgraded gifts that can be bought from other owners using sendResoldGift //@gift_id Identifier of the regular gift that was upgraded to a unique gift //@order Order in which the results will be sorted //@attributes Attributes used to filter received gifts. If multiple attributes of the same type are specified, then all of them are allowed. @@ -12823,9 +13017,15 @@ getChatRevenueWithdrawalUrl chat_id:int53 password:string = HttpUrl; //@description Returns the list of revenue transactions for a chat. Currently, this method can be used only //-for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true //@chat_id Chat identifier -//@offset Number of transactions to skip -//@limit The maximum number of transactions to be returned; up to 200 -getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueTransactions; +//@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of transactions to be returned; up to 100 +getChatRevenueTransactions chat_id:int53 offset:string limit:int32 = ChatRevenueTransactions; + +//@description Returns the list of Toncoin transactions of the current user +//@direction Direction of the transactions to receive; pass null to get all transactions +//@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of transactions to return +getTonTransactions direction:TransactionDirection offset:string limit:int32 = TonTransactions; //@description Returns detailed Telegram Star revenue statistics @@ -12835,7 +13035,7 @@ getStarRevenueStatistics owner_id:MessageSender is_dark:Bool = StarRevenueStatis //@description Returns a URL for Telegram Star withdrawal //@owner_id Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat -//@star_count The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") +//@star_count The number of Telegram Stars to withdraw; must be between getOption("star_withdrawal_count_min") and getOption("star_withdrawal_count_max") //@password The 2-step verification password of the current user getStarWithdrawalUrl owner_id:MessageSender star_count:int53 password:string = HttpUrl; @@ -13138,7 +13338,7 @@ getStarGiveawayPaymentOptions = StarGiveawayPaymentOptions; //@direction Direction of the transactions to receive; pass null to get all transactions //@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of transactions to return -getStarTransactions owner_id:MessageSender subscription_id:string direction:StarTransactionDirection offset:string limit:int32 = StarTransactions; +getStarTransactions owner_id:MessageSender subscription_id:string direction:TransactionDirection offset:string limit:int32 = StarTransactions; //@description Returns the list of Telegram Star subscriptions for the current user //@only_expiring Pass true to receive only expiring subscriptions for which there are no enough Telegram Stars to extend From 9b94728dda1bfb84c99c68a27ddab439f42318d1 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Fri, 19 Sep 2025 19:09:58 +0800 Subject: [PATCH 06/11] Update to TDLib 1.8.54 --- data/td_api.tl | 396 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 350 insertions(+), 46 deletions(-) diff --git a/data/td_api.tl b/data/td_api.tl index deb1b8f..60c5f4f 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -894,14 +894,27 @@ chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_docum chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool can_manage_direct_messages:Bool is_anonymous:Bool = ChatAdministratorRights; +//@class GiftResalePrice @description Describes price of a resold gift + +//@description Describes price of a resold gift in Telegram Stars +//@star_count The amount of Telegram Stars expected to be paid for the gift. Must be in range +//-getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max") for gifts put for resale +giftResalePriceStar star_count:int53 = GiftResalePrice; + +//@description Describes price of a resold gift in Toncoins +//@toncoin_cent_count The amount of 1/100 of Toncoin expected to be paid for the gift. Must be in range +//-getOption("gift_resale_toncoin_cent_count_min")-getOption("gift_resale_toncoin_cent_count_max") +giftResalePriceTon toncoin_cent_count:int53 = GiftResalePrice; + + //@class SuggestedPostPrice @description Describes price of a suggested post //@description Describes price of a suggested post in Telegram Stars -//@star_count The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") +//@star_count The amount of Telegram Stars expected to be paid for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") suggestedPostPriceStar star_count:int53 = SuggestedPostPrice; //@description Describes price of a suggested post in Toncoins -//@toncoin_cent_count The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") +//@toncoin_cent_count The amount of 1/100 of Toncoin expected to be paid for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") suggestedPostPriceTon toncoin_cent_count:int53 = SuggestedPostPrice; @@ -1161,6 +1174,28 @@ acceptedGiftTypes unlimited_gifts:Bool limited_gifts:Bool upgraded_gifts:Bool pr giftSettings show_gift_button:Bool accepted_gift_types:acceptedGiftTypes = GiftSettings; +//@description Describes the maximum number of times that a specific gift can be purchased +//@total_count The maximum number of times the gifts can be purchased +//@remaining_count Number of remaining times the gift can be purchased +giftPurchaseLimits total_count:int32 remaining_count:int32 = GiftPurchaseLimits; + +//@description Describes parameters of a unique gift available for resale +//@star_count Resale price of the gift in Telegram Stars +//@toncoin_cent_count Resale price of the gift in 1/100 of Toncoin +//@toncoin_only True, if the gift can be bought only using Toncoins +giftResaleParameters star_count:int53 toncoin_cent_count:int53 toncoin_only:Bool = GiftResaleParameters; + +//@description Describes collection of gifts +//@id Unique identifier of the collection +//@name Name of the collection +//@icon Icon of the collection; may be null if none +//@gift_count Total number of gifts in the collection +giftCollection id:int32 name:string icon:sticker gift_count:int32 = GiftCollection; + +//@description Contains a list of gift collections @collections List of gift collections +giftCollections collections:vector = GiftCollections; + + //@class UpgradedGiftOrigin @description Describes origin from which the upgraded gift was obtained //@description The gift was obtained by upgrading of a previously received gift @@ -1170,8 +1205,11 @@ upgradedGiftOriginUpgrade gift_message_id:int53 = UpgradedGiftOrigin; //@description The gift was transferred from another owner upgradedGiftOriginTransfer = UpgradedGiftOrigin; -//@description The gift was bought from another user @star_count Number of Telegram Stars that were paid by the sender for the gift -upgradedGiftOriginResale star_count:int53 = UpgradedGiftOrigin; +//@description The gift was bought from another user @price Price paid by the sender for the gift +upgradedGiftOriginResale price:GiftResalePrice = UpgradedGiftOrigin; + +//@description The sender or receiver of the message has paid for upgraid of the gift, which has been completed +upgradedGiftOriginPrepaidUpgrade = UpgradedGiftOrigin; //@description Describes a model of an upgraded gift @@ -1215,20 +1253,23 @@ upgradedGiftOriginalDetails sender_id:MessageSender receiver_id:MessageSender te //@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed //@upgrade_star_count Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible //@is_for_birthday True, if the gift is a birthday gift -//@remaining_count Number of remaining times the gift can be purchased; 0 if not limited or the gift was sold out -//@total_count Number of total times the gift can be purchased; 0 if not limited +//@is_premium True, if the gift can be bought only by Telegram Premium subscribers +//@user_limits Number of times the gift can be purchased by the current user; may be null if not limited +//@overall_limits Number of times the gift can be purchased all users; may be null if not limited //@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only //@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; +gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool is_premium:Bool user_limits:giftPurchaseLimits overall_limits:giftPurchaseLimits first_send_date:int32 last_send_date:int32 = Gift; //@description Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT //@id Unique identifier of the gift +//@regular_gift_id Unique identifier of the regular gift from which the gift was upgraded; may be 0 for short period of time for old gifts from database //@publisher_chat_id Identifier of the chat that published the gift; 0 if none //@title The title of the upgraded gift //@name Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift //@number Unique number of the upgraded gift among gifts upgraded from the same gift //@total_upgraded_count Total number of gifts that were upgraded from the same gift //@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift +//@is_premium True, if the original gift could have been bought only by Telegram Premium subscribers //@owner_id Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown //@owner_address Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address //@owner_name Name of the owner for the case when owner identifier and address aren't known @@ -1237,8 +1278,27 @@ gift id:int64 publisher_chat_id:int53 sticker:sticker star_count:int53 default_s //@symbol Symbol of the upgraded gift //@backdrop Backdrop of the upgraded gift //@original_details Information about the originally sent gift; may be null if unknown -//@resale_star_count Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible -upgradedGift id:int64 publisher_chat_id:int53 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_star_count:int53 = UpgradedGift; +//@resale_parameters Resale parameters of the gift; may be null if resale isn't possible +//@value_currency ISO 4217 currency code of the currency in which value of the gift is represented; may be empty if unavailable +//@value_amount Estimated value of the gift; in the smallest units of the currency; 0 if unavailable +upgradedGift id:int64 regular_gift_id:int64 publisher_chat_id:int53 title:string name:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 is_premium:Bool owner_id:MessageSender owner_address:string owner_name:string gift_address:string model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails resale_parameters:giftResaleParameters value_currency:string value_amount:int53 = UpgradedGift; + +//@description Contains information about value of an upgraded gift +//@currency ISO 4217 currency code of the currency in which the prices are represented +//@value Estimated value of the gift; in the smallest units of the currency +//@is_value_average True, if the value is calculated as average value of similar sold gifts. Otherwise, it is based on the sale price of the gift +//@initial_sale_date Point in time (Unix timestamp) when the corresponding regular gift was originally purchased +//@initial_sale_star_count Amount of Telegram Stars that were paid for the gift +//@initial_sale_price Initial price of the gift; in the smallest units of the currency +//@last_sale_date Point in time (Unix timestamp) when the upgraded gift was purchased last time; 0 if never +//@last_sale_price Last purchase price of the gift; in the smallest units of the currency; 0 if the gift has never been resold +//@is_last_sale_on_fragment True, if the last sale was completed on Fragment +//@minimum_price The current minimum price of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there are no such gifts +//@average_sale_price The average sale price in the last month of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there were no such sales +//@telegram_listed_gift_count Number of gifts upgraded from the same gift being resold on Telegram +//@fragment_listed_gift_count Number of gifts upgraded from the same gift being resold on Fragment +//@fragment_url The HTTPS link to the Fragment for the gift; may be empty if there are no such gifts being sold on Fragment +upgradedGiftValueInfo currency:string value:int53 is_value_average:Bool initial_sale_date:int32 initial_sale_star_count:int53 initial_sale_price:int53 last_sale_date:int32 last_sale_price:int53 is_last_sale_on_fragment:Bool minimum_price:int53 average_sale_price:int53 telegram_listed_gift_count:int32 fragment_listed_gift_count:int32 fragment_url:string = UpgradedGiftValueInfo; //@description Contains result of gift upgrading //@gift The upgraded gift @@ -1246,15 +1306,15 @@ upgradedGift id:int64 publisher_chat_id:int53 title:string name:string number:in //@is_saved True, if the gift is displayed on the user's or the channel's profile page //@can_be_transferred True, if the gift can be transferred to another owner //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift -//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible -//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past upgradeGiftResult gift:upgradedGift received_gift_id:string is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = UpgradeGiftResult; //@description Describes a gift that is available for purchase //@gift The gift //@resale_count Number of gifts that are available for resale -//@min_resale_star_count The minimum price for the gifts available for resale; 0 if there are no such gifts +//@min_resale_star_count The minimum price for the gifts available for resale in Telegram Star equivalent; 0 if there are no such gifts //@title The title of the upgraded gift; empty if the gift isn't available for resale availableGift gift:gift resale_count:int32 min_resale_star_count:int53 title:string = AvailableGift; @@ -1311,6 +1371,15 @@ giftForResale gift:upgradedGift received_gift_id:string = GiftForResale; giftsForResale total_count:int32 gifts:vector models:vector symbols:vector backdrops:vector next_offset:string = GiftsForResale; +//@class GiftResaleResult @description Describes result of sending a resold gift + +//@description Operation was successfully completed +giftResaleResultOk = GiftResaleResult; + +//@description Operation has failed, because price has increased. If the price has decreased, then the buying will succeed anyway @price New price for the gift +giftResaleResultPriceIncreased price:GiftResalePrice = GiftResaleResult; + + //@class SentGift @description Represents content of a gift received by a user or a channel chat //@description Regular gift @gift The gift @@ -1332,13 +1401,15 @@ sentGiftUpgraded gift:upgradedGift = SentGift; //@was_refunded True, if the gift was refunded and isn't available anymore //@date Point in time (Unix timestamp) when the gift was sent //@gift The gift +//@collection_ids Identifiers of collections to which the gift is added; only for the receiver of the gift //@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift -//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = ReceivedGift; +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift +//@prepaid_upgrade_hash If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade +receivedGift received_gift_id:string sender_id:MessageSender text:formattedText is_private:Bool is_saved:Bool is_pinned:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift collection_ids:vector sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 prepaid_upgrade_hash:string = ReceivedGift; //@description Represents a list of gifts received by a user or a chat //@total_count The total number of received gifts @@ -1469,14 +1540,18 @@ starTransactionTypeGiftSale user_id:int53 gift:gift = StarTransactionType; //@description The transaction is an upgrade of a gift; for regular users only @user_id Identifier of the user that initially sent the gift @gift The upgraded gift starTransactionTypeGiftUpgrade user_id:int53 gift:upgradedGift = StarTransactionType; +//@description The transaction is a purchase of an upgrade of a gift owned by another user or channel; for regular users only @owner_id Owner of the upgraded gift @gift The gift +starTransactionTypeGiftUpgradePurchase owner_id:MessageSender gift:gift = StarTransactionType; + //@description The transaction is a purchase of an upgraded gift for some user or channel; for regular users only @user_id Identifier of the user that sold the gift @gift The gift starTransactionTypeUpgradedGiftPurchase user_id:int53 gift:upgradedGift = StarTransactionType; //@description The transaction is a sale of an upgraded gift; for regular users only //@user_id Identifier of the user that bought the gift //@gift The gift -//@affiliate Information about commission received by Telegram from the transaction -starTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift affiliate:affiliateInfo = StarTransactionType; +//@commission_per_mille The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars received by the seller of the gift +//@commission_star_amount The amount of Telegram Stars that were received by Telegram; can be negative for refunds +starTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift commission_per_mille:int32 commission_star_amount:starAmount = StarTransactionType; //@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only //@chat_id Identifier of the channel chat @@ -1523,6 +1598,9 @@ starTransactionTypeBusinessBotTransferSend user_id:int53 = StarTransactionType; //@description The transaction is a transfer of Telegram Stars from a business account; for bots only @user_id Identifier of the user that sent Telegram Stars starTransactionTypeBusinessBotTransferReceive user_id:int53 = StarTransactionType; +//@description The transaction is a payment for search of posts in public Telegram channels; for regular users only +starTransactionTypePublicPostSearch = StarTransactionType; + //@description The transaction is a transaction of an unsupported type starTransactionTypeUnsupported = StarTransactionType; @@ -1552,6 +1630,16 @@ tonTransactionTypeFragmentDeposit is_gift:Bool sticker:sticker = TonTransactionT //@description The transaction is a payment for a suggested post @chat_id Identifier of the channel chat that posted the post tonTransactionTypeSuggestedPostPayment chat_id:int53 = TonTransactionType; +//@description The transaction is a purchase of an upgraded gift for some user or channel; for regular users only @user_id Identifier of the user that sold the gift @gift The gift +tonTransactionTypeUpgradedGiftPurchase user_id:int53 gift:upgradedGift = TonTransactionType; + +//@description The transaction is a sale of an upgraded gift; for regular users only +//@user_id Identifier of the user that bought the gift +//@gift The gift +//@commission_per_mille The number of Toncoins received by the Telegram for each 1000 Toncoins received by the seller of the gift +//@commission_toncoin_amount The amount of Toncoins that were received by the Telegram; in the smallest units of the currency +tonTransactionTypeUpgradedGiftSale user_id:int53 gift:upgradedGift commission_per_mille:int32 commission_toncoin_amount:int53 = TonTransactionType; + //@description The transaction is a transaction of an unsupported type tonTransactionTypeUnsupported = TonTransactionType; @@ -1642,6 +1730,24 @@ profileAccentColors palette_colors:vector background_colors:vector profileAccentColor id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_supergroup_chat_boost_level:int32 min_channel_chat_boost_level:int32 = ProfileAccentColor; +//@description Contains description of user rating +//@level The level of the user; may be negative +//@is_maximum_level_reached True, if the maximum level is reached +//@rating Numerical value of the rating +//@current_level_rating The rating required for the current level +//@next_level_rating The rating required for the next level; 0 if the maximum level is reached +userRating level:int32 is_maximum_level_reached:Bool rating:int53 current_level_rating:int53 next_level_rating:int53 = UserRating; + +//@description Contains information about restrictions that must be applied to a chat or a message +//@restriction_reason A human-readable description of the reason why access to the content must be restricted. If empty, then the content can be accessed, +//-but may be covered by hidden with 18+ spoiler anyway +//@has_sensitive_content True, if media content of the messages must be hidden with 18+ spoiler. +//-Use value of the option "can_ignore_sensitive_content_restrictions" to check whether the current user can ignore the restriction. +//-If age verification parameters were received in updateAgeVerificationParameters, then the user must complete age verification to ignore the restriction. +//-Set the option "ignore_sensitive_content_restrictions" to true if the user passes age verification +restrictionInfo restriction_reason:string has_sensitive_content:Bool = RestrictionInfo; + + //@class EmojiStatusType @description Describes type of emoji status //@description A custom emoji set as emoji status @custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format @@ -1696,7 +1802,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@verification_status Information about verification status of the user; may be null if none //@is_premium True, if the user is a Telegram Premium user //@is_support True, if the user is Telegram support account -//@restriction_reason If non-empty, it contains a human-readable description of the reason why access to this user must be restricted +//@restriction_info Information about restrictions that must be applied to the corresponding private chat; may be null if none //@has_active_stories True, if the user has non-expired stories available to the current user //@has_unread_active_stories True, if the user has unread non-expired stories available to the current user //@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them @@ -1705,7 +1811,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool paid_message_star_count:int53 have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_info:restrictionInfo has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool paid_message_star_count:int53 have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -1759,9 +1865,12 @@ botInfo short_description:string description:string photo:photo animation:animat //@outgoing_paid_message_star_count Number of Telegram Stars that must be paid by the current user for each sent message to the user //@gift_settings Settings for gift receiving for the user //@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown +//@rating The current rating of the user; may be null if none +//@pending_rating The rating of the user after the next change; may be null if the user isn't the current user or there are no pending rating changes +//@pending_rating_date Unix timestamp when rating of the user will change to pending_rating; 0 if the user isn't the current user or there are no pending rating changes //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 gift_settings:giftSettings bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 incoming_paid_message_star_count:int53 outgoing_paid_message_star_count:int53 gift_settings:giftSettings bot_verification:botVerification rating:userRating pending_rating:userRating pending_rating_date:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -2006,12 +2115,11 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@verification_status Information about verification status of the supergroup or channel; may be null if none //@has_direct_messages_group True, if the channel has direct messages group //@has_forum_tabs True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups -//@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler -//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted +//@restriction_info Information about the restrictions that must be applied to the corresponding supergroup or channel chat; may be null if none //@paid_message_star_count Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message //@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user //@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_direct_messages_group:Bool is_administered_direct_messages_group:Bool verification_status:verificationStatus has_direct_messages_group:Bool has_forum_tabs:Bool has_sensitive_content:Bool restriction_reason:string paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_automatic_translation:Bool has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_direct_messages_group:Bool is_administered_direct_messages_group:Bool verification_status:verificationStatus has_direct_messages_group:Bool has_forum_tabs:Bool restriction_info:restrictionInfo paid_message_star_count:int53 has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo @@ -2081,6 +2189,15 @@ secretChatStateClosed = SecretChatState; secretChat id:int32 user_id:int53 state:SecretChatState is_outbound:Bool key_hash:bytes layer:int32 = SecretChat; +//@description Contains information about public post search limits +//@daily_free_query_count Number of queries that can be sent daily for free +//@remaining_free_query_count Number of remaining free queries today +//@next_free_query_in Amount of time till the next free query can be sent; 0 if it can be sent now +//@star_count Number of Telegram Stars that must be paid for each non-free query +//@is_current_query_free True, if the search for the specified query isn't charged +publicPostSearchLimits daily_free_query_count:int32 remaining_free_query_count:int32 next_free_query_in:int32 star_count:int64 is_current_query_free:Bool = PublicPostSearchLimits; + + //@class MessageSender @description Contains information about the sender of a message //@description The message was sent by a known user @user_id Identifier of the user that sent the message @@ -2377,11 +2494,10 @@ factCheck text:formattedText country_code:string = FactCheck; //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums //@effect_id Unique identifier of the effect added to the message; 0 if none -//@has_sensitive_content True, if media content of the message must be hidden with 18+ spoiler -//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted +//@restriction_info Information about the restrictions that must be applied to the message content; may be null if none //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_paid_star_suggested_post:Bool is_paid_ton_suggested_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck suggested_post_info:suggestedPostInfo reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_paid_star_suggested_post:Bool is_paid_ton_suggested_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck suggested_post_info:suggestedPostInfo reply_to:MessageReplyTo message_thread_id:int53 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 restriction_info:restrictionInfo content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null @@ -2393,6 +2509,13 @@ foundMessages total_count:int32 messages:vector next_offset:string = Fo //@description Contains a list of messages found by a search in a given chat @total_count Approximate total number of messages found; -1 if unknown @messages List of messages @next_from_message_id The offset for the next request. If 0, there are no more results foundChatMessages total_count:int32 messages:vector next_from_message_id:int53 = FoundChatMessages; +//@description Contains a list of messages found by a public post search +//@messages List of found public posts +//@next_offset The offset for the next request. If empty, then there are no more results +//@search_limits Updated public post search limits after the query; repeated requests with the same query will be free; may be null if they didn't change +//@are_limits_exceeded True, if the query has failed because search limits are exceeded. In this case search_limits.daily_free_query_count will be equal to 0 +foundPublicPosts messages:vector next_offset:string search_limits:publicPostSearchLimits are_limits_exceeded:Bool = FoundPublicPosts; + //@description Contains information about a message in a specific position @position 0-based message position in the full list of suitable messages @message_id Message identifier @date Point in time (Unix timestamp) when the message was sent messagePosition position:int32 message_id:int53 date:int32 = MessagePosition; @@ -3465,6 +3588,10 @@ linkPreviewTypeChannelBoost photo:chatPhoto = LinkPreviewType; //@creates_join_request True, if the link only creates join request linkPreviewTypeChat type:InviteLinkChatType photo:chatPhoto creates_join_request:Bool = LinkPreviewType; +//@description The link is a link to a direct messages chat of a channel +//@photo Photo of the channel chat; may be null +linkPreviewTypeDirectMessagesChat photo:chatPhoto = LinkPreviewType; + //@description The link is a link to a general file @document The document description linkPreviewTypeDocument document:document = LinkPreviewType; @@ -3506,6 +3633,9 @@ linkPreviewTypeExternalAudio url:string mime_type:string duration:int32 = LinkPr //@duration Duration of the video, in seconds; 0 if unknown linkPreviewTypeExternalVideo url:string mime_type:string width:int32 height:int32 duration:int32 = LinkPreviewType; +//@description The link is a link to a gift collection @icons Icons for some gifts from the collection; may be empty +linkPreviewTypeGiftCollection icons:vector = LinkPreviewType; + //@description The link is a link to a group call that isn't bound to a chat linkPreviewTypeGroupCall = LinkPreviewType; @@ -3533,6 +3663,11 @@ linkPreviewTypeStickerSet stickers:vector = LinkPreviewType; //@description The link is a link to a story. Link preview description is unavailable @story_poster_chat_id The identifier of the chat that posted the story @story_id Story identifier linkPreviewTypeStory story_poster_chat_id:int53 story_id:int32 = LinkPreviewType; +//@description The link is a link to an album of stories +//@photo_icon Icon of the album; may be null if none +//@video_icon Video icon of the album; may be null if none +linkPreviewTypeStoryAlbum photo_icon:photo video_icon:video = LinkPreviewType; + //@description The link is a link to boost a supergroup chat @photo Photo of the chat; may be null linkPreviewTypeSupergroupBoost photo:chatPhoto = LinkPreviewType; @@ -4457,7 +4592,7 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@description A regular gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift -//@sender_id Sender of the gift +//@sender_id Sender of the gift; may be null for outgoing messages about prepaid upgrade of gifts from unknown users //@receiver_id Receiver of the gift //@received_gift_id Unique identifier of the received gift for the current user; only for the receiver of the gift //@text Message added to the gift @@ -4465,12 +4600,14 @@ messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id //@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift //@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them //@is_saved True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift +//@is_prepaid_upgrade True, if the message is about prepaid upgrade of the gift by another user //@can_be_upgraded True, if the gift can be upgraded to a unique gift; only for the receiver of the gift //@was_converted True, if the gift was converted to Telegram Stars; only for the receiver of the gift //@was_upgraded True, if the gift was upgraded to a unique gift //@was_refunded True, if the gift was refunded and isn't available anymore //@upgraded_received_gift_id Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift -messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string = MessageContent; +//@prepaid_upgrade_hash If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade +messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received_gift_id:string text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool is_prepaid_upgrade:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgraded_received_gift_id:string prepaid_upgrade_hash:string = MessageContent; //@description An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift //@gift The gift @@ -4482,9 +4619,9 @@ messageGift gift:gift sender_id:MessageSender receiver_id:MessageSender received //@can_be_transferred True, if the gift can be transferred to another owner; only for the receiver of the gift //@was_transferred True, if the gift has already been transferred to another owner; only for the receiver of the gift //@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift -//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift +//@next_transfer_date Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift +//@next_resale_date Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift +//@export_date Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift messageUpgradedGift gift:upgradedGift sender_id:MessageSender receiver_id:MessageSender origin:UpgradedGiftOrigin received_gift_id:string is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 next_transfer_date:int32 next_resale_date:int32 export_date:int32 = MessageContent; //@description A gift which purchase, upgrade or transfer were refunded @@ -5336,6 +5473,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@is_edited True, if the story was edited //@is_posted_to_chat_page True, if the story is saved in the profile of the chat that posted it and will be available there after expiration //@is_visible_only_for_self True, if the story is visible only for the current user +//@can_be_added_to_album True, if the story can be added to an album //@can_be_deleted True, if the story can be deleted //@can_be_edited True, if the story can be edited //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden @@ -5351,7 +5489,8 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r //@content Content of the story //@areas Clickable areas to be shown on the story content //@caption Caption of the story -story id:int32 poster_chat_id:int53 poster_id:MessageSender date:int32 is_being_posted:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; +//@album_ids Identifiers of story albums to which the story is added; only for manageable stories +story id:int32 poster_chat_id:int53 poster_id:MessageSender date:int32 is_being_posted:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_added_to_album:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText album_ids:vector = Story; //@description Represents a list of stories //@total_count Approximate total number of stories found @@ -5362,6 +5501,16 @@ stories total_count:int32 stories:vector pinned_story_ids:vector = //@description Contains a list of stories found by a search @total_count Approximate total number of stories found @stories List of stories @next_offset The offset for the next request. If empty, then there are no more results foundStories total_count:int32 stories:vector next_offset:string = FoundStories; +//@description Describes album of stories +//@id Unique identifier of the album +//@name Name of the album +//@photo_icon Icon of the album; may be null if none +//@video_icon Video icon of the album; may be null if none +storyAlbum id:int32 name:string photo_icon:photo video_icon:video = StoryAlbum; + +//@description Represents a list of story albums @albums List of story albums +storyAlbums albums:vector = StoryAlbums; + //@description Contains identifier of a story along with identifier of the chat that posted it //@poster_chat_id Identifier of the chat that posted the story //@story_id Unique story identifier among stories of the chat @@ -5377,9 +5526,11 @@ storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; //@chat_id Identifier of the chat that posted the stories //@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list //@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order +//@can_be_archived True, if the stories are shown in the main story list and can be archived; otherwise, the stories can be hidden from the main story list +//-only by calling removeTopChat with topChatCategoryUsers and the chat_id. Stories of the current user can't be archived nor hidden using removeTopChat //@max_read_story_id Identifier of the last read active story //@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) -chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; +chatActiveStories chat_id:int53 list:StoryList order:int53 can_be_archived:Bool max_read_story_id:int32 stories:vector = ChatActiveStories; //@class StoryInteractionType @description Describes type of interaction with a story @@ -7759,6 +7910,11 @@ internalLinkTypeChatInvite invite_link:string = InternalLinkType; //@description The link is a link to the default message auto-delete timer settings section of the application settings internalLinkTypeDefaultMessageAutoDeleteTimerSettings = InternalLinkType; +//@description The link is a link to a channel direct messages chat by username of the channel. Call searchPublicChat with the given chat username to process the link. +//-If the chat is found and is channel, open the direct messages chat of the channel +//@channel_username Username of the channel +internalLinkTypeDirectMessagesChat channel_username:string = InternalLinkType; + //@description The link is a link to the edit profile section of the application settings internalLinkTypeEditProfileSettings = InternalLinkType; @@ -7768,6 +7924,12 @@ internalLinkTypeEditProfileSettings = InternalLinkType; //@game_short_name Short name of the game internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkType; +//@description The link is a link to a gift collection. Call searchPublicChat with the given username, then call getReceivedGifts with the received gift owner identifier +//-and the given collection identifier, then show the collection if received +//@gift_owner_username Username of the owner of the gift collection +//@collection_id Gift collection identifier +internalLinkTypeGiftCollection gift_owner_username:string collection_id:int32 = InternalLinkType; + //@description The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. //-Call joinGroupCall with the given invite_link to join the call //@invite_link Internal representation of the invite link @@ -7882,6 +8044,12 @@ internalLinkTypeStickerSet sticker_set_name:string expect_custom_emoji:Bool = In //@story_id Story identifier internalLinkTypeStory story_poster_username:string story_id:int32 = InternalLinkType; +//@description The link is a link to an album of stories. Call searchPublicChat with the given username, then call getStoryAlbumStories with the received chat identifier +//-and the given story album identifier, then show the story album if received +//@story_album_owner_username Username of the owner of the story album +//@story_album_id Story album identifier +internalLinkTypeStoryAlbum story_album_owner_username:string story_album_id:int32 = InternalLinkType; + //@description The link is a link to a cloud theme. TDLib has no theme support yet @theme_name Name of the theme internalLinkTypeTheme theme_name:string = InternalLinkType; @@ -8171,6 +8339,13 @@ connectionStateUpdating = ConnectionState; connectionStateReady = ConnectionState; +//@description Describes parameters for age verification of the current user +//@min_age The minimum age required to view restricted content +//@verification_bot_username Username of the bot which main Web App may be used to verify age of the user +//@country Unique name for the country or region, which legislation required age verification. May be used to get the corresponding localization key +ageVerificationParameters min_age:int32 verification_bot_username:string country:string = AgeVerificationParameters; + + //@class TopChatCategory @description Represents the categories of chats for which a list of frequently used chats can be retrieved //@description A category containing frequently used private chats with non-bot users @@ -8810,7 +8985,7 @@ updateDirectMessagesChatTopic topic:directMessagesChatTopic = Update; //@description Number of messages in a topic has changed; for Saved Messages and channel direct messages chat topics only //@chat_id Identifier of the chat in topic of which the number of messages has changed //@topic_id Identifier of the topic -//@message_count Approximate number of messages in the topics +//@message_count Approximate number of messages in the topic updateTopicMessageCount chat_id:int53 topic_id:MessageTopic message_count:int32 = Update; //@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application @@ -9087,6 +9262,10 @@ updateConnectionState state:ConnectionState = Update; //@appeal_link The link to open to send an appeal to unfreeze the account updateFreezeState is_frozen:Bool freezing_date:int32 deletion_date:int32 appeal_link:string = Update; +//@description The parameters for age verification of the current user's account has changed +//@parameters Parameters for the age verification; may be null if age verification isn't needed +updateAgeVerificationParameters parameters:ageVerificationParameters = Update; + //@description New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" @terms_of_service_id Identifier of the terms of service @terms_of_service The new terms of service updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService = Update; @@ -9923,6 +10102,16 @@ searchCallMessages offset:string limit:int32 only_missed:Bool = FoundMessages; //@limit The maximum number of messages to be returned; up to 100 searchOutgoingDocumentMessages query:string limit:int32 = FoundMessages; +//@description Checks public post search limits without actually performing the search @query Query that will be searched for +getPublicPostSearchLimits query:string = PublicPostSearchLimits; + +//@description Searches for public channel posts using the given query. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@query Query to search for +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@star_count The amount of Telegram Stars the user agreed to pay for the search; pass 0 for free searches +searchPublicPosts query:string offset:string limit:int32 star_count:int53 = FoundPublicPosts; + //@description Searches for public channel posts containing the given hashtag or cashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@tag Hashtag or cashtag to search for //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results @@ -11362,11 +11551,12 @@ canPostStory chat_id:int53 = CanPostStoryResult; //@areas Clickable rectangle areas to be shown on the story media; pass null if none //@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") //@privacy_settings The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats +//@album_ids Identifiers of story albums to which the story will be added upon posting. An album can have up to getOption("story_album_story_count_max") //@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise //@from_story_full_id Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story //@is_posted_to_chat_page Pass true to keep the story accessible after expiration //@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -postStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; +postStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings album_ids:vector active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; //@description Changes content and caption of a story. Can be called only if story.can_be_edited == true //@story_poster_chat_id Identifier of the chat that posted the story @@ -11491,6 +11681,60 @@ activateStoryStealthMode = Ok; //@limit The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit getStoryPublicForwards story_poster_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; +//@description Returns the list of story albums owned by the given chat @chat_id Chat identifier +getChatStoryAlbums chat_id:int53 = StoryAlbums; + +//@description Returns the list of stories added to the given story album. For optimal performance, the number of returned stories is chosen by TDLib +//@chat_id Chat identifier +//@story_album_id Story album identifier +//@offset Offset of the first entry to return; use 0 to get results from the first album story +//@limit The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +getStoryAlbumStories chat_id:int53 story_album_id:int32 offset:int32 limit:int32 = Stories; + +//@description Creates an album of stories; requires can_edit_stories administrator right for supergroup and channel chats +//@story_poster_chat_id Identifier of the chat that posted the stories +//@name Name of the album; 1-12 characters +//@story_ids Identifiers of stories to add to the album; 0-getOption("story_album_story_count_max") identifiers +createStoryAlbum story_poster_chat_id:int53 name:string story_ids:vector = StoryAlbum; + +//@description Changes order of story albums. If the albums are owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +//@chat_id Identifier of the chat that owns the stories +//@story_album_ids New order of story albums +reorderStoryAlbums chat_id:int53 story_album_ids:vector = Ok; + +//@description Deletes a story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +deleteStoryAlbum chat_id:int53 story_album_id:int32 = Ok; + +//@description Changes name of an album of stories. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@name New name of the album; 1-12 characters +setStoryAlbumName chat_id:int53 story_album_id:int32 name:string = StoryAlbum; + +//@description Adds stories to the beginning of a previously created story album. If the album is owned by a supergroup or a channel chat, then +//-requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@story_ids Identifier of the stories to add to the album; 1-getOption("story_album_story_count_max") identifiers. +//-If after addition the album has more than getOption("story_album_story_count_max") stories, then the last one are removed from the album +addStoryAlbumStories chat_id:int53 story_album_id:int32 story_ids:vector = StoryAlbum; + +//@description Removes stories from an album. If the album is owned by a supergroup or a channel chat, then +//-requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@story_ids Identifier of the stories to remove from the album +removeStoryAlbumStories chat_id:int53 story_album_id:int32 story_ids:vector = StoryAlbum; + +//@description Changes order of stories in an album. If the album is owned by a supergroup or a channel chat, then +//-requires can_edit_stories administrator right in the chat. Returns the changed album +//@chat_id Identifier of the chat that owns the stories +//@story_album_id Identifier of the story album +//@story_ids Identifier of the stories to move to the beginning of the album. All other stories are placed in the current order after the specified stories +reorderStoryAlbumStories chat_id:int53 story_album_id:int32 story_ids:vector = StoryAlbum; + //@description Returns the list of features available on the specific chat boost level. This is an offline method //@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups @@ -12728,7 +12972,7 @@ getAvailableGifts = AvailableGifts; //@description Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out //@gift_id Identifier of the gift to send -//@owner_id Identifier of the user or the channel chat that will receive the gift +//@owner_id Identifier of the user or the channel chat that will receive the gift; limited gifts can't be sent to channel chats //@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. //-Must be empty if the receiver enabled paid messages //@is_private Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them @@ -12765,7 +13009,13 @@ getGiftUpgradePreview gift_id:int64 = GiftUpgradePreview; //@star_count The amount of Telegram Stars required to pay for the upgrade. It the gift has prepaid_upgrade_star_count > 0, then pass 0, otherwise, pass gift.upgrade_star_count upgradeGift business_connection_id:string received_gift_id:string keep_original_details:Bool star_count:int53 = UpgradeGiftResult; -//@description Sends an upgraded gift to another user or a channel chat +//@description Pays for upgrade of a regular gift that is owned by another user or channel chat +//@owner_id Identifier of the user or the channel chat that owns the gift +//@prepaid_upgrade_hash Prepaid upgrade hash as received along with the gift +//@star_count The amount of Telegram Stars the user agreed to pay for the upgrade; must be equal to gift.upgrade_star_count +buyGiftUpgrade owner_id:MessageSender prepaid_upgrade_hash:string star_count:int53 = Ok; + +//@description Sends an upgraded gift to another user or channel chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@received_gift_id Identifier of the gift //@new_owner_id Identifier of the user or the channel chat that will receive the gift @@ -12776,21 +13026,23 @@ transferGift business_connection_id:string received_gift_id:string new_owner_id: //-must be transferred using transferGift and can't be passed to the method //@gift_name Name of the upgraded gift to send //@owner_id Identifier of the user or the channel chat that will receive the gift -//@star_count The amount of Telegram Stars required to pay for the gift -sendResoldGift gift_name:string owner_id:MessageSender star_count:int53 = Ok; +//@price The price that the user agreed to pay for the gift +sendResoldGift gift_name:string owner_id:MessageSender price:GiftResalePrice = GiftResaleResult; //@description Returns gifts received by the given user or chat //@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only //@owner_id Identifier of the gift receiver +//@collection_id Pass collection identifier to get gifts only from the specified collection; pass 0 to get gifts regardless of collections //@exclude_unsaved Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right //@exclude_saved Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right //@exclude_unlimited Pass true to exclude gifts that can be purchased unlimited number of times -//@exclude_limited Pass true to exclude gifts that can be purchased limited number of times +//@exclude_upgradable Pass true to exclude gifts that can be purchased limited number of times and can be upgraded +//@exclude_non_upgradable Pass true to exclude gifts that can be purchased limited number of times and can't be upgraded //@exclude_upgraded Pass true to exclude upgraded gifts //@sort_by_price Pass true to sort results by gift price instead of send date //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit -getReceivedGifts business_connection_id:string owner_id:MessageSender exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_limited:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; +getReceivedGifts business_connection_id:string owner_id:MessageSender collection_id:int32 exclude_unsaved:Bool exclude_saved:Bool exclude_unlimited:Bool exclude_upgradable:Bool exclude_non_upgradable:Bool exclude_upgraded:Bool sort_by_price:Bool offset:string limit:int32 = ReceivedGifts; //@description Returns information about a received gift @received_gift_id Identifier of the gift getReceivedGift received_gift_id:string = ReceivedGift; @@ -12798,6 +13050,9 @@ getReceivedGift received_gift_id:string = ReceivedGift; //@description Returns information about an upgraded gift by its name @name Unique name of the upgraded gift getUpgradedGift name:string = UpgradedGift; +//@description Returns information about value of an upgraded gift by its name @name Unique name of the upgraded gift +getUpgradedGiftValueInfo name:string = UpgradedGiftValueInfo; + //@description Returns a URL for upgraded gift withdrawal in the TON blockchain as an NFT; requires owner privileges for gifts owned by a chat //@received_gift_id Identifier of the gift //@password The 2-step verification password of the current user @@ -12805,9 +13060,10 @@ getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; //@description Changes resale price of a unique gift owned by the current user //@received_gift_id Identifier of the unique gift -//@resale_star_count The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. -//-The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift -setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; +//@price The new price for the unique gift; pass null to disallow gift resale. The current user will receive +//-getOption("gift_resale_star_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift if the gift price is in Telegram Stars or +//-getOption("gift_resale_ton_earnings_per_mille") Toncoins for each 1000 Toncoins paid for the gift if the gift price is in Toncoins +setGiftResalePrice received_gift_id:string price:GiftResalePrice = Ok; //@description Returns upgraded gifts that can be bought from other owners using sendResoldGift //@gift_id Identifier of the regular gift that was upgraded to a unique gift @@ -12818,6 +13074,54 @@ setGiftResalePrice received_gift_id:string resale_star_count:int53 = Ok; //@limit The maximum number of gifts to return searchGiftsForResale gift_id:int64 order:GiftForResaleOrder attributes:vector offset:string limit:int32 = GiftsForResale; + +//@description Returns collections of gifts owned by the given user or chat +//@owner_id Identifier of the user or the channel chat that received the gifts +getGiftCollections owner_id:MessageSender = GiftCollections; + +//@description Creates a collection from gifts on the current user's or a channel's profile page; requires can_post_messages administrator right in the channel chat. +//-An owner can have up to getOption("gift_collection_count_max") gift collections. The new collection will be added to the end of the gift collection list of the owner. Returns the created collection +//@owner_id Identifier of the user or the channel chat that received the gifts +//@name Name of the collection; 1-12 characters +//@received_gift_ids Identifier of the gifts to add to the collection; 0-getOption("gift_collection_gift_count_max") identifiers +createGiftCollection owner_id:MessageSender name:string received_gift_ids:vector = GiftCollection; + +//@description Changes order of gift collections. If the collections are owned by a channel chat, then requires can_post_messages administrator right in the channel chat +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_ids New order of gift collections +reorderGiftCollections owner_id:MessageSender collection_ids:vector = Ok; + +//@description Deletes a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +deleteGiftCollection owner_id:MessageSender collection_id:int32 = Ok; + +//@description Changes name of a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@name New name of the collection; 1-12 characters +setGiftCollectionName owner_id:MessageSender collection_id:int32 name:string = GiftCollection; + +//@description Adds gifts to the beginning of a previously created collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@received_gift_ids Identifier of the gifts to add to the collection; 1-getOption("gift_collection_gift_count_max") identifiers. +//-If after addition the collection has more than getOption("gift_collection_gift_count_max") gifts, then the last one are removed from the collection +addGiftCollectionGifts owner_id:MessageSender collection_id:int32 received_gift_ids:vector = GiftCollection; + +//@description Removes gifts from a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@received_gift_ids Identifier of the gifts to remove from the collection +removeGiftCollectionGifts owner_id:MessageSender collection_id:int32 received_gift_ids:vector = GiftCollection; + +//@description Changes order of gifts in a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +//@owner_id Identifier of the user or the channel chat that owns the collection +//@collection_id Identifier of the gift collection +//@received_gift_ids Identifier of the gifts to move to the beginning of the collection. All other gifts are placed in the current order after the specified gifts +reorderGiftCollectionGifts owner_id:MessageSender collection_id:int32 received_gift_ids:vector = GiftCollection; + + //@description Creates a link for the given invoice; for bots only //@business_connection_id Unique identifier of business connection on behalf of which to send the request //@invoice Information about the invoice of the type inputMessageInvoice From 926224f7076b1aa73b8c217c70894feb11094b92 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 28 Sep 2025 17:55:16 +0800 Subject: [PATCH 07/11] Update to TDLib 1.8.55 --- client/function.go | 1021 ++++++++++++++++++++- client/type.go | 2033 +++++++++++++++++++++++++++++++++++++++-- client/unmarshaler.go | 907 +++++++++++++++++- data/td_api.tl | 250 ++++- 4 files changed, 4055 insertions(+), 156 deletions(-) diff --git a/client/function.go b/client/function.go index 63ba51e..46bce98 100755 --- a/client/function.go +++ b/client/function.go @@ -3435,6 +3435,67 @@ func (client *Client) SearchOutgoingDocumentMessages(req *SearchOutgoingDocument return UnmarshalFoundMessages(result.Data) } +type GetPublicPostSearchLimitsRequest struct { + // Query that will be searched for + Query string `json:"query"` +} + +// Checks public post search limits without actually performing the search +func (client *Client) GetPublicPostSearchLimits(req *GetPublicPostSearchLimitsRequest) (*PublicPostSearchLimits, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPublicPostSearchLimits", + }, + Data: map[string]interface{}{ + "query": req.Query, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPublicPostSearchLimits(result.Data) +} + +type SearchPublicPostsRequest struct { + // Query to search for + Query string `json:"query"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` + // The amount of Telegram Stars the user agreed to pay for the search; pass 0 for free searches + StarCount int64 `json:"star_count"` +} + +// Searches for public channel posts using the given query. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicPosts(req *SearchPublicPostsRequest) (*FoundPublicPosts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicPosts", + }, + Data: map[string]interface{}{ + "query": req.Query, + "offset": req.Offset, + "limit": req.Limit, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundPublicPosts(result.Data) +} + type SearchPublicMessagesByTagRequest struct { // Hashtag or cashtag to search for Tag string `json:"tag"` @@ -9350,12 +9411,18 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(result.Data) + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(result.Data) + case TypeInternalLinkTypeEditProfileSettings: return UnmarshalInternalLinkTypeEditProfileSettings(result.Data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(result.Data) + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(result.Data) + case TypeInternalLinkTypeGroupCall: return UnmarshalInternalLinkTypeGroupCall(result.Data) @@ -9425,6 +9492,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(result.Data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(result.Data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(result.Data) @@ -10773,11 +10843,40 @@ func (client *Client) DeleteChatBackground(req *DeleteChatBackgroundRequest) (*O return UnmarshalOk(result.Data) } +type GetGiftChatThemesRequest struct { + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of chat themes to return + Limit int32 `json:"limit"` +} + +// Returns available to the current user gift chat themes +func (client *Client) GetGiftChatThemes(req *GetGiftChatThemesRequest) (*GiftChatThemes, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftChatThemes", + }, + Data: map[string]interface{}{ + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftChatThemes(result.Data) +} + type SetChatThemeRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Name of the new chat theme; pass an empty string to return the default theme - ThemeName string `json:"theme_name"` + // New chat theme; pass null to return the default theme + Theme InputChatTheme `json:"theme"` } // Changes the chat theme. Supported only in private and secret chats @@ -10788,7 +10887,7 @@ func (client *Client) SetChatTheme(req *SetChatThemeRequest) (*Ok, error) { }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "theme_name": req.ThemeName, + "theme": req.Theme, }, }) if err != nil { @@ -12143,6 +12242,8 @@ type PostStoryRequest struct { Caption *FormattedText `json:"caption"` // The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats PrivacySettings StoryPrivacySettings `json:"privacy_settings"` + // Identifiers of story albums to which the story will be added upon posting. An album can have up to getOption("story_album_story_count_max") + AlbumIds []int32 `json:"album_ids"` // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise ActivePeriod int32 `json:"active_period"` // Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story @@ -12165,6 +12266,7 @@ func (client *Client) PostStory(req *PostStoryRequest) (*Story, error) { "areas": req.Areas, "caption": req.Caption, "privacy_settings": req.PrivacySettings, + "album_ids": req.AlbumIds, "active_period": req.ActivePeriod, "from_story_full_id": req.FromStoryFullId, "is_posted_to_chat_page": req.IsPostedToChatPage, @@ -12840,6 +12942,285 @@ func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) return UnmarshalPublicForwards(result.Data) } +type GetChatStoryAlbumsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns the list of story albums owned by the given chat +func (client *Client) GetChatStoryAlbums(req *GetChatStoryAlbumsRequest) (*StoryAlbums, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatStoryAlbums", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbums(result.Data) +} + +type GetStoryAlbumStoriesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Story album identifier + StoryAlbumId int32 `json:"story_album_id"` + // Offset of the first entry to return; use 0 to get results from the first album story + Offset int32 `json:"offset"` + // The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns the list of stories added to the given story album. For optimal performance, the number of returned stories is chosen by TDLib +func (client *Client) GetStoryAlbumStories(req *GetStoryAlbumStoriesRequest) (*Stories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStories(result.Data) +} + +type CreateStoryAlbumRequest struct { + // Identifier of the chat that posted the stories + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // Name of the album; 1-12 characters + Name string `json:"name"` + // Identifiers of stories to add to the album; 0-getOption("story_album_story_count_max") identifiers + StoryIds []int32 `json:"story_ids"` +} + +// Creates an album of stories; requires can_edit_stories administrator right for supergroup and channel chats +func (client *Client) CreateStoryAlbum(req *CreateStoryAlbumRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createStoryAlbum", + }, + Data: map[string]interface{}{ + "story_poster_chat_id": req.StoryPosterChatId, + "name": req.Name, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type ReorderStoryAlbumsRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // New order of story albums + StoryAlbumIds []int32 `json:"story_album_ids"` +} + +// Changes order of story albums. If the albums are owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +func (client *Client) ReorderStoryAlbums(req *ReorderStoryAlbumsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderStoryAlbums", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_ids": req.StoryAlbumIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteStoryAlbumRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` +} + +// Deletes a story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +func (client *Client) DeleteStoryAlbum(req *DeleteStoryAlbumRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteStoryAlbum", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStoryAlbumNameRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // New name of the album; 1-12 characters + Name string `json:"name"` +} + +// Changes name of an album of stories. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) SetStoryAlbumName(req *SetStoryAlbumNameRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStoryAlbumName", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type AddStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to add to the album; 1-getOption("story_album_story_count_max") identifiers. If after addition the album has more than getOption("story_album_story_count_max") stories, then the last one are removed from the album + StoryIds []int32 `json:"story_ids"` +} + +// Adds stories to the beginning of a previously created story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) AddStoryAlbumStories(req *AddStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type RemoveStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to remove from the album + StoryIds []int32 `json:"story_ids"` +} + +// Removes stories from an album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) RemoveStoryAlbumStories(req *RemoveStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type ReorderStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to move to the beginning of the album. All other stories are placed in the current order after the specified stories + StoryIds []int32 `json:"story_ids"` +} + +// Changes order of stories in an album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) ReorderStoryAlbumStories(req *ReorderStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + type GetChatBoostLevelFeaturesRequest struct { // Pass true to get the list of features for channels; pass false to get the list of features for supergroups IsChannel bool `json:"is_channel"` @@ -16491,6 +16872,145 @@ func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*C return UnmarshalChatPhotos(result.Data) } +type GetUserProfileAudiosRequest struct { + // User identifier + UserId int64 `json:"user_id"` + // The number of audio files to skip; must be non-negative + Offset int32 `json:"offset"` + // The maximum number of audio files to be returned; up to 100 + Limit int32 `json:"limit"` +} + +// Returns the list of profile audio files of a user +func (client *Client) GetUserProfileAudios(req *GetUserProfileAudiosRequest) (*Audios, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserProfileAudios", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAudios(result.Data) +} + +type IsProfileAudioRequest struct { + // Identifier of the audio file to check + FileId int32 `json:"file_id"` +} + +// Checks whether a file is in the profile audio files of the current user. Returns a 404 error if it isn't +func (client *Client) IsProfileAudio(req *IsProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "isProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddProfileAudioRequest struct { + // Identifier of the audio file to be added. The file must have been uploaded to the server + FileId int32 `json:"file_id"` +} + +// Adds an audio file to the beginning of the profile audio files of the current user +func (client *Client) AddProfileAudio(req *AddProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetProfileAudioPositionRequest struct { + // Identifier of the file from profile audio files, which position will be changed + FileId int32 `json:"file_id"` + // Identifier of the file from profile audio files after which the file will be positioned; pass 0 to move the file to the beginning of the list + AfterFileId int32 `json:"after_file_id"` +} + +// Changes position of an audio file in the profile audio files of the current user +func (client *Client) SetProfileAudioPosition(req *SetProfileAudioPositionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setProfileAudioPosition", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "after_file_id": req.AfterFileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveProfileAudioRequest struct { + // Identifier of the audio file to be removed + FileId int32 `json:"file_id"` +} + +// Removes an audio file from the profile audio files of the current user +func (client *Client) RemoveProfileAudio(req *RemoveProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetStickerOutlineRequest struct { // File identifier of the sticker StickerFileId int32 `json:"sticker_file_id"` @@ -17947,6 +18467,32 @@ func (client *Client) SetBirthdate(req *SetBirthdateRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SetMainProfileTabRequest struct { + // The new value of the main profile tab + MainProfileTab ProfileTab `json:"main_profile_tab"` +} + +// Changes the main profile tab of the current user +func (client *Client) SetMainProfileTab(req *SetMainProfileTabRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMainProfileTab", + }, + Data: map[string]interface{}{ + "main_profile_tab": req.MainProfileTab, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetPersonalChatRequest struct { // Identifier of the new personal chat; pass 0 to remove the chat. Use getSuitablePersonalChats to get suitable chats ChatId int64 `json:"chat_id"` @@ -19830,6 +20376,35 @@ func (client *Client) SetSupergroupUnrestrictBoostCount(req *SetSupergroupUnrest return UnmarshalOk(result.Data) } +type SetSupergroupMainProfileTabRequest struct { + // Identifier of the channel + SupergroupId int64 `json:"supergroup_id"` + // The new value of the main profile tab + MainProfileTab ProfileTab `json:"main_profile_tab"` +} + +// Changes the main profile tab of the channel; requires can_change_info administrator right +func (client *Client) SetSupergroupMainProfileTab(req *SetSupergroupMainProfileTabRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupMainProfileTab", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "main_profile_tab": req.MainProfileTab, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupSignMessagesRequest struct { // Identifier of the channel SupergroupId int64 `json:"supergroup_id"` @@ -20535,10 +21110,45 @@ func (client *Client) GetAvailableGifts() (*AvailableGifts, error) { return UnmarshalAvailableGifts(result.Data) } +type CanSendGiftRequest struct { + // Identifier of the gift to send + GiftId JsonInt64 `json:"gift_id"` +} + +// Checks whether a gift with next_send_date in the future can be sent already +func (client *Client) CanSendGift(req *CanSendGiftRequest) (CanSendGiftResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canSendGift", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(result.Data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type SendGiftRequest struct { // Identifier of the gift to send GiftId JsonInt64 `json:"gift_id"` - // Identifier of the user or the channel chat that will receive the gift + // Identifier of the user or the channel chat that will receive the gift; limited gifts can't be sent to channel chats OwnerId MessageSender `json:"owner_id"` // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. Must be empty if the receiver enabled paid messages Text *FormattedText `json:"text"` @@ -20750,6 +21360,38 @@ func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, return UnmarshalUpgradeGiftResult(result.Data) } +type BuyGiftUpgradeRequest struct { + // Identifier of the user or the channel chat that owns the gift + OwnerId MessageSender `json:"owner_id"` + // Prepaid upgrade hash as received along with the gift + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` + // The amount of Telegram Stars the user agreed to pay for the upgrade; must be equal to gift.upgrade_star_count + StarCount int64 `json:"star_count"` +} + +// Pays for upgrade of a regular gift that is owned by another user or channel chat +func (client *Client) BuyGiftUpgrade(req *BuyGiftUpgradeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "buyGiftUpgrade", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "prepaid_upgrade_hash": req.PrepaidUpgradeHash, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type TransferGiftRequest struct { // Unique identifier of business connection on behalf of which to send the request; for bots only BusinessConnectionId string `json:"business_connection_id"` @@ -20761,7 +21403,7 @@ type TransferGiftRequest struct { StarCount int64 `json:"star_count"` } -// Sends an upgraded gift to another user or a channel chat +// Sends an upgraded gift to another user or channel chat func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -20790,12 +21432,12 @@ type SendResoldGiftRequest struct { GiftName string `json:"gift_name"` // Identifier of the user or the channel chat that will receive the gift OwnerId MessageSender `json:"owner_id"` - // The amount of Telegram Stars required to pay for the gift - StarCount int64 `json:"star_count"` + // The price that the user agreed to pay for the gift + Price GiftResalePrice `json:"price"` } // Sends an upgraded gift that is available for resale to another user or channel chat; gifts already owned by the current user must be transferred using transferGift and can't be passed to the method -func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { +func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (GiftResaleResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "sendResoldGift", @@ -20803,7 +21445,7 @@ func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { Data: map[string]interface{}{ "gift_name": req.GiftName, "owner_id": req.OwnerId, - "star_count": req.StarCount, + "price": req.Price, }, }) if err != nil { @@ -20814,7 +21456,16 @@ func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(result.Data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(result.Data) + + default: + return nil, errors.New("invalid type") + } } type GetReceivedGiftsRequest struct { @@ -20822,14 +21473,18 @@ type GetReceivedGiftsRequest struct { BusinessConnectionId string `json:"business_connection_id"` // Identifier of the gift receiver OwnerId MessageSender `json:"owner_id"` + // Pass collection identifier to get gifts only from the specified collection; pass 0 to get gifts regardless of collections + CollectionId int32 `json:"collection_id"` // Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right ExcludeUnsaved bool `json:"exclude_unsaved"` // Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right ExcludeSaved bool `json:"exclude_saved"` // Pass true to exclude gifts that can be purchased unlimited number of times ExcludeUnlimited bool `json:"exclude_unlimited"` - // Pass true to exclude gifts that can be purchased limited number of times - ExcludeLimited bool `json:"exclude_limited"` + // Pass true to exclude gifts that can be purchased limited number of times and can be upgraded + ExcludeUpgradable bool `json:"exclude_upgradable"` + // Pass true to exclude gifts that can be purchased limited number of times and can't be upgraded + ExcludeNonUpgradable bool `json:"exclude_non_upgradable"` // Pass true to exclude upgraded gifts ExcludeUpgraded bool `json:"exclude_upgraded"` // Pass true to sort results by gift price instead of send date @@ -20849,10 +21504,12 @@ func (client *Client) GetReceivedGifts(req *GetReceivedGiftsRequest) (*ReceivedG Data: map[string]interface{}{ "business_connection_id": req.BusinessConnectionId, "owner_id": req.OwnerId, + "collection_id": req.CollectionId, "exclude_unsaved": req.ExcludeUnsaved, "exclude_saved": req.ExcludeSaved, "exclude_unlimited": req.ExcludeUnlimited, - "exclude_limited": req.ExcludeLimited, + "exclude_upgradable": req.ExcludeUpgradable, + "exclude_non_upgradable": req.ExcludeNonUpgradable, "exclude_upgraded": req.ExcludeUpgraded, "sort_by_price": req.SortByPrice, "offset": req.Offset, @@ -20922,6 +21579,32 @@ func (client *Client) GetUpgradedGift(req *GetUpgradedGiftRequest) (*UpgradedGif return UnmarshalUpgradedGift(result.Data) } +type GetUpgradedGiftValueInfoRequest struct { + // Unique name of the upgraded gift + Name string `json:"name"` +} + +// Returns information about value of an upgraded gift by its name +func (client *Client) GetUpgradedGiftValueInfo(req *GetUpgradedGiftValueInfoRequest) (*UpgradedGiftValueInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftValueInfo", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpgradedGiftValueInfo(result.Data) +} + type GetUpgradedGiftWithdrawalUrlRequest struct { // Identifier of the gift ReceivedGiftId string `json:"received_gift_id"` @@ -20954,8 +21637,8 @@ func (client *Client) GetUpgradedGiftWithdrawalUrl(req *GetUpgradedGiftWithdrawa type SetGiftResalePriceRequest struct { // Identifier of the unique gift ReceivedGiftId string `json:"received_gift_id"` - // The new price for the unique gift; 0 or getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max"). Pass 0 to disallow gift resale. The current user will receive getOption("gift_resale_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift - ResaleStarCount int64 `json:"resale_star_count"` + // The new price for the unique gift; pass null to disallow gift resale. The current user will receive getOption("gift_resale_star_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift if the gift price is in Telegram Stars or getOption("gift_resale_ton_earnings_per_mille") Toncoins for each 1000 Toncoins paid for the gift if the gift price is in Toncoins + Price GiftResalePrice `json:"price"` } // Changes resale price of a unique gift owned by the current user @@ -20966,7 +21649,7 @@ func (client *Client) SetGiftResalePrice(req *SetGiftResalePriceRequest) (*Ok, e }, Data: map[string]interface{}{ "received_gift_id": req.ReceivedGiftId, - "resale_star_count": req.ResaleStarCount, + "price": req.Price, }, }) if err != nil { @@ -21018,6 +21701,250 @@ func (client *Client) SearchGiftsForResale(req *SearchGiftsForResaleRequest) (*G return UnmarshalGiftsForResale(result.Data) } +type GetGiftCollectionsRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` +} + +// Returns collections of gifts owned by the given user or chat +func (client *Client) GetGiftCollections(req *GetGiftCollectionsRequest) (*GiftCollections, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftCollections", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollections(result.Data) +} + +type CreateGiftCollectionRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` + // Name of the collection; 1-12 characters + Name string `json:"name"` + // Identifier of the gifts to add to the collection; 0-getOption("gift_collection_gift_count_max") identifiers + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Creates a collection from gifts on the current user's or a channel's profile page; requires can_post_messages administrator right in the channel chat. An owner can have up to getOption("gift_collection_count_max") gift collections. The new collection will be added to the end of the gift collection list of the owner. Returns the created collection +func (client *Client) CreateGiftCollection(req *CreateGiftCollectionRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createGiftCollection", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "name": req.Name, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type ReorderGiftCollectionsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // New order of gift collections + CollectionIds []int32 `json:"collection_ids"` +} + +// Changes order of gift collections. If the collections are owned by a channel chat, then requires can_post_messages administrator right in the channel chat +func (client *Client) ReorderGiftCollections(req *ReorderGiftCollectionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderGiftCollections", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_ids": req.CollectionIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteGiftCollectionRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` +} + +// Deletes a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat +func (client *Client) DeleteGiftCollection(req *DeleteGiftCollectionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteGiftCollection", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetGiftCollectionNameRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // New name of the collection; 1-12 characters + Name string `json:"name"` +} + +// Changes name of a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) SetGiftCollectionName(req *SetGiftCollectionNameRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftCollectionName", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type AddGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to add to the collection; 1-getOption("gift_collection_gift_count_max") identifiers. If after addition the collection has more than getOption("gift_collection_gift_count_max") gifts, then the last one are removed from the collection + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Adds gifts to the beginning of a previously created collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) AddGiftCollectionGifts(req *AddGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type RemoveGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to remove from the collection + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Removes gifts from a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) RemoveGiftCollectionGifts(req *RemoveGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type ReorderGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to move to the beginning of the collection. All other gifts are placed in the current order after the specified gifts + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Changes order of gifts in a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) ReorderGiftCollectionGifts(req *ReorderGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + type CreateInvoiceLinkRequest struct { // Unique identifier of business connection on behalf of which to send the request BusinessConnectionId string `json:"business_connection_id"` @@ -22453,6 +23380,58 @@ func (client *Client) GetStarAdAccountUrl(req *GetStarAdAccountUrlRequest) (*Htt return UnmarshalHttpUrl(result.Data) } +type GetTonRevenueStatisticsRequest struct { + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed Toncoin revenue statistics of the current user +func (client *Client) GetTonRevenueStatistics(req *GetTonRevenueStatisticsRequest) (*TonRevenueStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonRevenueStatistics", + }, + Data: map[string]interface{}{ + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTonRevenueStatistics(result.Data) +} + +type GetTonWithdrawalUrlRequest struct { + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns a URL for Toncoin withdrawal from the current user's account. The user must have at least 10 toncoins to withdraw and can withdraw up to 100000 Toncoins in one transaction +func (client *Client) GetTonWithdrawalUrl(req *GetTonWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonWithdrawalUrl", + }, + Data: map[string]interface{}{ + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetChatStatisticsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -26398,8 +27377,8 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateDefaultBackground: return UnmarshalUpdateDefaultBackground(result.Data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(result.Data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(result.Data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(result.Data) @@ -26416,6 +27395,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateFreezeState: return UnmarshalUpdateFreezeState(result.Data) + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(result.Data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(result.Data) @@ -26458,6 +27440,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateStarRevenueStatus: return UnmarshalUpdateStarRevenueStatus(result.Data) + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(result.Data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(result.Data) diff --git a/client/type.go b/client/type.go index a98e665..6490a7a 100755 --- a/client/type.go +++ b/client/type.go @@ -19,19 +19,23 @@ const ( ClassStickerType = "StickerType" ClassStickerFullType = "StickerFullType" ClassPollType = "PollType" + ClassProfileTab = "ProfileTab" ClassUserType = "UserType" ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" + ClassGiftResalePrice = "GiftResalePrice" ClassSuggestedPostPrice = "SuggestedPostPrice" ClassSuggestedPostState = "SuggestedPostState" ClassSuggestedPostRefundReason = "SuggestedPostRefundReason" ClassStarSubscriptionType = "StarSubscriptionType" ClassAffiliateType = "AffiliateType" ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassCanSendGiftResult = "CanSendGiftResult" ClassUpgradedGiftOrigin = "UpgradedGiftOrigin" ClassUpgradedGiftAttributeId = "UpgradedGiftAttributeId" ClassGiftForResaleOrder = "GiftForResaleOrder" + ClassGiftResaleResult = "GiftResaleResult" ClassSentGift = "SentGift" ClassTransactionDirection = "TransactionDirection" ClassStarTransactionType = "StarTransactionType" @@ -71,6 +75,7 @@ const ( ClassLoginUrlInfo = "LoginUrlInfo" ClassWebAppOpenMode = "WebAppOpenMode" ClassSavedMessagesTopicType = "SavedMessagesTopicType" + ClassBuiltInTheme = "BuiltInTheme" ClassRichText = "RichText" ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" @@ -143,6 +148,8 @@ const ( ClassBackgroundFill = "BackgroundFill" ClassBackgroundType = "BackgroundType" ClassInputBackground = "InputBackground" + ClassChatTheme = "ChatTheme" + ClassInputChatTheme = "InputChatTheme" ClassCanPostStoryResult = "CanPostStoryResult" ClassCanTransferOwnershipResult = "CanTransferOwnershipResult" ClassCheckChatUsernameResult = "CheckChatUsernameResult" @@ -211,6 +218,7 @@ const ( ClassInputChecklist = "InputChecklist" ClassAnimation = "Animation" ClassAudio = "Audio" + ClassAudios = "Audios" ClassDocument = "Document" ClassPhoto = "Photo" ClassSticker = "Sticker" @@ -289,6 +297,10 @@ const ( ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" ClassAcceptedGiftTypes = "AcceptedGiftTypes" ClassGiftSettings = "GiftSettings" + ClassGiftPurchaseLimits = "GiftPurchaseLimits" + ClassGiftResaleParameters = "GiftResaleParameters" + ClassGiftCollection = "GiftCollection" + ClassGiftCollections = "GiftCollections" ClassUpgradedGiftModel = "UpgradedGiftModel" ClassUpgradedGiftSymbol = "UpgradedGiftSymbol" ClassUpgradedGiftBackdropColors = "UpgradedGiftBackdropColors" @@ -296,6 +308,7 @@ const ( ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" ClassGift = "Gift" ClassUpgradedGift = "UpgradedGift" + ClassUpgradedGiftValueInfo = "UpgradedGiftValueInfo" ClassUpgradeGiftResult = "UpgradeGiftResult" ClassAvailableGift = "AvailableGift" ClassAvailableGifts = "AvailableGifts" @@ -314,6 +327,8 @@ const ( ClassAccentColor = "AccentColor" ClassProfileAccentColors = "ProfileAccentColors" ClassProfileAccentColor = "ProfileAccentColor" + ClassUserRating = "UserRating" + ClassRestrictionInfo = "RestrictionInfo" ClassEmojiStatus = "EmojiStatus" ClassEmojiStatuses = "EmojiStatuses" ClassEmojiStatusCustomEmojis = "EmojiStatusCustomEmojis" @@ -343,6 +358,7 @@ const ( ClassSupergroup = "Supergroup" ClassSupergroupFullInfo = "SupergroupFullInfo" ClassSecretChat = "SecretChat" + ClassPublicPostSearchLimits = "PublicPostSearchLimits" ClassMessageSenders = "MessageSenders" ClassChatMessageSender = "ChatMessageSender" ClassChatMessageSenders = "ChatMessageSenders" @@ -365,6 +381,7 @@ const ( ClassMessages = "Messages" ClassFoundMessages = "FoundMessages" ClassFoundChatMessages = "FoundChatMessages" + ClassFoundPublicPosts = "FoundPublicPosts" ClassMessagePosition = "MessagePosition" ClassMessagePositions = "MessagePositions" ClassMessageCalendarDay = "MessageCalendarDay" @@ -493,6 +510,8 @@ const ( ClassStory = "Story" ClassStories = "Stories" ClassFoundStories = "FoundStories" + ClassStoryAlbum = "StoryAlbum" + ClassStoryAlbums = "StoryAlbums" ClassStoryFullId = "StoryFullId" ClassStoryInfo = "StoryInfo" ClassChatActiveStories = "ChatActiveStories" @@ -566,7 +585,9 @@ const ( ClassBusinessFeaturePromotionAnimation = "BusinessFeaturePromotionAnimation" ClassPremiumState = "PremiumState" ClassPushReceiverId = "PushReceiverId" - ClassChatTheme = "ChatTheme" + ClassEmojiChatTheme = "EmojiChatTheme" + ClassGiftChatTheme = "GiftChatTheme" + ClassGiftChatThemes = "GiftChatThemes" ClassTimeZone = "TimeZone" ClassTimeZones = "TimeZones" ClassHashtags = "Hashtags" @@ -600,6 +621,7 @@ const ( ClassScopeAutosaveSettings = "ScopeAutosaveSettings" ClassAutosaveSettingsException = "AutosaveSettingsException" ClassAutosaveSettings = "AutosaveSettings" + ClassAgeVerificationParameters = "AgeVerificationParameters" ClassFoundPosition = "FoundPosition" ClassFoundPositions = "FoundPositions" ClassTMeUrl = "TMeUrl" @@ -628,6 +650,8 @@ const ( ClassChatRevenueTransactions = "ChatRevenueTransactions" ClassStarRevenueStatus = "StarRevenueStatus" ClassStarRevenueStatistics = "StarRevenueStatistics" + ClassTonRevenueStatus = "TonRevenueStatus" + ClassTonRevenueStatistics = "TonRevenueStatistics" ClassPoint = "Point" ClassUpdates = "Updates" ClassLogVerbosityLevel = "LogVerbosityLevel" @@ -726,6 +750,7 @@ const ( TypeInputChecklist = "inputChecklist" TypeAnimation = "animation" TypeAudio = "audio" + TypeAudios = "audios" TypeDocument = "document" TypePhoto = "photo" TypeSticker = "sticker" @@ -746,6 +771,14 @@ const ( TypeChatBackground = "chatBackground" TypeProfilePhoto = "profilePhoto" TypeChatPhotoInfo = "chatPhotoInfo" + TypeProfileTabPosts = "profileTabPosts" + TypeProfileTabGifts = "profileTabGifts" + TypeProfileTabMedia = "profileTabMedia" + TypeProfileTabFiles = "profileTabFiles" + TypeProfileTabLinks = "profileTabLinks" + TypeProfileTabMusic = "profileTabMusic" + TypeProfileTabVoice = "profileTabVoice" + TypeProfileTabGifs = "profileTabGifs" TypeUserTypeRegular = "userTypeRegular" TypeUserTypeDeleted = "userTypeDeleted" TypeUserTypeBot = "userTypeBot" @@ -789,6 +822,8 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeGiftResalePriceStar = "giftResalePriceStar" + TypeGiftResalePriceTon = "giftResalePriceTon" TypeSuggestedPostPriceStar = "suggestedPostPriceStar" TypeSuggestedPostPriceTon = "suggestedPostPriceTon" TypeSuggestedPostStatePending = "suggestedPostStatePending" @@ -832,9 +867,16 @@ const ( TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" TypeAcceptedGiftTypes = "acceptedGiftTypes" TypeGiftSettings = "giftSettings" + TypeGiftPurchaseLimits = "giftPurchaseLimits" + TypeGiftResaleParameters = "giftResaleParameters" + TypeGiftCollection = "giftCollection" + TypeGiftCollections = "giftCollections" + TypeCanSendGiftResultOk = "canSendGiftResultOk" + TypeCanSendGiftResultFail = "canSendGiftResultFail" TypeUpgradedGiftOriginUpgrade = "upgradedGiftOriginUpgrade" TypeUpgradedGiftOriginTransfer = "upgradedGiftOriginTransfer" TypeUpgradedGiftOriginResale = "upgradedGiftOriginResale" + TypeUpgradedGiftOriginPrepaidUpgrade = "upgradedGiftOriginPrepaidUpgrade" TypeUpgradedGiftModel = "upgradedGiftModel" TypeUpgradedGiftSymbol = "upgradedGiftSymbol" TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" @@ -842,6 +884,7 @@ const ( TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" TypeGift = "gift" TypeUpgradedGift = "upgradedGift" + TypeUpgradedGiftValueInfo = "upgradedGiftValueInfo" TypeUpgradeGiftResult = "upgradeGiftResult" TypeAvailableGift = "availableGift" TypeAvailableGifts = "availableGifts" @@ -856,6 +899,8 @@ const ( TypeGiftForResaleOrderNumber = "giftForResaleOrderNumber" TypeGiftForResale = "giftForResale" TypeGiftsForResale = "giftsForResale" + TypeGiftResaleResultOk = "giftResaleResultOk" + TypeGiftResaleResultPriceIncreased = "giftResaleResultPriceIncreased" TypeSentGiftRegular = "sentGiftRegular" TypeSentGiftUpgraded = "sentGiftUpgraded" TypeReceivedGift = "receivedGift" @@ -886,6 +931,7 @@ const ( TypeStarTransactionTypeGiftTransfer = "starTransactionTypeGiftTransfer" TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" TypeStarTransactionTypeGiftUpgrade = "starTransactionTypeGiftUpgrade" + TypeStarTransactionTypeGiftUpgradePurchase = "starTransactionTypeGiftUpgradePurchase" TypeStarTransactionTypeUpgradedGiftPurchase = "starTransactionTypeUpgradedGiftPurchase" TypeStarTransactionTypeUpgradedGiftSale = "starTransactionTypeUpgradedGiftSale" TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" @@ -898,11 +944,14 @@ const ( TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" TypeStarTransactionTypeBusinessBotTransferSend = "starTransactionTypeBusinessBotTransferSend" TypeStarTransactionTypeBusinessBotTransferReceive = "starTransactionTypeBusinessBotTransferReceive" + TypeStarTransactionTypePublicPostSearch = "starTransactionTypePublicPostSearch" TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" TypeStarTransaction = "starTransaction" TypeStarTransactions = "starTransactions" TypeTonTransactionTypeFragmentDeposit = "tonTransactionTypeFragmentDeposit" TypeTonTransactionTypeSuggestedPostPayment = "tonTransactionTypeSuggestedPostPayment" + TypeTonTransactionTypeUpgradedGiftPurchase = "tonTransactionTypeUpgradedGiftPurchase" + TypeTonTransactionTypeUpgradedGiftSale = "tonTransactionTypeUpgradedGiftSale" TypeTonTransactionTypeUnsupported = "tonTransactionTypeUnsupported" TypeTonTransaction = "tonTransaction" TypeTonTransactions = "tonTransactions" @@ -918,6 +967,8 @@ const ( TypeAccentColor = "accentColor" TypeProfileAccentColors = "profileAccentColors" TypeProfileAccentColor = "profileAccentColor" + TypeUserRating = "userRating" + TypeRestrictionInfo = "restrictionInfo" TypeEmojiStatusTypeCustomEmoji = "emojiStatusTypeCustomEmoji" TypeEmojiStatusTypeUpgradedGift = "emojiStatusTypeUpgradedGift" TypeEmojiStatus = "emojiStatus" @@ -976,6 +1027,7 @@ const ( TypeSecretChatStateReady = "secretChatStateReady" TypeSecretChatStateClosed = "secretChatStateClosed" TypeSecretChat = "secretChat" + TypePublicPostSearchLimits = "publicPostSearchLimits" TypeMessageSenderUser = "messageSenderUser" TypeMessageSenderChat = "messageSenderChat" TypeMessageSenders = "messageSenders" @@ -1027,6 +1079,7 @@ const ( TypeMessages = "messages" TypeFoundMessages = "foundMessages" TypeFoundChatMessages = "foundChatMessages" + TypeFoundPublicPosts = "foundPublicPosts" TypeMessagePosition = "messagePosition" TypeMessagePositions = "messagePositions" TypeMessageCalendarDay = "messageCalendarDay" @@ -1157,6 +1210,11 @@ const ( TypeLinkPreviewOptions = "linkPreviewOptions" TypeSharedUser = "sharedUser" TypeSharedChat = "sharedChat" + TypeBuiltInThemeClassic = "builtInThemeClassic" + TypeBuiltInThemeDay = "builtInThemeDay" + TypeBuiltInThemeNight = "builtInThemeNight" + TypeBuiltInThemeTinted = "builtInThemeTinted" + TypeBuiltInThemeArctic = "builtInThemeArctic" TypeThemeSettings = "themeSettings" TypeRichTextPlain = "richTextPlain" TypeRichTextBold = "richTextBold" @@ -1225,12 +1283,14 @@ const ( TypeLinkPreviewTypeBackground = "linkPreviewTypeBackground" TypeLinkPreviewTypeChannelBoost = "linkPreviewTypeChannelBoost" TypeLinkPreviewTypeChat = "linkPreviewTypeChat" + TypeLinkPreviewTypeDirectMessagesChat = "linkPreviewTypeDirectMessagesChat" TypeLinkPreviewTypeDocument = "linkPreviewTypeDocument" TypeLinkPreviewTypeEmbeddedAnimationPlayer = "linkPreviewTypeEmbeddedAnimationPlayer" TypeLinkPreviewTypeEmbeddedAudioPlayer = "linkPreviewTypeEmbeddedAudioPlayer" TypeLinkPreviewTypeEmbeddedVideoPlayer = "linkPreviewTypeEmbeddedVideoPlayer" TypeLinkPreviewTypeExternalAudio = "linkPreviewTypeExternalAudio" TypeLinkPreviewTypeExternalVideo = "linkPreviewTypeExternalVideo" + TypeLinkPreviewTypeGiftCollection = "linkPreviewTypeGiftCollection" TypeLinkPreviewTypeGroupCall = "linkPreviewTypeGroupCall" TypeLinkPreviewTypeInvoice = "linkPreviewTypeInvoice" TypeLinkPreviewTypeMessage = "linkPreviewTypeMessage" @@ -1240,6 +1300,7 @@ const ( TypeLinkPreviewTypeSticker = "linkPreviewTypeSticker" TypeLinkPreviewTypeStickerSet = "linkPreviewTypeStickerSet" TypeLinkPreviewTypeStory = "linkPreviewTypeStory" + TypeLinkPreviewTypeStoryAlbum = "linkPreviewTypeStoryAlbum" TypeLinkPreviewTypeSupergroupBoost = "linkPreviewTypeSupergroupBoost" TypeLinkPreviewTypeTheme = "linkPreviewTypeTheme" TypeLinkPreviewTypeUnsupported = "linkPreviewTypeUnsupported" @@ -1599,6 +1660,8 @@ const ( TypeStory = "story" TypeStories = "stories" TypeFoundStories = "foundStories" + TypeStoryAlbum = "storyAlbum" + TypeStoryAlbums = "storyAlbums" TypeStoryFullId = "storyFullId" TypeStoryInfo = "storyInfo" TypeChatActiveStories = "chatActiveStories" @@ -1922,7 +1985,13 @@ const ( TypeInputBackgroundLocal = "inputBackgroundLocal" TypeInputBackgroundRemote = "inputBackgroundRemote" TypeInputBackgroundPrevious = "inputBackgroundPrevious" - TypeChatTheme = "chatTheme" + TypeEmojiChatTheme = "emojiChatTheme" + TypeGiftChatTheme = "giftChatTheme" + TypeGiftChatThemes = "giftChatThemes" + TypeChatThemeEmoji = "chatThemeEmoji" + TypeChatThemeGift = "chatThemeGift" + TypeInputChatThemeEmoji = "inputChatThemeEmoji" + TypeInputChatThemeGift = "inputChatThemeGift" TypeTimeZone = "timeZone" TypeTimeZones = "timeZones" TypeHashtags = "hashtags" @@ -2110,8 +2179,10 @@ const ( TypeInternalLinkTypeChatFolderSettings = "internalLinkTypeChatFolderSettings" TypeInternalLinkTypeChatInvite = "internalLinkTypeChatInvite" TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings = "internalLinkTypeDefaultMessageAutoDeleteTimerSettings" + TypeInternalLinkTypeDirectMessagesChat = "internalLinkTypeDirectMessagesChat" TypeInternalLinkTypeEditProfileSettings = "internalLinkTypeEditProfileSettings" TypeInternalLinkTypeGame = "internalLinkTypeGame" + TypeInternalLinkTypeGiftCollection = "internalLinkTypeGiftCollection" TypeInternalLinkTypeGroupCall = "internalLinkTypeGroupCall" TypeInternalLinkTypeInstantView = "internalLinkTypeInstantView" TypeInternalLinkTypeInvoice = "internalLinkTypeInvoice" @@ -2135,6 +2206,7 @@ const ( TypeInternalLinkTypeSettings = "internalLinkTypeSettings" TypeInternalLinkTypeStickerSet = "internalLinkTypeStickerSet" TypeInternalLinkTypeStory = "internalLinkTypeStory" + TypeInternalLinkTypeStoryAlbum = "internalLinkTypeStoryAlbum" TypeInternalLinkTypeTheme = "internalLinkTypeTheme" TypeInternalLinkTypeThemeSettings = "internalLinkTypeThemeSettings" TypeInternalLinkTypeUnknownDeepLink = "internalLinkTypeUnknownDeepLink" @@ -2200,6 +2272,7 @@ const ( TypeConnectionStateConnecting = "connectionStateConnecting" TypeConnectionStateUpdating = "connectionStateUpdating" TypeConnectionStateReady = "connectionStateReady" + TypeAgeVerificationParameters = "ageVerificationParameters" TypeTopChatCategoryUsers = "topChatCategoryUsers" TypeTopChatCategoryBots = "topChatCategoryBots" TypeTopChatCategoryGroups = "topChatCategoryGroups" @@ -2275,6 +2348,8 @@ const ( TypeChatRevenueTransactions = "chatRevenueTransactions" TypeStarRevenueStatus = "starRevenueStatus" TypeStarRevenueStatistics = "starRevenueStatistics" + TypeTonRevenueStatus = "tonRevenueStatus" + TypeTonRevenueStatistics = "tonRevenueStatistics" TypePoint = "point" TypeVectorPathCommandLine = "vectorPathCommandLine" TypeVectorPathCommandCubicBezierCurve = "vectorPathCommandCubicBezierCurve" @@ -2400,12 +2475,13 @@ const ( TypeUpdateSavedAnimations = "updateSavedAnimations" TypeUpdateSavedNotificationSounds = "updateSavedNotificationSounds" TypeUpdateDefaultBackground = "updateDefaultBackground" - TypeUpdateChatThemes = "updateChatThemes" + TypeUpdateEmojiChatThemes = "updateEmojiChatThemes" TypeUpdateAccentColors = "updateAccentColors" TypeUpdateProfileAccentColors = "updateProfileAccentColors" TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" TypeUpdateFreezeState = "updateFreezeState" + TypeUpdateAgeVerificationParameters = "updateAgeVerificationParameters" TypeUpdateTermsOfService = "updateTermsOfService" TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" @@ -2420,6 +2496,7 @@ const ( TypeUpdateOwnedTonCount = "updateOwnedTonCount" TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" TypeUpdateStarRevenueStatus = "updateStarRevenueStatus" + TypeUpdateTonRevenueStatus = "updateTonRevenueStatus" TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" TypeUpdateDiceEmojis = "updateDiceEmojis" TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" @@ -2525,6 +2602,11 @@ type PollType interface { PollTypeType() string } +// Describes a tab shown in a user or a chat profile +type ProfileTab interface { + ProfileTabType() string +} + // Represents the type of user. The following types are possible: regular users, deleted users and bots type UserType interface { UserTypeType() string @@ -2545,6 +2627,11 @@ type InputChatPhoto interface { InputChatPhotoType() string } +// Describes price of a resold gift +type GiftResalePrice interface { + GiftResalePriceType() string +} + // Describes price of a suggested post type SuggestedPostPrice interface { SuggestedPostPriceType() string @@ -2575,6 +2662,11 @@ type AffiliateProgramSortOrder interface { AffiliateProgramSortOrderType() string } +// Describes whether a gift can be sent now by the current user +type CanSendGiftResult interface { + CanSendGiftResultType() string +} + // Describes origin from which the upgraded gift was obtained type UpgradedGiftOrigin interface { UpgradedGiftOriginType() string @@ -2590,6 +2682,11 @@ type GiftForResaleOrder interface { GiftForResaleOrderType() string } +// Describes result of sending a resold gift +type GiftResaleResult interface { + GiftResaleResultType() string +} + // Represents content of a gift received by a user or a channel chat type SentGift interface { SentGiftType() string @@ -2785,6 +2882,11 @@ type SavedMessagesTopicType interface { SavedMessagesTopicTypeType() string } +// Describes a built-in theme of an official app +type BuiltInTheme interface { + BuiltInThemeType() string +} + // Describes a formatted text object type RichText interface { RichTextType() string @@ -3145,6 +3247,16 @@ type InputBackground interface { InputBackgroundType() string } +// Describes a chat theme +type ChatTheme interface { + ChatThemeType() string +} + +// Describes a chat theme to set +type InputChatTheme interface { + InputChatThemeType() string +} + // Represents result of checking whether the current user can post a story on behalf of the specific chat type CanPostStoryResult interface { CanPostStoryResultType() string @@ -4087,6 +4199,10 @@ type AuthorizationStateWaitPremiumPurchase struct { meta // Identifier of the store product that must be bought StoreProductId string `json:"store_product_id"` + // Email address to use for support if the user has issues with Telegram Premium purchase + SupportEmailAddress string `json:"support_email_address"` + // Subject for the email sent to the support email address + SupportEmailSubject string `json:"support_email_subject"` } func (entity *AuthorizationStateWaitPremiumPurchase) MarshalJSON() ([]byte, error) { @@ -5773,6 +5889,31 @@ func (*Audio) GetType() string { return TypeAudio } +// Contains a list of audio files +type Audios struct { + meta + // Approximate total number of audio files found + TotalCount int32 `json:"total_count"` + // List of audio files + Audios []*Audio `json:"audios"` +} + +func (entity *Audios) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Audios + + return json.Marshal((*stub)(entity)) +} + +func (*Audios) GetClass() string { + return ClassAudios +} + +func (*Audios) GetType() string { + return TypeAudios +} + // Describes a document of any type type Document struct { meta @@ -6566,6 +6707,206 @@ func (*ChatPhotoInfo) GetType() string { return TypeChatPhotoInfo } +// A tab with stories posted by the user or the channel chat and saved to profile +type ProfileTabPosts struct{ + meta +} + +func (entity *ProfileTabPosts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabPosts + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabPosts) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabPosts) GetType() string { + return TypeProfileTabPosts +} + +func (*ProfileTabPosts) ProfileTabType() string { + return TypeProfileTabPosts +} + +// A tab with gifts received by the user or the channel chat +type ProfileTabGifts struct{ + meta +} + +func (entity *ProfileTabGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabGifts + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabGifts) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabGifts) GetType() string { + return TypeProfileTabGifts +} + +func (*ProfileTabGifts) ProfileTabType() string { + return TypeProfileTabGifts +} + +// A tab with photos and videos posted by the channel +type ProfileTabMedia struct{ + meta +} + +func (entity *ProfileTabMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabMedia + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabMedia) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabMedia) GetType() string { + return TypeProfileTabMedia +} + +func (*ProfileTabMedia) ProfileTabType() string { + return TypeProfileTabMedia +} + +// A tab with documents posted by the channel +type ProfileTabFiles struct{ + meta +} + +func (entity *ProfileTabFiles) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabFiles + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabFiles) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabFiles) GetType() string { + return TypeProfileTabFiles +} + +func (*ProfileTabFiles) ProfileTabType() string { + return TypeProfileTabFiles +} + +// A tab with messages posted by the channel and containing links +type ProfileTabLinks struct{ + meta +} + +func (entity *ProfileTabLinks) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabLinks + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabLinks) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabLinks) GetType() string { + return TypeProfileTabLinks +} + +func (*ProfileTabLinks) ProfileTabType() string { + return TypeProfileTabLinks +} + +// A tab with audio messages posted by the channel +type ProfileTabMusic struct{ + meta +} + +func (entity *ProfileTabMusic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabMusic + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabMusic) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabMusic) GetType() string { + return TypeProfileTabMusic +} + +func (*ProfileTabMusic) ProfileTabType() string { + return TypeProfileTabMusic +} + +// A tab with voice notes posted by the channel +type ProfileTabVoice struct{ + meta +} + +func (entity *ProfileTabVoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabVoice + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabVoice) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabVoice) GetType() string { + return TypeProfileTabVoice +} + +func (*ProfileTabVoice) ProfileTabType() string { + return TypeProfileTabVoice +} + +// A tab with animations posted by the channel +type ProfileTabGifs struct{ + meta +} + +func (entity *ProfileTabGifs) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabGifs + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabGifs) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabGifs) GetType() string { + return TypeProfileTabGifs +} + +func (*ProfileTabGifs) ProfileTabType() string { + return TypeProfileTabGifs +} + // A regular user type UserTypeRegular struct{ meta @@ -7922,10 +8263,64 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes price of a resold gift in Telegram Stars +type GiftResalePriceStar struct { + meta + // The amount of Telegram Stars expected to be paid for the gift. Must be in range getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max") for gifts put for resale + StarCount int64 `json:"star_count"` +} + +func (entity *GiftResalePriceStar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResalePriceStar + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResalePriceStar) GetClass() string { + return ClassGiftResalePrice +} + +func (*GiftResalePriceStar) GetType() string { + return TypeGiftResalePriceStar +} + +func (*GiftResalePriceStar) GiftResalePriceType() string { + return TypeGiftResalePriceStar +} + +// Describes price of a resold gift in Toncoins +type GiftResalePriceTon struct { + meta + // The amount of 1/100 of Toncoin expected to be paid for the gift. Must be in range getOption("gift_resale_toncoin_cent_count_min")-getOption("gift_resale_toncoin_cent_count_max") + ToncoinCentCount int64 `json:"toncoin_cent_count"` +} + +func (entity *GiftResalePriceTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResalePriceTon + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResalePriceTon) GetClass() string { + return ClassGiftResalePrice +} + +func (*GiftResalePriceTon) GetType() string { + return TypeGiftResalePriceTon +} + +func (*GiftResalePriceTon) GiftResalePriceType() string { + return TypeGiftResalePriceTon +} + // Describes price of a suggested post in Telegram Stars type SuggestedPostPriceStar struct { meta - // The amount of Telegram Stars agreed to pay for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") + // The amount of Telegram Stars expected to be paid for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") StarCount int64 `json:"star_count"` } @@ -7952,7 +8347,7 @@ func (*SuggestedPostPriceStar) SuggestedPostPriceType() string { // Describes price of a suggested post in Toncoins type SuggestedPostPriceTon struct { meta - // The amount of 1/100 of Toncoin agreed to pay for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") + // The amount of 1/100 of Toncoin expected to be paid for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") ToncoinCentCount int64 `json:"toncoin_cent_count"` } @@ -9244,6 +9639,162 @@ func (*GiftSettings) GetType() string { return TypeGiftSettings } +// Describes the maximum number of times that a specific gift can be purchased +type GiftPurchaseLimits struct { + meta + // The maximum number of times the gifts can be purchased + TotalCount int32 `json:"total_count"` + // Number of remaining times the gift can be purchased + RemainingCount int32 `json:"remaining_count"` +} + +func (entity *GiftPurchaseLimits) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftPurchaseLimits + + return json.Marshal((*stub)(entity)) +} + +func (*GiftPurchaseLimits) GetClass() string { + return ClassGiftPurchaseLimits +} + +func (*GiftPurchaseLimits) GetType() string { + return TypeGiftPurchaseLimits +} + +// Describes parameters of a unique gift available for resale +type GiftResaleParameters struct { + meta + // Resale price of the gift in Telegram Stars + StarCount int64 `json:"star_count"` + // Resale price of the gift in 1/100 of Toncoin + ToncoinCentCount int64 `json:"toncoin_cent_count"` + // True, if the gift can be bought only using Toncoins + ToncoinOnly bool `json:"toncoin_only"` +} + +func (entity *GiftResaleParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleParameters + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleParameters) GetClass() string { + return ClassGiftResaleParameters +} + +func (*GiftResaleParameters) GetType() string { + return TypeGiftResaleParameters +} + +// Describes collection of gifts +type GiftCollection struct { + meta + // Unique identifier of the collection + Id int32 `json:"id"` + // Name of the collection + Name string `json:"name"` + // Icon of the collection; may be null if none + Icon *Sticker `json:"icon"` + // Total number of gifts in the collection + GiftCount int32 `json:"gift_count"` +} + +func (entity *GiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*GiftCollection) GetClass() string { + return ClassGiftCollection +} + +func (*GiftCollection) GetType() string { + return TypeGiftCollection +} + +// Contains a list of gift collections +type GiftCollections struct { + meta + // List of gift collections + Collections []*GiftCollection `json:"collections"` +} + +func (entity *GiftCollections) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftCollections + + return json.Marshal((*stub)(entity)) +} + +func (*GiftCollections) GetClass() string { + return ClassGiftCollections +} + +func (*GiftCollections) GetType() string { + return TypeGiftCollections +} + +// The gift can be sent now by the current user +type CanSendGiftResultOk struct{ + meta +} + +func (entity *CanSendGiftResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendGiftResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendGiftResultOk) GetClass() string { + return ClassCanSendGiftResult +} + +func (*CanSendGiftResultOk) GetType() string { + return TypeCanSendGiftResultOk +} + +func (*CanSendGiftResultOk) CanSendGiftResultType() string { + return TypeCanSendGiftResultOk +} + +// The gift can't be sent now by the current user +type CanSendGiftResultFail struct { + meta + // Reason to be shown to the user + Reason *FormattedText `json:"reason"` +} + +func (entity *CanSendGiftResultFail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendGiftResultFail + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendGiftResultFail) GetClass() string { + return ClassCanSendGiftResult +} + +func (*CanSendGiftResultFail) GetType() string { + return TypeCanSendGiftResultFail +} + +func (*CanSendGiftResultFail) CanSendGiftResultType() string { + return TypeCanSendGiftResultFail +} + // The gift was obtained by upgrading of a previously received gift type UpgradedGiftOriginUpgrade struct { meta @@ -9299,8 +9850,8 @@ func (*UpgradedGiftOriginTransfer) UpgradedGiftOriginType() string { // The gift was bought from another user type UpgradedGiftOriginResale struct { meta - // Number of Telegram Stars that were paid by the sender for the gift - StarCount int64 `json:"star_count"` + // Price paid by the sender for the gift + Price GiftResalePrice `json:"price"` } func (entity *UpgradedGiftOriginResale) MarshalJSON() ([]byte, error) { @@ -9323,6 +9874,47 @@ func (*UpgradedGiftOriginResale) UpgradedGiftOriginType() string { return TypeUpgradedGiftOriginResale } +func (upgradedGiftOriginResale *UpgradedGiftOriginResale) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + upgradedGiftOriginResale.Price = fieldPrice + + return nil +} + +// The sender or receiver of the message has paid for upgraid of the gift, which has been completed +type UpgradedGiftOriginPrepaidUpgrade struct{ + meta +} + +func (entity *UpgradedGiftOriginPrepaidUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginPrepaidUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginPrepaidUpgrade) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginPrepaidUpgrade) GetType() string { + return TypeUpgradedGiftOriginPrepaidUpgrade +} + +func (*UpgradedGiftOriginPrepaidUpgrade) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginPrepaidUpgrade +} + // Describes a model of an upgraded gift type UpgradedGiftModel struct { meta @@ -9506,10 +10098,14 @@ type Gift struct { UpgradeStarCount int64 `json:"upgrade_star_count"` // True, if the gift is a birthday gift IsForBirthday bool `json:"is_for_birthday"` - // Number of remaining times the gift can be purchased; 0 if not limited or the gift was sold out - RemainingCount int32 `json:"remaining_count"` - // Number of total times the gift can be purchased; 0 if not limited - TotalCount int32 `json:"total_count"` + // True, if the gift can be bought only by Telegram Premium subscribers + IsPremium bool `json:"is_premium"` + // Point in time (Unix timestamp) when the gift can be sent next time by the current user; can be 0 or a date in the past. If the date is in the future, then call canSendGift to get the reason, why the gift can't be sent now + NextSendDate int32 `json:"next_send_date"` + // Number of times the gift can be purchased by the current user; may be null if not limited + UserLimits *GiftPurchaseLimits `json:"user_limits"` + // Number of times the gift can be purchased all users; may be null if not limited + OverallLimits *GiftPurchaseLimits `json:"overall_limits"` // Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only FirstSendDate int32 `json:"first_send_date"` // Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only @@ -9537,6 +10133,8 @@ type UpgradedGift struct { meta // Unique identifier of the gift Id JsonInt64 `json:"id"` + // Unique identifier of the regular gift from which the gift was upgraded; may be 0 for short period of time for old gifts from database + RegularGiftId JsonInt64 `json:"regular_gift_id"` // Identifier of the chat that published the gift; 0 if none PublisherChatId int64 `json:"publisher_chat_id"` // The title of the upgraded gift @@ -9549,6 +10147,12 @@ type UpgradedGift struct { TotalUpgradedCount int32 `json:"total_upgraded_count"` // The maximum number of gifts that can be upgraded from the same gift MaxUpgradedCount int32 `json:"max_upgraded_count"` + // True, if the original gift could have been bought only by Telegram Premium subscribers + IsPremium bool `json:"is_premium"` + // True, if the gift can be used to set a theme in a chat + IsThemeAvailable bool `json:"is_theme_available"` + // Identifier of the chat for which the gift is used to set a theme; 0 if none or the gift isn't owned by the current user + UsedThemeChatId int64 `json:"used_theme_chat_id"` // Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown OwnerId MessageSender `json:"owner_id"` // Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address @@ -9565,8 +10169,12 @@ type UpgradedGift struct { Backdrop *UpgradedGiftBackdrop `json:"backdrop"` // Information about the originally sent gift; may be null if unknown OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` - // Number of Telegram Stars that must be paid to buy the gift and send it to someone else; 0 if resale isn't possible - ResaleStarCount int64 `json:"resale_star_count"` + // Resale parameters of the gift; may be null if resale isn't possible + ResaleParameters *GiftResaleParameters `json:"resale_parameters"` + // ISO 4217 currency code of the currency in which value of the gift is represented; may be empty if unavailable + ValueCurrency string `json:"value_currency"` + // Estimated value of the gift; in the smallest units of the currency; 0 if unavailable + ValueAmount int64 `json:"value_amount"` } func (entity *UpgradedGift) MarshalJSON() ([]byte, error) { @@ -9588,12 +10196,16 @@ func (*UpgradedGift) GetType() string { func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { var tmp struct { Id JsonInt64 `json:"id"` + RegularGiftId JsonInt64 `json:"regular_gift_id"` PublisherChatId int64 `json:"publisher_chat_id"` Title string `json:"title"` Name string `json:"name"` Number int32 `json:"number"` TotalUpgradedCount int32 `json:"total_upgraded_count"` MaxUpgradedCount int32 `json:"max_upgraded_count"` + IsPremium bool `json:"is_premium"` + IsThemeAvailable bool `json:"is_theme_available"` + UsedThemeChatId int64 `json:"used_theme_chat_id"` OwnerId json.RawMessage `json:"owner_id"` OwnerAddress string `json:"owner_address"` OwnerName string `json:"owner_name"` @@ -9602,7 +10214,9 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { Symbol *UpgradedGiftSymbol `json:"symbol"` Backdrop *UpgradedGiftBackdrop `json:"backdrop"` OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` - ResaleStarCount int64 `json:"resale_star_count"` + ResaleParameters *GiftResaleParameters `json:"resale_parameters"` + ValueCurrency string `json:"value_currency"` + ValueAmount int64 `json:"value_amount"` } err := json.Unmarshal(data, &tmp) @@ -9611,12 +10225,16 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { } upgradedGift.Id = tmp.Id + upgradedGift.RegularGiftId = tmp.RegularGiftId upgradedGift.PublisherChatId = tmp.PublisherChatId upgradedGift.Title = tmp.Title upgradedGift.Name = tmp.Name upgradedGift.Number = tmp.Number upgradedGift.TotalUpgradedCount = tmp.TotalUpgradedCount upgradedGift.MaxUpgradedCount = tmp.MaxUpgradedCount + upgradedGift.IsPremium = tmp.IsPremium + upgradedGift.IsThemeAvailable = tmp.IsThemeAvailable + upgradedGift.UsedThemeChatId = tmp.UsedThemeChatId upgradedGift.OwnerAddress = tmp.OwnerAddress upgradedGift.OwnerName = tmp.OwnerName upgradedGift.GiftAddress = tmp.GiftAddress @@ -9624,7 +10242,9 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { upgradedGift.Symbol = tmp.Symbol upgradedGift.Backdrop = tmp.Backdrop upgradedGift.OriginalDetails = tmp.OriginalDetails - upgradedGift.ResaleStarCount = tmp.ResaleStarCount + upgradedGift.ResaleParameters = tmp.ResaleParameters + upgradedGift.ValueCurrency = tmp.ValueCurrency + upgradedGift.ValueAmount = tmp.ValueAmount fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) upgradedGift.OwnerId = fieldOwnerId @@ -9632,6 +10252,55 @@ func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { return nil } +// Contains information about value of an upgraded gift +type UpgradedGiftValueInfo struct { + meta + // ISO 4217 currency code of the currency in which the prices are represented + Currency string `json:"currency"` + // Estimated value of the gift; in the smallest units of the currency + Value int64 `json:"value"` + // True, if the value is calculated as average value of similar sold gifts. Otherwise, it is based on the sale price of the gift + IsValueAverage bool `json:"is_value_average"` + // Point in time (Unix timestamp) when the corresponding regular gift was originally purchased + InitialSaleDate int32 `json:"initial_sale_date"` + // Amount of Telegram Stars that were paid for the gift + InitialSaleStarCount int64 `json:"initial_sale_star_count"` + // Initial price of the gift; in the smallest units of the currency + InitialSalePrice int64 `json:"initial_sale_price"` + // Point in time (Unix timestamp) when the upgraded gift was purchased last time; 0 if never + LastSaleDate int32 `json:"last_sale_date"` + // Last purchase price of the gift; in the smallest units of the currency; 0 if the gift has never been resold + LastSalePrice int64 `json:"last_sale_price"` + // True, if the last sale was completed on Fragment + IsLastSaleOnFragment bool `json:"is_last_sale_on_fragment"` + // The current minimum price of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there are no such gifts + MinimumPrice int64 `json:"minimum_price"` + // The average sale price in the last month of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there were no such sales + AverageSalePrice int64 `json:"average_sale_price"` + // Number of gifts upgraded from the same gift being resold on Telegram + TelegramListedGiftCount int32 `json:"telegram_listed_gift_count"` + // Number of gifts upgraded from the same gift being resold on Fragment + FragmentListedGiftCount int32 `json:"fragment_listed_gift_count"` + // The HTTPS link to the Fragment for the gift; may be empty if there are no such gifts being sold on Fragment + FragmentUrl string `json:"fragment_url"` +} + +func (entity *UpgradedGiftValueInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftValueInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftValueInfo) GetClass() string { + return ClassUpgradedGiftValueInfo +} + +func (*UpgradedGiftValueInfo) GetType() string { + return TypeUpgradedGiftValueInfo +} + // Contains result of gift upgrading type UpgradeGiftResult struct { meta @@ -9645,11 +10314,11 @@ type UpgradeGiftResult struct { CanBeTransferred bool `json:"can_be_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible NextTransferDate int32 `json:"next_transfer_date"` - // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift NextResaleDate int32 `json:"next_resale_date"` - // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past ExportDate int32 `json:"export_date"` } @@ -9676,7 +10345,7 @@ type AvailableGift struct { Gift *Gift `json:"gift"` // Number of gifts that are available for resale ResaleCount int32 `json:"resale_count"` - // The minimum price for the gifts available for resale; 0 if there are no such gifts + // The minimum price for the gifts available for resale in Telegram Star equivalent; 0 if there are no such gifts MinResaleStarCount int64 `json:"min_resale_star_count"` // The title of the upgraded gift; empty if the gift isn't available for resale Title string `json:"title"` @@ -10010,6 +10679,74 @@ func (*GiftsForResale) GetType() string { return TypeGiftsForResale } +// Operation was successfully completed +type GiftResaleResultOk struct{ + meta +} + +func (entity *GiftResaleResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleResultOk) GetClass() string { + return ClassGiftResaleResult +} + +func (*GiftResaleResultOk) GetType() string { + return TypeGiftResaleResultOk +} + +func (*GiftResaleResultOk) GiftResaleResultType() string { + return TypeGiftResaleResultOk +} + +// Operation has failed, because price has increased. If the price has decreased, then the buying will succeed anyway +type GiftResaleResultPriceIncreased struct { + meta + // New price for the gift + Price GiftResalePrice `json:"price"` +} + +func (entity *GiftResaleResultPriceIncreased) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleResultPriceIncreased + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleResultPriceIncreased) GetClass() string { + return ClassGiftResaleResult +} + +func (*GiftResaleResultPriceIncreased) GetType() string { + return TypeGiftResaleResultPriceIncreased +} + +func (*GiftResaleResultPriceIncreased) GiftResaleResultType() string { + return TypeGiftResaleResultPriceIncreased +} + +func (giftResaleResultPriceIncreased *GiftResaleResultPriceIncreased) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + giftResaleResultPriceIncreased.Price = fieldPrice + + return nil +} + // Regular gift type SentGiftRegular struct { meta @@ -10089,18 +10826,24 @@ type ReceivedGift struct { Date int32 `json:"date"` // The gift Gift SentGift `json:"gift"` + // Identifiers of collections to which the gift is added; only for the receiver of the gift + CollectionIds []int32 `json:"collection_ids"` // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user SellStarCount int64 `json:"sell_star_count"` // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + // True, if the upgrade was bought after the gift was sent. In this case, prepaid upgrade cost must not be added to the gift cost + IsUpgradeSeparate bool `json:"is_upgrade_separate"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift NextTransferDate int32 `json:"next_transfer_date"` - // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift NextResaleDate int32 `json:"next_resale_date"` - // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` + // If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } func (entity *ReceivedGift) MarshalJSON() ([]byte, error) { @@ -10132,12 +10875,15 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { WasRefunded bool `json:"was_refunded"` Date int32 `json:"date"` Gift json.RawMessage `json:"gift"` + CollectionIds []int32 `json:"collection_ids"` SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + IsUpgradeSeparate bool `json:"is_upgrade_separate"` TransferStarCount int64 `json:"transfer_star_count"` NextTransferDate int32 `json:"next_transfer_date"` NextResaleDate int32 `json:"next_resale_date"` ExportDate int32 `json:"export_date"` + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } err := json.Unmarshal(data, &tmp) @@ -10154,12 +10900,15 @@ func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { receivedGift.CanBeTransferred = tmp.CanBeTransferred receivedGift.WasRefunded = tmp.WasRefunded receivedGift.Date = tmp.Date + receivedGift.CollectionIds = tmp.CollectionIds receivedGift.SellStarCount = tmp.SellStarCount receivedGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + receivedGift.IsUpgradeSeparate = tmp.IsUpgradeSeparate receivedGift.TransferStarCount = tmp.TransferStarCount receivedGift.NextTransferDate = tmp.NextTransferDate receivedGift.NextResaleDate = tmp.NextResaleDate receivedGift.ExportDate = tmp.ExportDate + receivedGift.PrepaidUpgradeHash = tmp.PrepaidUpgradeHash fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) receivedGift.SenderId = fieldSenderId @@ -11077,6 +11826,54 @@ func (*StarTransactionTypeGiftUpgrade) StarTransactionTypeType() string { return TypeStarTransactionTypeGiftUpgrade } +// The transaction is a purchase of an upgrade of a gift owned by another user or channel; for regular users only +type StarTransactionTypeGiftUpgradePurchase struct { + meta + // Owner of the upgraded gift + OwnerId MessageSender `json:"owner_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftUpgradePurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftUpgradePurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftUpgradePurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftUpgradePurchase) GetType() string { + return TypeStarTransactionTypeGiftUpgradePurchase +} + +func (*StarTransactionTypeGiftUpgradePurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftUpgradePurchase +} + +func (starTransactionTypeGiftUpgradePurchase *StarTransactionTypeGiftUpgradePurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *Gift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftUpgradePurchase.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftUpgradePurchase.OwnerId = fieldOwnerId + + return nil +} + // The transaction is a purchase of an upgraded gift for some user or channel; for regular users only type StarTransactionTypeUpgradedGiftPurchase struct { meta @@ -11113,8 +11910,10 @@ type StarTransactionTypeUpgradedGiftSale struct { UserId int64 `json:"user_id"` // The gift Gift *UpgradedGift `json:"gift"` - // Information about commission received by Telegram from the transaction - Affiliate *AffiliateInfo `json:"affiliate"` + // The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars received by the seller of the gift + CommissionPerMille int32 `json:"commission_per_mille"` + // The amount of Telegram Stars that were received by Telegram; can be negative for refunds + CommissionStarAmount *StarAmount `json:"commission_star_amount"` } func (entity *StarTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { @@ -11448,6 +12247,31 @@ func (*StarTransactionTypeBusinessBotTransferReceive) StarTransactionTypeType() return TypeStarTransactionTypeBusinessBotTransferReceive } +// The transaction is a payment for search of posts in public Telegram channels; for regular users only +type StarTransactionTypePublicPostSearch struct{ + meta +} + +func (entity *StarTransactionTypePublicPostSearch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePublicPostSearch + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePublicPostSearch) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePublicPostSearch) GetType() string { + return TypeStarTransactionTypePublicPostSearch +} + +func (*StarTransactionTypePublicPostSearch) StarTransactionTypeType() string { + return TypeStarTransactionTypePublicPostSearch +} + // The transaction is a transaction of an unsupported type type StarTransactionTypeUnsupported struct{ meta @@ -11612,6 +12436,68 @@ func (*TonTransactionTypeSuggestedPostPayment) TonTransactionTypeType() string { return TypeTonTransactionTypeSuggestedPostPayment } +// The transaction is a purchase of an upgraded gift for some user or channel; for regular users only +type TonTransactionTypeUpgradedGiftPurchase struct { + meta + // Identifier of the user that sold the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *TonTransactionTypeUpgradedGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUpgradedGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUpgradedGiftPurchase) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUpgradedGiftPurchase) GetType() string { + return TypeTonTransactionTypeUpgradedGiftPurchase +} + +func (*TonTransactionTypeUpgradedGiftPurchase) TonTransactionTypeType() string { + return TypeTonTransactionTypeUpgradedGiftPurchase +} + +// The transaction is a sale of an upgraded gift; for regular users only +type TonTransactionTypeUpgradedGiftSale struct { + meta + // Identifier of the user that bought the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` + // The number of Toncoins received by the Telegram for each 1000 Toncoins received by the seller of the gift + CommissionPerMille int32 `json:"commission_per_mille"` + // The amount of Toncoins that were received by the Telegram; in the smallest units of the currency + CommissionToncoinAmount int64 `json:"commission_toncoin_amount"` +} + +func (entity *TonTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUpgradedGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUpgradedGiftSale) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUpgradedGiftSale) GetType() string { + return TypeTonTransactionTypeUpgradedGiftSale +} + +func (*TonTransactionTypeUpgradedGiftSale) TonTransactionTypeType() string { + return TypeTonTransactionTypeUpgradedGiftSale +} + // The transaction is a transaction of an unsupported type type TonTransactionTypeUnsupported struct{ meta @@ -12087,6 +12973,62 @@ func (*ProfileAccentColor) GetType() string { return TypeProfileAccentColor } +// Contains description of user rating +type UserRating struct { + meta + // The level of the user; may be negative + Level int32 `json:"level"` + // True, if the maximum level is reached + IsMaximumLevelReached bool `json:"is_maximum_level_reached"` + // Numerical value of the rating + Rating int64 `json:"rating"` + // The rating required for the current level + CurrentLevelRating int64 `json:"current_level_rating"` + // The rating required for the next level; 0 if the maximum level is reached + NextLevelRating int64 `json:"next_level_rating"` +} + +func (entity *UserRating) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserRating + + return json.Marshal((*stub)(entity)) +} + +func (*UserRating) GetClass() string { + return ClassUserRating +} + +func (*UserRating) GetType() string { + return TypeUserRating +} + +// Contains information about restrictions that must be applied to a chat or a message +type RestrictionInfo struct { + meta + // A human-readable description of the reason why access to the content must be restricted. If empty, then the content can be accessed, but may be covered by hidden with 18+ spoiler anyway + RestrictionReason string `json:"restriction_reason"` + // True, if media content of the messages must be hidden with 18+ spoiler. Use value of the option "can_ignore_sensitive_content_restrictions" to check whether the current user can ignore the restriction. If age verification parameters were received in updateAgeVerificationParameters, then the user must complete age verification to ignore the restriction. Set the option "ignore_sensitive_content_restrictions" to true if the user passes age verification + HasSensitiveContent bool `json:"has_sensitive_content"` +} + +func (entity *RestrictionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RestrictionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*RestrictionInfo) GetClass() string { + return ClassRestrictionInfo +} + +func (*RestrictionInfo) GetType() string { + return TypeRestrictionInfo +} + // A custom emoji set as emoji status type EmojiStatusTypeCustomEmoji struct { meta @@ -12309,8 +13251,8 @@ type User struct { IsPremium bool `json:"is_premium"` // True, if the user is Telegram support account IsSupport bool `json:"is_support"` - // If non-empty, it contains a human-readable description of the reason why access to this user must be restricted - RestrictionReason string `json:"restriction_reason"` + // Information about restrictions that must be applied to the corresponding private chat; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` // True, if the user has non-expired stories available to the current user HasActiveStories bool `json:"has_active_stories"` // True, if the user has unread non-expired stories available to the current user @@ -12366,7 +13308,7 @@ func (user *User) UnmarshalJSON(data []byte) error { VerificationStatus *VerificationStatus `json:"verification_status"` IsPremium bool `json:"is_premium"` IsSupport bool `json:"is_support"` - RestrictionReason string `json:"restriction_reason"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` RestrictsNewChats bool `json:"restricts_new_chats"` @@ -12400,7 +13342,7 @@ func (user *User) UnmarshalJSON(data []byte) error { user.VerificationStatus = tmp.VerificationStatus user.IsPremium = tmp.IsPremium user.IsSupport = tmp.IsSupport - user.RestrictionReason = tmp.RestrictionReason + user.RestrictionInfo = tmp.RestrictionInfo user.HasActiveStories = tmp.HasActiveStories user.HasUnreadActiveStories = tmp.HasUnreadActiveStories user.RestrictsNewChats = tmp.RestrictsNewChats @@ -12595,6 +13537,16 @@ type UserFullInfo struct { GiftSettings *GiftSettings `json:"gift_settings"` // Information about verification status of the user provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` + // The main tab chosen by the user; may be null if not chosen manually + MainProfileTab ProfileTab `json:"main_profile_tab"` + // The first audio file added to the user's profile; may be null if none + FirstProfileAudio *Audio `json:"first_profile_audio"` + // The current rating of the user; may be null if none + Rating *UserRating `json:"rating"` + // The rating of the user after the next change; may be null if the user isn't the current user or there are no pending rating changes + PendingRating *UserRating `json:"pending_rating"` + // Unix timestamp when rating of the user will change to pending_rating; 0 if the user isn't the current user or there are no pending rating changes + PendingRatingDate int32 `json:"pending_rating_date"` // Information about business settings for Telegram Business accounts; may be null if none BusinessInfo *BusinessInfo `json:"business_info"` // For bots, information about the bot; may be null if the user isn't a bot @@ -12641,6 +13593,11 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` GiftSettings *GiftSettings `json:"gift_settings"` BotVerification *BotVerification `json:"bot_verification"` + MainProfileTab json.RawMessage `json:"main_profile_tab"` + FirstProfileAudio *Audio `json:"first_profile_audio"` + Rating *UserRating `json:"rating"` + PendingRating *UserRating `json:"pending_rating"` + PendingRatingDate int32 `json:"pending_rating_date"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` } @@ -12671,12 +13628,19 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount userFullInfo.GiftSettings = tmp.GiftSettings userFullInfo.BotVerification = tmp.BotVerification + userFullInfo.FirstProfileAudio = tmp.FirstProfileAudio + userFullInfo.Rating = tmp.Rating + userFullInfo.PendingRating = tmp.PendingRating + userFullInfo.PendingRatingDate = tmp.PendingRatingDate userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) userFullInfo.BlockList = fieldBlockList + fieldMainProfileTab, _ := UnmarshalProfileTab(tmp.MainProfileTab) + userFullInfo.MainProfileTab = fieldMainProfileTab + return nil } @@ -14007,10 +14971,8 @@ type Supergroup struct { HasDirectMessagesGroup bool `json:"has_direct_messages_group"` // True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups HasForumTabs bool `json:"has_forum_tabs"` - // True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler - HasSensitiveContent bool `json:"has_sensitive_content"` - // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted - RestrictionReason string `json:"restriction_reason"` + // Information about the restrictions that must be applied to the corresponding supergroup or channel chat; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` // Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message PaidMessageStarCount int64 `json:"paid_message_star_count"` // True, if the supergroup or channel has non-expired stories available to the current user @@ -14060,8 +15022,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { VerificationStatus *VerificationStatus `json:"verification_status"` HasDirectMessagesGroup bool `json:"has_direct_messages_group"` HasForumTabs bool `json:"has_forum_tabs"` - HasSensitiveContent bool `json:"has_sensitive_content"` - RestrictionReason string `json:"restriction_reason"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` PaidMessageStarCount int64 `json:"paid_message_star_count"` HasActiveStories bool `json:"has_active_stories"` HasUnreadActiveStories bool `json:"has_unread_active_stories"` @@ -14094,8 +15055,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.VerificationStatus = tmp.VerificationStatus supergroup.HasDirectMessagesGroup = tmp.HasDirectMessagesGroup supergroup.HasForumTabs = tmp.HasForumTabs - supergroup.HasSensitiveContent = tmp.HasSensitiveContent - supergroup.RestrictionReason = tmp.RestrictionReason + supergroup.RestrictionInfo = tmp.RestrictionInfo supergroup.PaidMessageStarCount = tmp.PaidMessageStarCount supergroup.HasActiveStories = tmp.HasActiveStories supergroup.HasUnreadActiveStories = tmp.HasUnreadActiveStories @@ -14183,6 +15143,8 @@ type SupergroupFullInfo struct { BotCommands []*BotCommands `json:"bot_commands"` // Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown BotVerification *BotVerification `json:"bot_verification"` + // The main tab chosen by the administrators of the channel; may be null if not chosen manually + MainProfileTab ProfileTab `json:"main_profile_tab"` // Identifier of the basic group from which supergroup was upgraded; 0 if none UpgradedFromBasicGroupId int64 `json:"upgraded_from_basic_group_id"` // Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none @@ -14205,6 +15167,101 @@ func (*SupergroupFullInfo) GetType() string { return TypeSupergroupFullInfo } +func (supergroupFullInfo *SupergroupFullInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Photo *ChatPhoto `json:"photo"` + Description string `json:"description"` + MemberCount int32 `json:"member_count"` + AdministratorCount int32 `json:"administrator_count"` + RestrictedCount int32 `json:"restricted_count"` + BannedCount int32 `json:"banned_count"` + LinkedChatId int64 `json:"linked_chat_id"` + DirectMessagesChatId int64 `json:"direct_messages_chat_id"` + SlowModeDelay int32 `json:"slow_mode_delay"` + SlowModeDelayExpiresIn float64 `json:"slow_mode_delay_expires_in"` + CanEnablePaidMessages bool `json:"can_enable_paid_messages"` + CanEnablePaidReaction bool `json:"can_enable_paid_reaction"` + CanGetMembers bool `json:"can_get_members"` + HasHiddenMembers bool `json:"has_hidden_members"` + CanHideMembers bool `json:"can_hide_members"` + CanSetStickerSet bool `json:"can_set_sticker_set"` + CanSetLocation bool `json:"can_set_location"` + CanGetStatistics bool `json:"can_get_statistics"` + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + CanGetStarRevenueStatistics bool `json:"can_get_star_revenue_statistics"` + CanSendGift bool `json:"can_send_gift"` + CanToggleAggressiveAntiSpam bool `json:"can_toggle_aggressive_anti_spam"` + IsAllHistoryAvailable bool `json:"is_all_history_available"` + CanHaveSponsoredMessages bool `json:"can_have_sponsored_messages"` + HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled"` + HasPaidMediaAllowed bool `json:"has_paid_media_allowed"` + HasPinnedStories bool `json:"has_pinned_stories"` + GiftCount int32 `json:"gift_count"` + MyBoostCount int32 `json:"my_boost_count"` + UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + StickerSetId JsonInt64 `json:"sticker_set_id"` + CustomEmojiStickerSetId JsonInt64 `json:"custom_emoji_sticker_set_id"` + Location *ChatLocation `json:"location"` + InviteLink *ChatInviteLink `json:"invite_link"` + BotCommands []*BotCommands `json:"bot_commands"` + BotVerification *BotVerification `json:"bot_verification"` + MainProfileTab json.RawMessage `json:"main_profile_tab"` + UpgradedFromBasicGroupId int64 `json:"upgraded_from_basic_group_id"` + UpgradedFromMaxMessageId int64 `json:"upgraded_from_max_message_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + supergroupFullInfo.Photo = tmp.Photo + supergroupFullInfo.Description = tmp.Description + supergroupFullInfo.MemberCount = tmp.MemberCount + supergroupFullInfo.AdministratorCount = tmp.AdministratorCount + supergroupFullInfo.RestrictedCount = tmp.RestrictedCount + supergroupFullInfo.BannedCount = tmp.BannedCount + supergroupFullInfo.LinkedChatId = tmp.LinkedChatId + supergroupFullInfo.DirectMessagesChatId = tmp.DirectMessagesChatId + supergroupFullInfo.SlowModeDelay = tmp.SlowModeDelay + supergroupFullInfo.SlowModeDelayExpiresIn = tmp.SlowModeDelayExpiresIn + supergroupFullInfo.CanEnablePaidMessages = tmp.CanEnablePaidMessages + supergroupFullInfo.CanEnablePaidReaction = tmp.CanEnablePaidReaction + supergroupFullInfo.CanGetMembers = tmp.CanGetMembers + supergroupFullInfo.HasHiddenMembers = tmp.HasHiddenMembers + supergroupFullInfo.CanHideMembers = tmp.CanHideMembers + supergroupFullInfo.CanSetStickerSet = tmp.CanSetStickerSet + supergroupFullInfo.CanSetLocation = tmp.CanSetLocation + supergroupFullInfo.CanGetStatistics = tmp.CanGetStatistics + supergroupFullInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics + supergroupFullInfo.CanGetStarRevenueStatistics = tmp.CanGetStarRevenueStatistics + supergroupFullInfo.CanSendGift = tmp.CanSendGift + supergroupFullInfo.CanToggleAggressiveAntiSpam = tmp.CanToggleAggressiveAntiSpam + supergroupFullInfo.IsAllHistoryAvailable = tmp.IsAllHistoryAvailable + supergroupFullInfo.CanHaveSponsoredMessages = tmp.CanHaveSponsoredMessages + supergroupFullInfo.HasAggressiveAntiSpamEnabled = tmp.HasAggressiveAntiSpamEnabled + supergroupFullInfo.HasPaidMediaAllowed = tmp.HasPaidMediaAllowed + supergroupFullInfo.HasPinnedStories = tmp.HasPinnedStories + supergroupFullInfo.GiftCount = tmp.GiftCount + supergroupFullInfo.MyBoostCount = tmp.MyBoostCount + supergroupFullInfo.UnrestrictBoostCount = tmp.UnrestrictBoostCount + supergroupFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount + supergroupFullInfo.StickerSetId = tmp.StickerSetId + supergroupFullInfo.CustomEmojiStickerSetId = tmp.CustomEmojiStickerSetId + supergroupFullInfo.Location = tmp.Location + supergroupFullInfo.InviteLink = tmp.InviteLink + supergroupFullInfo.BotCommands = tmp.BotCommands + supergroupFullInfo.BotVerification = tmp.BotVerification + supergroupFullInfo.UpgradedFromBasicGroupId = tmp.UpgradedFromBasicGroupId + supergroupFullInfo.UpgradedFromMaxMessageId = tmp.UpgradedFromMaxMessageId + + fieldMainProfileTab, _ := UnmarshalProfileTab(tmp.MainProfileTab) + supergroupFullInfo.MainProfileTab = fieldMainProfileTab + + return nil +} + // The secret chat is not yet created; waiting for the other user to get online type SecretChatStatePending struct{ meta @@ -14340,6 +15397,37 @@ func (secretChat *SecretChat) UnmarshalJSON(data []byte) error { return nil } +// Contains information about public post search limits +type PublicPostSearchLimits struct { + meta + // Number of queries that can be sent daily for free + DailyFreeQueryCount int32 `json:"daily_free_query_count"` + // Number of remaining free queries today + RemainingFreeQueryCount int32 `json:"remaining_free_query_count"` + // Amount of time till the next free query can be sent; 0 if it can be sent now + NextFreeQueryIn int32 `json:"next_free_query_in"` + // Number of Telegram Stars that must be paid for each non-free query + StarCount JsonInt64 `json:"star_count"` + // True, if the search for the specified query isn't charged + IsCurrentQueryFree bool `json:"is_current_query_free"` +} + +func (entity *PublicPostSearchLimits) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicPostSearchLimits + + return json.Marshal((*stub)(entity)) +} + +func (*PublicPostSearchLimits) GetClass() string { + return ClassPublicPostSearchLimits +} + +func (*PublicPostSearchLimits) GetType() string { + return TypePublicPostSearchLimits +} + // The message was sent by a known user type MessageSenderUser struct { meta @@ -15968,10 +17056,8 @@ type Message struct { MediaAlbumId JsonInt64 `json:"media_album_id"` // Unique identifier of the effect added to the message; 0 if none EffectId JsonInt64 `json:"effect_id"` - // True, if media content of the message must be hidden with 18+ spoiler - HasSensitiveContent bool `json:"has_sensitive_content"` - // If non-empty, contains a human-readable description of the reason why access to this message must be restricted - RestrictionReason string `json:"restriction_reason"` + // Information about the restrictions that must be applied to the message content; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` // Content of the message Content MessageContent `json:"content"` // Reply markup for the message; may be null if none @@ -16031,8 +17117,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` EffectId JsonInt64 `json:"effect_id"` - HasSensitiveContent bool `json:"has_sensitive_content"` - RestrictionReason string `json:"restriction_reason"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` Content json.RawMessage `json:"content"` ReplyMarkup json.RawMessage `json:"reply_markup"` } @@ -16071,8 +17156,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId message.EffectId = tmp.EffectId - message.HasSensitiveContent = tmp.HasSensitiveContent - message.RestrictionReason = tmp.RestrictionReason + message.RestrictionInfo = tmp.RestrictionInfo fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) message.SenderId = fieldSenderId @@ -16180,6 +17264,35 @@ func (*FoundChatMessages) GetType() string { return TypeFoundChatMessages } +// Contains a list of messages found by a public post search +type FoundPublicPosts struct { + meta + // List of found public posts + Messages []*Message `json:"messages"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` + // Updated public post search limits after the query; repeated requests with the same query will be free; may be null if they didn't change + SearchLimits *PublicPostSearchLimits `json:"search_limits"` + // True, if the query has failed because search limits are exceeded. In this case search_limits.daily_free_query_count will be equal to 0 + AreLimitsExceeded bool `json:"are_limits_exceeded"` +} + +func (entity *FoundPublicPosts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundPublicPosts + + return json.Marshal((*stub)(entity)) +} + +func (*FoundPublicPosts) GetClass() string { + return ClassFoundPublicPosts +} + +func (*FoundPublicPosts) GetType() string { + return TypeFoundPublicPosts +} + // Contains information about a message in a specific position type MessagePosition struct { meta @@ -18354,8 +19467,8 @@ type Chat struct { EmojiStatus *EmojiStatus `json:"emoji_status"` // Background set for the chat; may be null if none Background *ChatBackground `json:"background"` - // If non-empty, name of a theme, set for the chat - ThemeName string `json:"theme_name"` + // Theme set for the chat; may be null if none + Theme ChatTheme `json:"theme"` // Information about actions which must be possible to do through the chat action bar; may be null if none ActionBar ChatActionBar `json:"action_bar"` // Information about bar for managing a business bot in the chat; may be null if none @@ -18423,7 +19536,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` EmojiStatus *EmojiStatus `json:"emoji_status"` Background *ChatBackground `json:"background"` - ThemeName string `json:"theme_name"` + Theme json.RawMessage `json:"theme"` ActionBar json.RawMessage `json:"action_bar"` BusinessBotManageBar *BusinessBotManageBar `json:"business_bot_manage_bar"` VideoChat *VideoChat `json:"video_chat"` @@ -18466,7 +19579,6 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.MessageAutoDeleteTime = tmp.MessageAutoDeleteTime chat.EmojiStatus = tmp.EmojiStatus chat.Background = tmp.Background - chat.ThemeName = tmp.ThemeName chat.BusinessBotManageBar = tmp.BusinessBotManageBar chat.VideoChat = tmp.VideoChat chat.PendingJoinRequests = tmp.PendingJoinRequests @@ -18489,6 +19601,9 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { fieldAvailableReactions, _ := UnmarshalChatAvailableReactions(tmp.AvailableReactions) chat.AvailableReactions = fieldAvailableReactions + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + chat.Theme = fieldTheme + fieldActionBar, _ := UnmarshalChatActionBar(tmp.ActionBar) chat.ActionBar = fieldActionBar @@ -20418,14 +21533,141 @@ func (*SharedChat) GetType() string { return TypeSharedChat } +// Classic light theme +type BuiltInThemeClassic struct{ + meta +} + +func (entity *BuiltInThemeClassic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeClassic + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeClassic) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeClassic) GetType() string { + return TypeBuiltInThemeClassic +} + +func (*BuiltInThemeClassic) BuiltInThemeType() string { + return TypeBuiltInThemeClassic +} + +// Regular light theme +type BuiltInThemeDay struct{ + meta +} + +func (entity *BuiltInThemeDay) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeDay + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeDay) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeDay) GetType() string { + return TypeBuiltInThemeDay +} + +func (*BuiltInThemeDay) BuiltInThemeType() string { + return TypeBuiltInThemeDay +} + +// Regular dark theme +type BuiltInThemeNight struct{ + meta +} + +func (entity *BuiltInThemeNight) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeNight + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeNight) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeNight) GetType() string { + return TypeBuiltInThemeNight +} + +func (*BuiltInThemeNight) BuiltInThemeType() string { + return TypeBuiltInThemeNight +} + +// Tinted dark theme +type BuiltInThemeTinted struct{ + meta +} + +func (entity *BuiltInThemeTinted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeTinted + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeTinted) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeTinted) GetType() string { + return TypeBuiltInThemeTinted +} + +func (*BuiltInThemeTinted) BuiltInThemeType() string { + return TypeBuiltInThemeTinted +} + +// Arctic light theme +type BuiltInThemeArctic struct{ + meta +} + +func (entity *BuiltInThemeArctic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeArctic + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeArctic) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeArctic) GetType() string { + return TypeBuiltInThemeArctic +} + +func (*BuiltInThemeArctic) BuiltInThemeType() string { + return TypeBuiltInThemeArctic +} + // Describes theme settings type ThemeSettings struct { meta + // Base theme for this theme + BaseTheme BuiltInTheme `json:"base_theme"` // Theme accent color in ARGB format AccentColor int32 `json:"accent_color"` // The background to be used in chats; may be null Background *Background `json:"background"` - // The fill to be used as a background for outgoing messages + // The fill to be used as a background for outgoing messages; may be null if the fill from the base theme must be used instead OutgoingMessageFill BackgroundFill `json:"outgoing_message_fill"` // If true, the freeform gradient fill needs to be animated on every sent message AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` @@ -20451,6 +21693,7 @@ func (*ThemeSettings) GetType() string { func (themeSettings *ThemeSettings) UnmarshalJSON(data []byte) error { var tmp struct { + BaseTheme json.RawMessage `json:"base_theme"` AccentColor int32 `json:"accent_color"` Background *Background `json:"background"` OutgoingMessageFill json.RawMessage `json:"outgoing_message_fill"` @@ -20468,6 +21711,9 @@ func (themeSettings *ThemeSettings) UnmarshalJSON(data []byte) error { themeSettings.AnimateOutgoingMessageFill = tmp.AnimateOutgoingMessageFill themeSettings.OutgoingMessageAccentColor = tmp.OutgoingMessageAccentColor + fieldBaseTheme, _ := UnmarshalBuiltInTheme(tmp.BaseTheme) + themeSettings.BaseTheme = fieldBaseTheme + fieldOutgoingMessageFill, _ := UnmarshalBackgroundFill(tmp.OutgoingMessageFill) themeSettings.OutgoingMessageFill = fieldOutgoingMessageFill @@ -23130,6 +24376,33 @@ func (linkPreviewTypeChat *LinkPreviewTypeChat) UnmarshalJSON(data []byte) error return nil } +// The link is a link to a direct messages chat of a channel +type LinkPreviewTypeDirectMessagesChat struct { + meta + // Photo of the channel chat; may be null + Photo *ChatPhoto `json:"photo"` +} + +func (entity *LinkPreviewTypeDirectMessagesChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeDirectMessagesChat + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeDirectMessagesChat) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeDirectMessagesChat) GetType() string { + return TypeLinkPreviewTypeDirectMessagesChat +} + +func (*LinkPreviewTypeDirectMessagesChat) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeDirectMessagesChat +} + // The link is a link to a general file type LinkPreviewTypeDocument struct { meta @@ -23328,6 +24601,33 @@ func (*LinkPreviewTypeExternalVideo) LinkPreviewTypeType() string { return TypeLinkPreviewTypeExternalVideo } +// The link is a link to a gift collection +type LinkPreviewTypeGiftCollection struct { + meta + // Icons for some gifts from the collection; may be empty + Icons []*Sticker `json:"icons"` +} + +func (entity *LinkPreviewTypeGiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeGiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeGiftCollection) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeGiftCollection) GetType() string { + return TypeLinkPreviewTypeGiftCollection +} + +func (*LinkPreviewTypeGiftCollection) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeGiftCollection +} + // The link is a link to a group call that isn't bound to a chat type LinkPreviewTypeGroupCall struct{ meta @@ -23563,6 +24863,35 @@ func (*LinkPreviewTypeStory) LinkPreviewTypeType() string { return TypeLinkPreviewTypeStory } +// The link is a link to an album of stories +type LinkPreviewTypeStoryAlbum struct { + meta + // Icon of the album; may be null if none + PhotoIcon *Photo `json:"photo_icon"` + // Video icon of the album; may be null if none + VideoIcon *Video `json:"video_icon"` +} + +func (entity *LinkPreviewTypeStoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeStoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeStoryAlbum) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeStoryAlbum) GetType() string { + return TypeLinkPreviewTypeStoryAlbum +} + +func (*LinkPreviewTypeStoryAlbum) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeStoryAlbum +} + // The link is a link to boost a supergroup chat type LinkPreviewTypeSupergroupBoost struct { meta @@ -28761,8 +30090,8 @@ func (*MessageChatSetBackground) MessageContentType() string { // A theme in the chat has been changed type MessageChatSetTheme struct { meta - // If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset to the default one - ThemeName string `json:"theme_name"` + // New theme for the chat; may be null if chat theme was reset to the default one + Theme ChatTheme `json:"theme"` } func (entity *MessageChatSetTheme) MarshalJSON() ([]byte, error) { @@ -28785,6 +30114,22 @@ func (*MessageChatSetTheme) MessageContentType() string { return TypeMessageChatSetTheme } +func (messageChatSetTheme *MessageChatSetTheme) UnmarshalJSON(data []byte) error { + var tmp struct { + Theme json.RawMessage `json:"theme"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + messageChatSetTheme.Theme = fieldTheme + + return nil +} + // The auto-delete or self-destruct timer for messages in the chat has been changed type MessageChatSetMessageAutoDeleteTime struct { meta @@ -29637,7 +30982,7 @@ type MessageGift struct { meta // The gift Gift *Gift `json:"gift"` - // Sender of the gift + // Sender of the gift; may be null for outgoing messages about prepaid upgrade of gifts from unknown users SenderId MessageSender `json:"sender_id"` // Receiver of the gift ReceiverId MessageSender `json:"receiver_id"` @@ -29649,10 +30994,14 @@ type MessageGift struct { SellStarCount int64 `json:"sell_star_count"` // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + // True, if the upgrade was bought after the gift was sent. In this case, prepaid upgrade cost must not be added to the gift cost + IsUpgradeSeparate bool `json:"is_upgrade_separate"` // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them IsPrivate bool `json:"is_private"` // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift IsSaved bool `json:"is_saved"` + // True, if the message is about prepaid upgrade of the gift by another user + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` // True, if the gift can be upgraded to a unique gift; only for the receiver of the gift CanBeUpgraded bool `json:"can_be_upgraded"` // True, if the gift was converted to Telegram Stars; only for the receiver of the gift @@ -29663,6 +31012,8 @@ type MessageGift struct { WasRefunded bool `json:"was_refunded"` // Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` + // If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } func (entity *MessageGift) MarshalJSON() ([]byte, error) { @@ -29694,13 +31045,16 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { Text *FormattedText `json:"text"` SellStarCount int64 `json:"sell_star_count"` PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + IsUpgradeSeparate bool `json:"is_upgrade_separate"` IsPrivate bool `json:"is_private"` IsSaved bool `json:"is_saved"` + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` CanBeUpgraded bool `json:"can_be_upgraded"` WasConverted bool `json:"was_converted"` WasUpgraded bool `json:"was_upgraded"` WasRefunded bool `json:"was_refunded"` UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` } err := json.Unmarshal(data, &tmp) @@ -29713,13 +31067,16 @@ func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { messageGift.Text = tmp.Text messageGift.SellStarCount = tmp.SellStarCount messageGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + messageGift.IsUpgradeSeparate = tmp.IsUpgradeSeparate messageGift.IsPrivate = tmp.IsPrivate messageGift.IsSaved = tmp.IsSaved + messageGift.IsPrepaidUpgrade = tmp.IsPrepaidUpgrade messageGift.CanBeUpgraded = tmp.CanBeUpgraded messageGift.WasConverted = tmp.WasConverted messageGift.WasUpgraded = tmp.WasUpgraded messageGift.WasRefunded = tmp.WasRefunded messageGift.UpgradedReceivedGiftId = tmp.UpgradedReceivedGiftId + messageGift.PrepaidUpgradeHash = tmp.PrepaidUpgradeHash fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageGift.SenderId = fieldSenderId @@ -29751,11 +31108,11 @@ type MessageUpgradedGift struct { WasTransferred bool `json:"was_transferred"` // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift TransferStarCount int64 `json:"transfer_star_count"` - // Point in time (Unix timestamp) when the gift can be transferred to another owner; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift NextTransferDate int32 `json:"next_transfer_date"` - // Point in time (Unix timestamp) when the gift can be resold to another user; 0 if the gift can't be resold; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift NextResaleDate int32 `json:"next_resale_date"` - // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift ExportDate int32 `json:"export_date"` } @@ -29831,8 +31188,8 @@ type MessageRefundedUpgradedGift struct { SenderId MessageSender `json:"sender_id"` // Receiver of the gift ReceiverId MessageSender `json:"receiver_id"` - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift - IsUpgrade bool `json:"is_upgrade"` + // Origin of the upgraded gift + Origin UpgradedGiftOrigin `json:"origin"` } func (entity *MessageRefundedUpgradedGift) MarshalJSON() ([]byte, error) { @@ -29860,7 +31217,7 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da Gift *Gift `json:"gift"` SenderId json.RawMessage `json:"sender_id"` ReceiverId json.RawMessage `json:"receiver_id"` - IsUpgrade bool `json:"is_upgrade"` + Origin json.RawMessage `json:"origin"` } err := json.Unmarshal(data, &tmp) @@ -29869,7 +31226,6 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da } messageRefundedUpgradedGift.Gift = tmp.Gift - messageRefundedUpgradedGift.IsUpgrade = tmp.IsUpgrade fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) messageRefundedUpgradedGift.SenderId = fieldSenderId @@ -29877,6 +31233,9 @@ func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(da fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) messageRefundedUpgradedGift.ReceiverId = fieldReceiverId + fieldOrigin, _ := UnmarshalUpgradedGiftOrigin(tmp.Origin) + messageRefundedUpgradedGift.Origin = fieldOrigin + return nil } @@ -35319,6 +36678,8 @@ type Story struct { IsPostedToChatPage bool `json:"is_posted_to_chat_page"` // True, if the story is visible only for the current user IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + // True, if the story can be added to an album + CanBeAddedToAlbum bool `json:"can_be_added_to_album"` // True, if the story can be deleted CanBeDeleted bool `json:"can_be_deleted"` // True, if the story can be edited @@ -35349,6 +36710,8 @@ type Story struct { Areas []*StoryArea `json:"areas"` // Caption of the story Caption *FormattedText `json:"caption"` + // Identifiers of story albums to which the story is added; only for manageable stories + AlbumIds []int32 `json:"album_ids"` } func (entity *Story) MarshalJSON() ([]byte, error) { @@ -35378,6 +36741,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { IsEdited bool `json:"is_edited"` IsPostedToChatPage bool `json:"is_posted_to_chat_page"` IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + CanBeAddedToAlbum bool `json:"can_be_added_to_album"` CanBeDeleted bool `json:"can_be_deleted"` CanBeEdited bool `json:"can_be_edited"` CanBeForwarded bool `json:"can_be_forwarded"` @@ -35393,6 +36757,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { Content json.RawMessage `json:"content"` Areas []*StoryArea `json:"areas"` Caption *FormattedText `json:"caption"` + AlbumIds []int32 `json:"album_ids"` } err := json.Unmarshal(data, &tmp) @@ -35408,6 +36773,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.IsEdited = tmp.IsEdited story.IsPostedToChatPage = tmp.IsPostedToChatPage story.IsVisibleOnlyForSelf = tmp.IsVisibleOnlyForSelf + story.CanBeAddedToAlbum = tmp.CanBeAddedToAlbum story.CanBeDeleted = tmp.CanBeDeleted story.CanBeEdited = tmp.CanBeEdited story.CanBeForwarded = tmp.CanBeForwarded @@ -35420,6 +36786,7 @@ func (story *Story) UnmarshalJSON(data []byte) error { story.InteractionInfo = tmp.InteractionInfo story.Areas = tmp.Areas story.Caption = tmp.Caption + story.AlbumIds = tmp.AlbumIds fieldPosterId, _ := UnmarshalMessageSender(tmp.PosterId) story.PosterId = fieldPosterId @@ -35490,6 +36857,58 @@ func (*FoundStories) GetType() string { return TypeFoundStories } +// Describes album of stories +type StoryAlbum struct { + meta + // Unique identifier of the album + Id int32 `json:"id"` + // Name of the album + Name string `json:"name"` + // Icon of the album; may be null if none + PhotoIcon *Photo `json:"photo_icon"` + // Video icon of the album; may be null if none + VideoIcon *Video `json:"video_icon"` +} + +func (entity *StoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAlbum) GetClass() string { + return ClassStoryAlbum +} + +func (*StoryAlbum) GetType() string { + return TypeStoryAlbum +} + +// Represents a list of story albums +type StoryAlbums struct { + meta + // List of story albums + Albums []*StoryAlbum `json:"albums"` +} + +func (entity *StoryAlbums) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAlbums + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAlbums) GetClass() string { + return ClassStoryAlbums +} + +func (*StoryAlbums) GetType() string { + return TypeStoryAlbums +} + // Contains identifier of a story along with identifier of the chat that posted it type StoryFullId struct { meta @@ -35551,6 +36970,8 @@ type ChatActiveStories struct { List StoryList `json:"list"` // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order Order int64 `json:"order"` + // True, if the stories are shown in the main story list and can be archived; otherwise, the stories can be hidden from the main story list only by calling removeTopChat with topChatCategoryUsers and the chat_id. Stories of the current user can't be archived nor hidden using removeTopChat + CanBeArchived bool `json:"can_be_archived"` // Identifier of the last read active story MaxReadStoryId int32 `json:"max_read_story_id"` // Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) @@ -35578,6 +36999,7 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { ChatId int64 `json:"chat_id"` List json.RawMessage `json:"list"` Order int64 `json:"order"` + CanBeArchived bool `json:"can_be_archived"` MaxReadStoryId int32 `json:"max_read_story_id"` Stories []*StoryInfo `json:"stories"` } @@ -35589,6 +37011,7 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { chatActiveStories.ChatId = tmp.ChatId chatActiveStories.Order = tmp.Order + chatActiveStories.CanBeArchived = tmp.CanBeArchived chatActiveStories.MaxReadStoryId = tmp.MaxReadStoryId chatActiveStories.Stories = tmp.Stories @@ -44983,6 +46406,8 @@ type StorePaymentPurposeStars struct { Amount int64 `json:"amount"` // Number of bought Telegram Stars StarCount int64 `json:"star_count"` + // Identifier of the chat that is supposed to receive the Telegram Stars; pass 0 if none + ChatId int64 `json:"chat_id"` } func (entity *StorePaymentPurposeStars) MarshalJSON() ([]byte, error) { @@ -45212,6 +46637,8 @@ type TelegramPaymentPurposeStars struct { Amount int64 `json:"amount"` // Number of bought Telegram Stars StarCount int64 `json:"star_count"` + // Identifier of the chat that is supposed to receive the Telegram Stars; pass 0 if none + ChatId int64 `json:"chat_id"` } func (entity *TelegramPaymentPurposeStars) MarshalJSON() ([]byte, error) { @@ -45903,10 +47330,10 @@ func (backgroundTypeFill *BackgroundTypeFill) UnmarshalJSON(data []byte) error { return nil } -// A background from a chat theme; can be used only as a chat background in channels +// A background from a chat theme based on an emoji; can be used only as a chat background in channels type BackgroundTypeChatTheme struct { meta - // Name of the chat theme + // Name of the emoji chat theme ThemeName string `json:"theme_name"` } @@ -46027,8 +47454,8 @@ func (*InputBackgroundPrevious) InputBackgroundType() string { return TypeInputBackgroundPrevious } -// Describes a chat theme -type ChatTheme struct { +// Describes a chat theme based on an emoji +type EmojiChatTheme struct { meta // Theme name Name string `json:"name"` @@ -46038,20 +47465,180 @@ type ChatTheme struct { DarkSettings *ThemeSettings `json:"dark_settings"` } -func (entity *ChatTheme) MarshalJSON() ([]byte, error) { +func (entity *EmojiChatTheme) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatTheme + type stub EmojiChatTheme return json.Marshal((*stub)(entity)) } -func (*ChatTheme) GetClass() string { +func (*EmojiChatTheme) GetClass() string { + return ClassEmojiChatTheme +} + +func (*EmojiChatTheme) GetType() string { + return TypeEmojiChatTheme +} + +// Describes a chat theme based on an upgraded gift +type GiftChatTheme struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // Theme settings for a light chat theme + LightSettings *ThemeSettings `json:"light_settings"` + // Theme settings for a dark chat theme + DarkSettings *ThemeSettings `json:"dark_settings"` +} + +func (entity *GiftChatTheme) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftChatTheme + + return json.Marshal((*stub)(entity)) +} + +func (*GiftChatTheme) GetClass() string { + return ClassGiftChatTheme +} + +func (*GiftChatTheme) GetType() string { + return TypeGiftChatTheme +} + +// Contains a list of chat themes based on upgraded gifts +type GiftChatThemes struct { + meta + // A list of chat themes + Themes []*GiftChatTheme `json:"themes"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *GiftChatThemes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftChatThemes + + return json.Marshal((*stub)(entity)) +} + +func (*GiftChatThemes) GetClass() string { + return ClassGiftChatThemes +} + +func (*GiftChatThemes) GetType() string { + return TypeGiftChatThemes +} + +// A chat theme based on an emoji +type ChatThemeEmoji struct { + meta + // Name of the theme; full theme description is received through updateEmojiChatThemes + Name string `json:"name"` +} + +func (entity *ChatThemeEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatThemeEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*ChatThemeEmoji) GetClass() string { return ClassChatTheme } -func (*ChatTheme) GetType() string { - return TypeChatTheme +func (*ChatThemeEmoji) GetType() string { + return TypeChatThemeEmoji +} + +func (*ChatThemeEmoji) ChatThemeType() string { + return TypeChatThemeEmoji +} + +// A chat theme based on an upgraded gift +type ChatThemeGift struct { + meta + // The chat theme + GiftTheme *GiftChatTheme `json:"gift_theme"` +} + +func (entity *ChatThemeGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatThemeGift + + return json.Marshal((*stub)(entity)) +} + +func (*ChatThemeGift) GetClass() string { + return ClassChatTheme +} + +func (*ChatThemeGift) GetType() string { + return TypeChatThemeGift +} + +func (*ChatThemeGift) ChatThemeType() string { + return TypeChatThemeGift +} + +// A theme based on an emoji +type InputChatThemeEmoji struct { + meta + // Name of the theme + Name string `json:"name"` +} + +func (entity *InputChatThemeEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatThemeEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatThemeEmoji) GetClass() string { + return ClassInputChatTheme +} + +func (*InputChatThemeEmoji) GetType() string { + return TypeInputChatThemeEmoji +} + +func (*InputChatThemeEmoji) InputChatThemeType() string { + return TypeInputChatThemeEmoji +} + +// A theme based on an upgraded gift +type InputChatThemeGift struct { + meta + // Name of the upgraded gift. A gift can be used only in one chat in a time. When the same gift is used in another chat, theme in the previous chat is reset to default + Name string `json:"name"` +} + +func (entity *InputChatThemeGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatThemeGift + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatThemeGift) GetClass() string { + return ClassInputChatTheme +} + +func (*InputChatThemeGift) GetType() string { + return TypeInputChatThemeGift +} + +func (*InputChatThemeGift) InputChatThemeType() string { + return TypeInputChatThemeGift } // Describes a time zone @@ -46887,8 +48474,10 @@ func (*PushMessageContentContact) PushMessageContentType() string { } // A contact has registered with Telegram -type PushMessageContentContactRegistered struct{ +type PushMessageContentContactRegistered struct { meta + // True, if the user joined Telegram as a Telegram Premium account + AsPremiumAccount bool `json:"as_premium_account"` } func (entity *PushMessageContentContactRegistered) MarshalJSON() ([]byte, error) { @@ -47235,6 +48824,8 @@ type PushMessageContentGift struct { meta // Number of Telegram Stars that sender paid for the gift StarCount int64 `json:"star_count"` + // True, if the message is about prepaid upgrade of the gift by another user instead of actual receiving of a new gift + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` } func (entity *PushMessageContentGift) MarshalJSON() ([]byte, error) { @@ -47260,8 +48851,10 @@ func (*PushMessageContentGift) PushMessageContentType() string { // A message with an upgraded gift type PushMessageContentUpgradedGift struct { meta - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred or resold gift + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, if is_prepaid_upgrade == false, then this is a transferred or resold gift IsUpgrade bool `json:"is_upgrade"` + // True, if the message is about completion of prepaid upgrade of the gift instead of actual receiving of a new gift + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` } func (entity *PushMessageContentUpgradedGift) MarshalJSON() ([]byte, error) { @@ -47733,8 +49326,8 @@ func (*PushMessageContentChatSetBackground) PushMessageContentType() string { // A chat theme was edited type PushMessageContentChatSetTheme struct { meta - // If non-empty, name of a new theme, set for the chat. Otherwise, the chat theme was reset to the default one - ThemeName string `json:"theme_name"` + // If non-empty, human-readable name of the new theme. Otherwise, the chat theme was reset to the default one + Name string `json:"name"` } func (entity *PushMessageContentChatSetTheme) MarshalJSON() ([]byte, error) { @@ -51268,6 +52861,33 @@ func (*InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) InternalLinkTypeTy return TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings } +// The link is a link to a channel direct messages chat by username of the channel. Call searchPublicChat with the given chat username to process the link. If the chat is found and is channel, open the direct messages chat of the channel +type InternalLinkTypeDirectMessagesChat struct { + meta + // Username of the channel + ChannelUsername string `json:"channel_username"` +} + +func (entity *InternalLinkTypeDirectMessagesChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeDirectMessagesChat + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeDirectMessagesChat) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeDirectMessagesChat) GetType() string { + return TypeInternalLinkTypeDirectMessagesChat +} + +func (*InternalLinkTypeDirectMessagesChat) InternalLinkTypeType() string { + return TypeInternalLinkTypeDirectMessagesChat +} + // The link is a link to the edit profile section of the application settings type InternalLinkTypeEditProfileSettings struct{ meta @@ -51322,6 +52942,35 @@ func (*InternalLinkTypeGame) InternalLinkTypeType() string { return TypeInternalLinkTypeGame } +// The link is a link to a gift collection. Call searchPublicChat with the given username, then call getReceivedGifts with the received gift owner identifier and the given collection identifier, then show the collection if received +type InternalLinkTypeGiftCollection struct { + meta + // Username of the owner of the gift collection + GiftOwnerUsername string `json:"gift_owner_username"` + // Gift collection identifier + CollectionId int32 `json:"collection_id"` +} + +func (entity *InternalLinkTypeGiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeGiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeGiftCollection) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeGiftCollection) GetType() string { + return TypeInternalLinkTypeGiftCollection +} + +func (*InternalLinkTypeGiftCollection) InternalLinkTypeType() string { + return TypeInternalLinkTypeGiftCollection +} + // The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. Call joinGroupCall with the given invite_link to join the call type InternalLinkTypeGroupCall struct { meta @@ -52001,6 +53650,35 @@ func (*InternalLinkTypeStory) InternalLinkTypeType() string { return TypeInternalLinkTypeStory } +// The link is a link to an album of stories. Call searchPublicChat with the given username, then call getStoryAlbumStories with the received chat identifier and the given story album identifier, then show the story album if received +type InternalLinkTypeStoryAlbum struct { + meta + // Username of the owner of the story album + StoryAlbumOwnerUsername string `json:"story_album_owner_username"` + // Story album identifier + StoryAlbumId int32 `json:"story_album_id"` +} + +func (entity *InternalLinkTypeStoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeStoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeStoryAlbum) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeStoryAlbum) GetType() string { + return TypeInternalLinkTypeStoryAlbum +} + +func (*InternalLinkTypeStoryAlbum) InternalLinkTypeType() string { + return TypeInternalLinkTypeStoryAlbum +} + // The link is a link to a cloud theme. TDLib has no theme support yet type InternalLinkTypeTheme struct { meta @@ -53825,6 +55503,33 @@ func (*ConnectionStateReady) ConnectionStateType() string { return TypeConnectionStateReady } +// Describes parameters for age verification of the current user +type AgeVerificationParameters struct { + meta + // The minimum age required to view restricted content + MinAge int32 `json:"min_age"` + // Username of the bot which main Web App may be used to verify age of the user + VerificationBotUsername string `json:"verification_bot_username"` + // Unique name for the country or region, which legislation required age verification. May be used to get the corresponding localization key + Country string `json:"country"` +} + +func (entity *AgeVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AgeVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*AgeVerificationParameters) GetClass() string { + return ClassAgeVerificationParameters +} + +func (*AgeVerificationParameters) GetType() string { + return TypeAgeVerificationParameters +} + // A category containing frequently used private chats with non-bot users type TopChatCategoryUsers struct{ meta @@ -56155,7 +57860,7 @@ func (*ChatRevenueTransactions) GetType() string { return TypeChatRevenueTransactions } -// Contains information about Telegram Stars earned by a bot or a chat +// Contains information about Telegram Stars earned by a user or a chat type StarRevenueStatus struct { meta // Total amount of Telegram Stars earned @@ -56186,7 +57891,7 @@ func (*StarRevenueStatus) GetType() string { return TypeStarRevenueStatus } -// A detailed statistics about Telegram Stars earned by a bot or a chat +// A detailed statistics about Telegram Stars earned by a user or a chat type StarRevenueStatistics struct { meta // A graph containing amount of revenue in a given day @@ -56234,6 +57939,83 @@ func (starRevenueStatistics *StarRevenueStatistics) UnmarshalJSON(data []byte) e return nil } +// Contains information about Toncoins earned by the current user +type TonRevenueStatus struct { + meta + // Total amount of Toncoins earned; in the smallest units of the cryptocurrency + TotalAmount JsonInt64 `json:"total_amount"` + // Amount of Toncoins that aren't withdrawn yet; in the smallest units of the cryptocurrency + BalanceAmount JsonInt64 `json:"balance_amount"` + // Amount of Toncoins that are available for withdrawal; in the smallest units of the cryptocurrency + AvailableAmount JsonInt64 `json:"available_amount"` + // True, if Toncoins can be withdrawn + WithdrawalEnabled bool `json:"withdrawal_enabled"` +} + +func (entity *TonRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*TonRevenueStatus) GetClass() string { + return ClassTonRevenueStatus +} + +func (*TonRevenueStatus) GetType() string { + return TypeTonRevenueStatus +} + +// A detailed statistics about Toncoins earned by the current user +type TonRevenueStatistics struct { + meta + // A graph containing amount of revenue in a given day + RevenueByDayGraph StatisticalGraph `json:"revenue_by_day_graph"` + // Amount of earned revenue + Status *TonRevenueStatus `json:"status"` + // Current conversion rate of nanotoncoin to USD cents + UsdRate float64 `json:"usd_rate"` +} + +func (entity *TonRevenueStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonRevenueStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*TonRevenueStatistics) GetClass() string { + return ClassTonRevenueStatistics +} + +func (*TonRevenueStatistics) GetType() string { + return TypeTonRevenueStatistics +} + +func (tonRevenueStatistics *TonRevenueStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + RevenueByDayGraph json.RawMessage `json:"revenue_by_day_graph"` + Status *TonRevenueStatus `json:"status"` + UsdRate float64 `json:"usd_rate"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + tonRevenueStatistics.Status = tmp.Status + tonRevenueStatistics.UsdRate = tmp.UsdRate + + fieldRevenueByDayGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueByDayGraph) + tonRevenueStatistics.RevenueByDayGraph = fieldRevenueByDayGraph + + return nil +} + // A point on a Cartesian plane type Point struct { meta @@ -57867,8 +59649,8 @@ type UpdateChatTheme struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // The new name of the chat theme; may be empty if theme was reset to default - ThemeName string `json:"theme_name"` + // The new theme of the chat; may be null if theme was reset to default + Theme ChatTheme `json:"theme"` } func (entity *UpdateChatTheme) MarshalJSON() ([]byte, error) { @@ -57891,6 +59673,25 @@ func (*UpdateChatTheme) UpdateType() string { return TypeUpdateChatTheme } +func (updateChatTheme *UpdateChatTheme) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + Theme json.RawMessage `json:"theme"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateChatTheme.ChatId = tmp.ChatId + + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + updateChatTheme.Theme = fieldTheme + + return nil +} + // The chat unread_mention_count has changed type UpdateChatUnreadMentionCount struct { meta @@ -58348,7 +60149,7 @@ type UpdateTopicMessageCount struct { ChatId int64 `json:"chat_id"` // Identifier of the topic TopicId MessageTopic `json:"topic_id"` - // Approximate number of messages in the topics + // Approximate number of messages in the topic MessageCount int32 `json:"message_count"` } @@ -60343,31 +62144,31 @@ func (*UpdateDefaultBackground) UpdateType() string { return TypeUpdateDefaultBackground } -// The list of available chat themes has changed -type UpdateChatThemes struct { +// The list of available emoji chat themes has changed +type UpdateEmojiChatThemes struct { meta - // The new list of chat themes - ChatThemes []*ChatTheme `json:"chat_themes"` + // The new list of emoji chat themes + ChatThemes []*EmojiChatTheme `json:"chat_themes"` } -func (entity *UpdateChatThemes) MarshalJSON() ([]byte, error) { +func (entity *UpdateEmojiChatThemes) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateChatThemes + type stub UpdateEmojiChatThemes return json.Marshal((*stub)(entity)) } -func (*UpdateChatThemes) GetClass() string { +func (*UpdateEmojiChatThemes) GetClass() string { return ClassUpdate } -func (*UpdateChatThemes) GetType() string { - return TypeUpdateChatThemes +func (*UpdateEmojiChatThemes) GetType() string { + return TypeUpdateEmojiChatThemes } -func (*UpdateChatThemes) UpdateType() string { - return TypeUpdateChatThemes +func (*UpdateEmojiChatThemes) UpdateType() string { + return TypeUpdateEmojiChatThemes } // The list of supported accent colors has changed @@ -60535,6 +62336,33 @@ func (*UpdateFreezeState) UpdateType() string { return TypeUpdateFreezeState } +// The parameters for age verification of the current user's account has changed +type UpdateAgeVerificationParameters struct { + meta + // Parameters for the age verification; may be null if age verification isn't needed + Parameters *AgeVerificationParameters `json:"parameters"` +} + +func (entity *UpdateAgeVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAgeVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAgeVerificationParameters) GetClass() string { + return ClassUpdate +} + +func (*UpdateAgeVerificationParameters) GetType() string { + return TypeUpdateAgeVerificationParameters +} + +func (*UpdateAgeVerificationParameters) UpdateType() string { + return TypeUpdateAgeVerificationParameters +} + // New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" type UpdateTermsOfService struct { meta @@ -60926,7 +62754,7 @@ func (*UpdateChatRevenueAmount) UpdateType() string { return TypeUpdateChatRevenueAmount } -// The Telegram Star revenue earned by a bot or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions +// The Telegram Star revenue earned by a user or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions type UpdateStarRevenueStatus struct { meta // Identifier of the owner of the Telegram Stars @@ -60974,6 +62802,33 @@ func (updateStarRevenueStatus *UpdateStarRevenueStatus) UnmarshalJSON(data []byt return nil } +// The Toncoin revenue earned by the current user has changed. If Toncoin transaction screen of the chat is opened, then getTonTransactions may be called to fetch new transactions +type UpdateTonRevenueStatus struct { + meta + // New Toncoin revenue status + Status *TonRevenueStatus `json:"status"` +} + +func (entity *UpdateTonRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTonRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTonRevenueStatus) GetClass() string { + return ClassUpdate +} + +func (*UpdateTonRevenueStatus) GetType() string { + return TypeUpdateTonRevenueStatus +} + +func (*UpdateTonRevenueStatus) UpdateType() string { + return TypeUpdateTonRevenueStatus +} + // The parameters of speech recognition without Telegram Premium subscription has changed type UpdateSpeechRecognitionTrial struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 829ea95..0fbe52e 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -511,6 +511,58 @@ func UnmarshalListOfPollType(dataList []json.RawMessage) ([]PollType, error) { return list, nil } +func UnmarshalProfileTab(data json.RawMessage) (ProfileTab, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeProfileTabPosts: + return UnmarshalProfileTabPosts(data) + + case TypeProfileTabGifts: + return UnmarshalProfileTabGifts(data) + + case TypeProfileTabMedia: + return UnmarshalProfileTabMedia(data) + + case TypeProfileTabFiles: + return UnmarshalProfileTabFiles(data) + + case TypeProfileTabLinks: + return UnmarshalProfileTabLinks(data) + + case TypeProfileTabMusic: + return UnmarshalProfileTabMusic(data) + + case TypeProfileTabVoice: + return UnmarshalProfileTabVoice(data) + + case TypeProfileTabGifs: + return UnmarshalProfileTabGifs(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfProfileTab(dataList []json.RawMessage) ([]ProfileTab, error) { + list := []ProfileTab{} + + for _, data := range dataList { + entity, err := UnmarshalProfileTab(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUserType(data json.RawMessage) (UserType, error) { var meta meta @@ -662,6 +714,40 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } +func UnmarshalGiftResalePrice(data json.RawMessage) (GiftResalePrice, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftResalePriceStar: + return UnmarshalGiftResalePriceStar(data) + + case TypeGiftResalePriceTon: + return UnmarshalGiftResalePriceTon(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftResalePrice(dataList []json.RawMessage) ([]GiftResalePrice, error) { + list := []GiftResalePrice{} + + for _, data := range dataList { + entity, err := UnmarshalGiftResalePrice(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSuggestedPostPrice(data json.RawMessage) (SuggestedPostPrice, error) { var meta meta @@ -875,6 +961,40 @@ func UnmarshalListOfAffiliateProgramSortOrder(dataList []json.RawMessage) ([]Aff return list, nil } +func UnmarshalCanSendGiftResult(data json.RawMessage) (CanSendGiftResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCanSendGiftResult(dataList []json.RawMessage) ([]CanSendGiftResult, error) { + list := []CanSendGiftResult{} + + for _, data := range dataList { + entity, err := UnmarshalCanSendGiftResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUpgradedGiftOrigin(data json.RawMessage) (UpgradedGiftOrigin, error) { var meta meta @@ -893,6 +1013,9 @@ func UnmarshalUpgradedGiftOrigin(data json.RawMessage) (UpgradedGiftOrigin, erro case TypeUpgradedGiftOriginResale: return UnmarshalUpgradedGiftOriginResale(data) + case TypeUpgradedGiftOriginPrepaidUpgrade: + return UnmarshalUpgradedGiftOriginPrepaidUpgrade(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -986,6 +1109,40 @@ func UnmarshalListOfGiftForResaleOrder(dataList []json.RawMessage) ([]GiftForRes return list, nil } +func UnmarshalGiftResaleResult(data json.RawMessage) (GiftResaleResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftResaleResult(dataList []json.RawMessage) ([]GiftResaleResult, error) { + list := []GiftResaleResult{} + + for _, data := range dataList { + entity, err := UnmarshalGiftResaleResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSentGift(data json.RawMessage) (SentGift, error) { var meta meta @@ -1132,6 +1289,9 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeGiftUpgradePurchase: + return UnmarshalStarTransactionTypeGiftUpgradePurchase(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) @@ -1168,6 +1328,9 @@ func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, er case TypeStarTransactionTypeBusinessBotTransferReceive: return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + case TypeStarTransactionTypePublicPostSearch: + return UnmarshalStarTransactionTypePublicPostSearch(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -1205,6 +1368,12 @@ func UnmarshalTonTransactionType(data json.RawMessage) (TonTransactionType, erro case TypeTonTransactionTypeSuggestedPostPayment: return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + case TypeTonTransactionTypeUpgradedGiftPurchase: + return UnmarshalTonTransactionTypeUpgradedGiftPurchase(data) + + case TypeTonTransactionTypeUpgradedGiftSale: + return UnmarshalTonTransactionTypeUpgradedGiftSale(data) + case TypeTonTransactionTypeUnsupported: return UnmarshalTonTransactionTypeUnsupported(data) @@ -2618,6 +2787,49 @@ func UnmarshalListOfSavedMessagesTopicType(dataList []json.RawMessage) ([]SavedM return list, nil } +func UnmarshalBuiltInTheme(data json.RawMessage) (BuiltInTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBuiltInThemeClassic: + return UnmarshalBuiltInThemeClassic(data) + + case TypeBuiltInThemeDay: + return UnmarshalBuiltInThemeDay(data) + + case TypeBuiltInThemeNight: + return UnmarshalBuiltInThemeNight(data) + + case TypeBuiltInThemeTinted: + return UnmarshalBuiltInThemeTinted(data) + + case TypeBuiltInThemeArctic: + return UnmarshalBuiltInThemeArctic(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBuiltInTheme(dataList []json.RawMessage) ([]BuiltInTheme, error) { + list := []BuiltInTheme{} + + for _, data := range dataList { + entity, err := UnmarshalBuiltInTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalRichText(data json.RawMessage) (RichText, error) { var meta meta @@ -2953,6 +3165,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeChat: return UnmarshalLinkPreviewTypeChat(data) + case TypeLinkPreviewTypeDirectMessagesChat: + return UnmarshalLinkPreviewTypeDirectMessagesChat(data) + case TypeLinkPreviewTypeDocument: return UnmarshalLinkPreviewTypeDocument(data) @@ -2971,6 +3186,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeExternalVideo: return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeGiftCollection: + return UnmarshalLinkPreviewTypeGiftCollection(data) + case TypeLinkPreviewTypeGroupCall: return UnmarshalLinkPreviewTypeGroupCall(data) @@ -2998,6 +3216,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeStory: return UnmarshalLinkPreviewTypeStory(data) + case TypeLinkPreviewTypeStoryAlbum: + return UnmarshalLinkPreviewTypeStoryAlbum(data) + case TypeLinkPreviewTypeSupergroupBoost: return UnmarshalLinkPreviewTypeSupergroupBoost(data) @@ -6506,6 +6727,74 @@ func UnmarshalListOfInputBackground(dataList []json.RawMessage) ([]InputBackgrou return list, nil } +func UnmarshalChatTheme(data json.RawMessage) (ChatTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatThemeEmoji: + return UnmarshalChatThemeEmoji(data) + + case TypeChatThemeGift: + return UnmarshalChatThemeGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatTheme(dataList []json.RawMessage) ([]ChatTheme, error) { + list := []ChatTheme{} + + for _, data := range dataList { + entity, err := UnmarshalChatTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputChatTheme(data json.RawMessage) (InputChatTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputChatThemeEmoji: + return UnmarshalInputChatThemeEmoji(data) + + case TypeInputChatThemeGift: + return UnmarshalInputChatThemeGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputChatTheme(dataList []json.RawMessage) ([]InputChatTheme, error) { + list := []InputChatTheme{} + + for _, data := range dataList { + entity, err := UnmarshalInputChatTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCanPostStoryResult(data json.RawMessage) (CanPostStoryResult, error) { var meta meta @@ -7554,12 +7843,18 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data) + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(data) + case TypeInternalLinkTypeEditProfileSettings: return UnmarshalInternalLinkTypeEditProfileSettings(data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(data) + case TypeInternalLinkTypeGroupCall: return UnmarshalInternalLinkTypeGroupCall(data) @@ -7629,6 +7924,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(data) @@ -8852,8 +9150,8 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateDefaultBackground: return UnmarshalUpdateDefaultBackground(data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(data) @@ -8870,6 +9168,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateFreezeState: return UnmarshalUpdateFreezeState(data) + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) @@ -8912,6 +9213,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateStarRevenueStatus: return UnmarshalUpdateStarRevenueStatus(data) + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) @@ -9719,6 +10023,14 @@ func UnmarshalAudio(data json.RawMessage) (*Audio, error) { return &resp, err } +func UnmarshalAudios(data json.RawMessage) (*Audios, error) { + var resp Audios + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDocument(data json.RawMessage) (*Document, error) { var resp Document @@ -9879,6 +10191,70 @@ func UnmarshalChatPhotoInfo(data json.RawMessage) (*ChatPhotoInfo, error) { return &resp, err } +func UnmarshalProfileTabPosts(data json.RawMessage) (*ProfileTabPosts, error) { + var resp ProfileTabPosts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabGifts(data json.RawMessage) (*ProfileTabGifts, error) { + var resp ProfileTabGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabMedia(data json.RawMessage) (*ProfileTabMedia, error) { + var resp ProfileTabMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabFiles(data json.RawMessage) (*ProfileTabFiles, error) { + var resp ProfileTabFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabLinks(data json.RawMessage) (*ProfileTabLinks, error) { + var resp ProfileTabLinks + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabMusic(data json.RawMessage) (*ProfileTabMusic, error) { + var resp ProfileTabMusic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabVoice(data json.RawMessage) (*ProfileTabVoice, error) { + var resp ProfileTabVoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabGifs(data json.RawMessage) (*ProfileTabGifs, error) { + var resp ProfileTabGifs + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserTypeRegular(data json.RawMessage) (*UserTypeRegular, error) { var resp UserTypeRegular @@ -10223,6 +10599,22 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalGiftResalePriceStar(data json.RawMessage) (*GiftResalePriceStar, error) { + var resp GiftResalePriceStar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResalePriceTon(data json.RawMessage) (*GiftResalePriceTon, error) { + var resp GiftResalePriceTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSuggestedPostPriceStar(data json.RawMessage) (*SuggestedPostPriceStar, error) { var resp SuggestedPostPriceStar @@ -10567,6 +10959,54 @@ func UnmarshalGiftSettings(data json.RawMessage) (*GiftSettings, error) { return &resp, err } +func UnmarshalGiftPurchaseLimits(data json.RawMessage) (*GiftPurchaseLimits, error) { + var resp GiftPurchaseLimits + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResaleParameters(data json.RawMessage) (*GiftResaleParameters, error) { + var resp GiftResaleParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftCollection(data json.RawMessage) (*GiftCollection, error) { + var resp GiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftCollections(data json.RawMessage) (*GiftCollections, error) { + var resp GiftCollections + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendGiftResultOk(data json.RawMessage) (*CanSendGiftResultOk, error) { + var resp CanSendGiftResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendGiftResultFail(data json.RawMessage) (*CanSendGiftResultFail, error) { + var resp CanSendGiftResultFail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftOriginUpgrade(data json.RawMessage) (*UpgradedGiftOriginUpgrade, error) { var resp UpgradedGiftOriginUpgrade @@ -10591,6 +11031,14 @@ func UnmarshalUpgradedGiftOriginResale(data json.RawMessage) (*UpgradedGiftOrigi return &resp, err } +func UnmarshalUpgradedGiftOriginPrepaidUpgrade(data json.RawMessage) (*UpgradedGiftOriginPrepaidUpgrade, error) { + var resp UpgradedGiftOriginPrepaidUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { var resp UpgradedGiftModel @@ -10647,6 +11095,14 @@ func UnmarshalUpgradedGift(data json.RawMessage) (*UpgradedGift, error) { return &resp, err } +func UnmarshalUpgradedGiftValueInfo(data json.RawMessage) (*UpgradedGiftValueInfo, error) { + var resp UpgradedGiftValueInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpgradeGiftResult(data json.RawMessage) (*UpgradeGiftResult, error) { var resp UpgradeGiftResult @@ -10759,6 +11215,22 @@ func UnmarshalGiftsForResale(data json.RawMessage) (*GiftsForResale, error) { return &resp, err } +func UnmarshalGiftResaleResultOk(data json.RawMessage) (*GiftResaleResultOk, error) { + var resp GiftResaleResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResaleResultPriceIncreased(data json.RawMessage) (*GiftResaleResultPriceIncreased, error) { + var resp GiftResaleResultPriceIncreased + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSentGiftRegular(data json.RawMessage) (*SentGiftRegular, error) { var resp SentGiftRegular @@ -10999,6 +11471,14 @@ func UnmarshalStarTransactionTypeGiftUpgrade(data json.RawMessage) (*StarTransac return &resp, err } +func UnmarshalStarTransactionTypeGiftUpgradePurchase(data json.RawMessage) (*StarTransactionTypeGiftUpgradePurchase, error) { + var resp StarTransactionTypeGiftUpgradePurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*StarTransactionTypeUpgradedGiftPurchase, error) { var resp StarTransactionTypeUpgradedGiftPurchase @@ -11095,6 +11575,14 @@ func UnmarshalStarTransactionTypeBusinessBotTransferReceive(data json.RawMessage return &resp, err } +func UnmarshalStarTransactionTypePublicPostSearch(data json.RawMessage) (*StarTransactionTypePublicPostSearch, error) { + var resp StarTransactionTypePublicPostSearch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { var resp StarTransactionTypeUnsupported @@ -11135,6 +11623,22 @@ func UnmarshalTonTransactionTypeSuggestedPostPayment(data json.RawMessage) (*Ton return &resp, err } +func UnmarshalTonTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*TonTransactionTypeUpgradedGiftPurchase, error) { + var resp TonTransactionTypeUpgradedGiftPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeUpgradedGiftSale(data json.RawMessage) (*TonTransactionTypeUpgradedGiftSale, error) { + var resp TonTransactionTypeUpgradedGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTonTransactionTypeUnsupported(data json.RawMessage) (*TonTransactionTypeUnsupported, error) { var resp TonTransactionTypeUnsupported @@ -11255,6 +11759,22 @@ func UnmarshalProfileAccentColor(data json.RawMessage) (*ProfileAccentColor, err return &resp, err } +func UnmarshalUserRating(data json.RawMessage) (*UserRating, error) { + var resp UserRating + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRestrictionInfo(data json.RawMessage) (*RestrictionInfo, error) { + var resp RestrictionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiStatusTypeCustomEmoji(data json.RawMessage) (*EmojiStatusTypeCustomEmoji, error) { var resp EmojiStatusTypeCustomEmoji @@ -11719,6 +12239,14 @@ func UnmarshalSecretChat(data json.RawMessage) (*SecretChat, error) { return &resp, err } +func UnmarshalPublicPostSearchLimits(data json.RawMessage) (*PublicPostSearchLimits, error) { + var resp PublicPostSearchLimits + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSenderUser(data json.RawMessage) (*MessageSenderUser, error) { var resp MessageSenderUser @@ -12127,6 +12655,14 @@ func UnmarshalFoundChatMessages(data json.RawMessage) (*FoundChatMessages, error return &resp, err } +func UnmarshalFoundPublicPosts(data json.RawMessage) (*FoundPublicPosts, error) { + var resp FoundPublicPosts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessagePosition(data json.RawMessage) (*MessagePosition, error) { var resp MessagePosition @@ -13167,6 +13703,46 @@ func UnmarshalSharedChat(data json.RawMessage) (*SharedChat, error) { return &resp, err } +func UnmarshalBuiltInThemeClassic(data json.RawMessage) (*BuiltInThemeClassic, error) { + var resp BuiltInThemeClassic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeDay(data json.RawMessage) (*BuiltInThemeDay, error) { + var resp BuiltInThemeDay + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeNight(data json.RawMessage) (*BuiltInThemeNight, error) { + var resp BuiltInThemeNight + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeTinted(data json.RawMessage) (*BuiltInThemeTinted, error) { + var resp BuiltInThemeTinted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeArctic(data json.RawMessage) (*BuiltInThemeArctic, error) { + var resp BuiltInThemeArctic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalThemeSettings(data json.RawMessage) (*ThemeSettings, error) { var resp ThemeSettings @@ -13711,6 +14287,14 @@ func UnmarshalLinkPreviewTypeChat(data json.RawMessage) (*LinkPreviewTypeChat, e return &resp, err } +func UnmarshalLinkPreviewTypeDirectMessagesChat(data json.RawMessage) (*LinkPreviewTypeDirectMessagesChat, error) { + var resp LinkPreviewTypeDirectMessagesChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeDocument(data json.RawMessage) (*LinkPreviewTypeDocument, error) { var resp LinkPreviewTypeDocument @@ -13759,6 +14343,14 @@ func UnmarshalLinkPreviewTypeExternalVideo(data json.RawMessage) (*LinkPreviewTy return &resp, err } +func UnmarshalLinkPreviewTypeGiftCollection(data json.RawMessage) (*LinkPreviewTypeGiftCollection, error) { + var resp LinkPreviewTypeGiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeGroupCall(data json.RawMessage) (*LinkPreviewTypeGroupCall, error) { var resp LinkPreviewTypeGroupCall @@ -13831,6 +14423,14 @@ func UnmarshalLinkPreviewTypeStory(data json.RawMessage) (*LinkPreviewTypeStory, return &resp, err } +func UnmarshalLinkPreviewTypeStoryAlbum(data json.RawMessage) (*LinkPreviewTypeStoryAlbum, error) { + var resp LinkPreviewTypeStoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeSupergroupBoost(data json.RawMessage) (*LinkPreviewTypeSupergroupBoost, error) { var resp LinkPreviewTypeSupergroupBoost @@ -16703,6 +17303,22 @@ func UnmarshalFoundStories(data json.RawMessage) (*FoundStories, error) { return &resp, err } +func UnmarshalStoryAlbum(data json.RawMessage) (*StoryAlbum, error) { + var resp StoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAlbums(data json.RawMessage) (*StoryAlbums, error) { + var resp StoryAlbums + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryFullId(data json.RawMessage) (*StoryFullId, error) { var resp StoryFullId @@ -19287,8 +19903,56 @@ func UnmarshalInputBackgroundPrevious(data json.RawMessage) (*InputBackgroundPre return &resp, err } -func UnmarshalChatTheme(data json.RawMessage) (*ChatTheme, error) { - var resp ChatTheme +func UnmarshalEmojiChatTheme(data json.RawMessage) (*EmojiChatTheme, error) { + var resp EmojiChatTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftChatTheme(data json.RawMessage) (*GiftChatTheme, error) { + var resp GiftChatTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftChatThemes(data json.RawMessage) (*GiftChatThemes, error) { + var resp GiftChatThemes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatThemeEmoji(data json.RawMessage) (*ChatThemeEmoji, error) { + var resp ChatThemeEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatThemeGift(data json.RawMessage) (*ChatThemeGift, error) { + var resp ChatThemeGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatThemeEmoji(data json.RawMessage) (*InputChatThemeEmoji, error) { + var resp InputChatThemeEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatThemeGift(data json.RawMessage) (*InputChatThemeGift, error) { + var resp InputChatThemeGift err := json.Unmarshal(data, &resp) @@ -20791,6 +21455,14 @@ func UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data json.Ra return &resp, err } +func UnmarshalInternalLinkTypeDirectMessagesChat(data json.RawMessage) (*InternalLinkTypeDirectMessagesChat, error) { + var resp InternalLinkTypeDirectMessagesChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeEditProfileSettings(data json.RawMessage) (*InternalLinkTypeEditProfileSettings, error) { var resp InternalLinkTypeEditProfileSettings @@ -20807,6 +21479,14 @@ func UnmarshalInternalLinkTypeGame(data json.RawMessage) (*InternalLinkTypeGame, return &resp, err } +func UnmarshalInternalLinkTypeGiftCollection(data json.RawMessage) (*InternalLinkTypeGiftCollection, error) { + var resp InternalLinkTypeGiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeGroupCall(data json.RawMessage) (*InternalLinkTypeGroupCall, error) { var resp InternalLinkTypeGroupCall @@ -20991,6 +21671,14 @@ func UnmarshalInternalLinkTypeStory(data json.RawMessage) (*InternalLinkTypeStor return &resp, err } +func UnmarshalInternalLinkTypeStoryAlbum(data json.RawMessage) (*InternalLinkTypeStoryAlbum, error) { + var resp InternalLinkTypeStoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeTheme(data json.RawMessage) (*InternalLinkTypeTheme, error) { var resp InternalLinkTypeTheme @@ -21511,6 +22199,14 @@ func UnmarshalConnectionStateReady(data json.RawMessage) (*ConnectionStateReady, return &resp, err } +func UnmarshalAgeVerificationParameters(data json.RawMessage) (*AgeVerificationParameters, error) { + var resp AgeVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTopChatCategoryUsers(data json.RawMessage) (*TopChatCategoryUsers, error) { var resp TopChatCategoryUsers @@ -22111,6 +22807,22 @@ func UnmarshalStarRevenueStatistics(data json.RawMessage) (*StarRevenueStatistic return &resp, err } +func UnmarshalTonRevenueStatus(data json.RawMessage) (*TonRevenueStatus, error) { + var resp TonRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonRevenueStatistics(data json.RawMessage) (*TonRevenueStatistics, error) { + var resp TonRevenueStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPoint(data json.RawMessage) (*Point, error) { var resp Point @@ -23111,8 +23823,8 @@ func UnmarshalUpdateDefaultBackground(data json.RawMessage) (*UpdateDefaultBackg return &resp, err } -func UnmarshalUpdateChatThemes(data json.RawMessage) (*UpdateChatThemes, error) { - var resp UpdateChatThemes +func UnmarshalUpdateEmojiChatThemes(data json.RawMessage) (*UpdateEmojiChatThemes, error) { + var resp UpdateEmojiChatThemes err := json.Unmarshal(data, &resp) @@ -23159,6 +23871,14 @@ func UnmarshalUpdateFreezeState(data json.RawMessage) (*UpdateFreezeState, error return &resp, err } +func UnmarshalUpdateAgeVerificationParameters(data json.RawMessage) (*UpdateAgeVerificationParameters, error) { + var resp UpdateAgeVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, error) { var resp UpdateTermsOfService @@ -23271,6 +23991,14 @@ func UnmarshalUpdateStarRevenueStatus(data json.RawMessage) (*UpdateStarRevenueS return &resp, err } +func UnmarshalUpdateTonRevenueStatus(data json.RawMessage) (*UpdateTonRevenueStatus, error) { + var resp UpdateTonRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateSpeechRecognitionTrial(data json.RawMessage) (*UpdateSpeechRecognitionTrial, error) { var resp UpdateSpeechRecognitionTrial @@ -23873,6 +24601,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAudio: return UnmarshalAudio(data) + case TypeAudios: + return UnmarshalAudios(data) + case TypeDocument: return UnmarshalDocument(data) @@ -23933,6 +24664,30 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatPhotoInfo: return UnmarshalChatPhotoInfo(data) + case TypeProfileTabPosts: + return UnmarshalProfileTabPosts(data) + + case TypeProfileTabGifts: + return UnmarshalProfileTabGifts(data) + + case TypeProfileTabMedia: + return UnmarshalProfileTabMedia(data) + + case TypeProfileTabFiles: + return UnmarshalProfileTabFiles(data) + + case TypeProfileTabLinks: + return UnmarshalProfileTabLinks(data) + + case TypeProfileTabMusic: + return UnmarshalProfileTabMusic(data) + + case TypeProfileTabVoice: + return UnmarshalProfileTabVoice(data) + + case TypeProfileTabGifs: + return UnmarshalProfileTabGifs(data) + case TypeUserTypeRegular: return UnmarshalUserTypeRegular(data) @@ -24062,6 +24817,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeGiftResalePriceStar: + return UnmarshalGiftResalePriceStar(data) + + case TypeGiftResalePriceTon: + return UnmarshalGiftResalePriceTon(data) + case TypeSuggestedPostPriceStar: return UnmarshalSuggestedPostPriceStar(data) @@ -24191,6 +24952,24 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftSettings: return UnmarshalGiftSettings(data) + case TypeGiftPurchaseLimits: + return UnmarshalGiftPurchaseLimits(data) + + case TypeGiftResaleParameters: + return UnmarshalGiftResaleParameters(data) + + case TypeGiftCollection: + return UnmarshalGiftCollection(data) + + case TypeGiftCollections: + return UnmarshalGiftCollections(data) + + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(data) + case TypeUpgradedGiftOriginUpgrade: return UnmarshalUpgradedGiftOriginUpgrade(data) @@ -24200,6 +24979,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpgradedGiftOriginResale: return UnmarshalUpgradedGiftOriginResale(data) + case TypeUpgradedGiftOriginPrepaidUpgrade: + return UnmarshalUpgradedGiftOriginPrepaidUpgrade(data) + case TypeUpgradedGiftModel: return UnmarshalUpgradedGiftModel(data) @@ -24221,6 +25003,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpgradedGift: return UnmarshalUpgradedGift(data) + case TypeUpgradedGiftValueInfo: + return UnmarshalUpgradedGiftValueInfo(data) + case TypeUpgradeGiftResult: return UnmarshalUpgradeGiftResult(data) @@ -24263,6 +25048,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGiftsForResale: return UnmarshalGiftsForResale(data) + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(data) + case TypeSentGiftRegular: return UnmarshalSentGiftRegular(data) @@ -24353,6 +25144,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeGiftUpgrade: return UnmarshalStarTransactionTypeGiftUpgrade(data) + case TypeStarTransactionTypeGiftUpgradePurchase: + return UnmarshalStarTransactionTypeGiftUpgradePurchase(data) + case TypeStarTransactionTypeUpgradedGiftPurchase: return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) @@ -24389,6 +25183,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarTransactionTypeBusinessBotTransferReceive: return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + case TypeStarTransactionTypePublicPostSearch: + return UnmarshalStarTransactionTypePublicPostSearch(data) + case TypeStarTransactionTypeUnsupported: return UnmarshalStarTransactionTypeUnsupported(data) @@ -24404,6 +25201,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTonTransactionTypeSuggestedPostPayment: return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + case TypeTonTransactionTypeUpgradedGiftPurchase: + return UnmarshalTonTransactionTypeUpgradedGiftPurchase(data) + + case TypeTonTransactionTypeUpgradedGiftSale: + return UnmarshalTonTransactionTypeUpgradedGiftSale(data) + case TypeTonTransactionTypeUnsupported: return UnmarshalTonTransactionTypeUnsupported(data) @@ -24449,6 +25252,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeProfileAccentColor: return UnmarshalProfileAccentColor(data) + case TypeUserRating: + return UnmarshalUserRating(data) + + case TypeRestrictionInfo: + return UnmarshalRestrictionInfo(data) + case TypeEmojiStatusTypeCustomEmoji: return UnmarshalEmojiStatusTypeCustomEmoji(data) @@ -24623,6 +25432,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSecretChat: return UnmarshalSecretChat(data) + case TypePublicPostSearchLimits: + return UnmarshalPublicPostSearchLimits(data) + case TypeMessageSenderUser: return UnmarshalMessageSenderUser(data) @@ -24776,6 +25588,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFoundChatMessages: return UnmarshalFoundChatMessages(data) + case TypeFoundPublicPosts: + return UnmarshalFoundPublicPosts(data) + case TypeMessagePosition: return UnmarshalMessagePosition(data) @@ -25166,6 +25981,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSharedChat: return UnmarshalSharedChat(data) + case TypeBuiltInThemeClassic: + return UnmarshalBuiltInThemeClassic(data) + + case TypeBuiltInThemeDay: + return UnmarshalBuiltInThemeDay(data) + + case TypeBuiltInThemeNight: + return UnmarshalBuiltInThemeNight(data) + + case TypeBuiltInThemeTinted: + return UnmarshalBuiltInThemeTinted(data) + + case TypeBuiltInThemeArctic: + return UnmarshalBuiltInThemeArctic(data) + case TypeThemeSettings: return UnmarshalThemeSettings(data) @@ -25370,6 +26200,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeChat: return UnmarshalLinkPreviewTypeChat(data) + case TypeLinkPreviewTypeDirectMessagesChat: + return UnmarshalLinkPreviewTypeDirectMessagesChat(data) + case TypeLinkPreviewTypeDocument: return UnmarshalLinkPreviewTypeDocument(data) @@ -25388,6 +26221,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeExternalVideo: return UnmarshalLinkPreviewTypeExternalVideo(data) + case TypeLinkPreviewTypeGiftCollection: + return UnmarshalLinkPreviewTypeGiftCollection(data) + case TypeLinkPreviewTypeGroupCall: return UnmarshalLinkPreviewTypeGroupCall(data) @@ -25415,6 +26251,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeStory: return UnmarshalLinkPreviewTypeStory(data) + case TypeLinkPreviewTypeStoryAlbum: + return UnmarshalLinkPreviewTypeStoryAlbum(data) + case TypeLinkPreviewTypeSupergroupBoost: return UnmarshalLinkPreviewTypeSupergroupBoost(data) @@ -26492,6 +27331,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFoundStories: return UnmarshalFoundStories(data) + case TypeStoryAlbum: + return UnmarshalStoryAlbum(data) + + case TypeStoryAlbums: + return UnmarshalStoryAlbums(data) + case TypeStoryFullId: return UnmarshalStoryFullId(data) @@ -27461,8 +28306,26 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputBackgroundPrevious: return UnmarshalInputBackgroundPrevious(data) - case TypeChatTheme: - return UnmarshalChatTheme(data) + case TypeEmojiChatTheme: + return UnmarshalEmojiChatTheme(data) + + case TypeGiftChatTheme: + return UnmarshalGiftChatTheme(data) + + case TypeGiftChatThemes: + return UnmarshalGiftChatThemes(data) + + case TypeChatThemeEmoji: + return UnmarshalChatThemeEmoji(data) + + case TypeChatThemeGift: + return UnmarshalChatThemeGift(data) + + case TypeInputChatThemeEmoji: + return UnmarshalInputChatThemeEmoji(data) + + case TypeInputChatThemeGift: + return UnmarshalInputChatThemeGift(data) case TypeTimeZone: return UnmarshalTimeZone(data) @@ -28025,12 +28888,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data) + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(data) + case TypeInternalLinkTypeEditProfileSettings: return UnmarshalInternalLinkTypeEditProfileSettings(data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(data) + case TypeInternalLinkTypeGroupCall: return UnmarshalInternalLinkTypeGroupCall(data) @@ -28100,6 +28969,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(data) @@ -28295,6 +29167,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeConnectionStateReady: return UnmarshalConnectionStateReady(data) + case TypeAgeVerificationParameters: + return UnmarshalAgeVerificationParameters(data) + case TypeTopChatCategoryUsers: return UnmarshalTopChatCategoryUsers(data) @@ -28520,6 +29395,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarRevenueStatistics: return UnmarshalStarRevenueStatistics(data) + case TypeTonRevenueStatus: + return UnmarshalTonRevenueStatus(data) + + case TypeTonRevenueStatistics: + return UnmarshalTonRevenueStatistics(data) + case TypePoint: return UnmarshalPoint(data) @@ -28895,8 +29776,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateDefaultBackground: return UnmarshalUpdateDefaultBackground(data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(data) @@ -28913,6 +29794,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateFreezeState: return UnmarshalUpdateFreezeState(data) + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) @@ -28955,6 +29839,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateStarRevenueStatus: return UnmarshalUpdateStarRevenueStatus(data) + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(data) + case TypeUpdateSpeechRecognitionTrial: return UnmarshalUpdateSpeechRecognitionTrial(data) diff --git a/data/td_api.tl b/data/td_api.tl index 60c5f4f..aec4e7c 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -131,7 +131,9 @@ authorizationStateWaitPhoneNumber = AuthorizationState; //@description The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction //@store_product_id Identifier of the store product that must be bought -authorizationStateWaitPremiumPurchase store_product_id:string = AuthorizationState; +//@support_email_address Email address to use for support if the user has issues with Telegram Premium purchase +//@support_email_subject Subject for the email sent to the support email address +authorizationStateWaitPremiumPurchase store_product_id:string support_email_address:string support_email_subject:string = AuthorizationState; //@description TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed //@allow_apple_id True, if authorization through Apple ID is allowed @@ -441,6 +443,9 @@ animation duration:int32 width:int32 height:int32 file_name:string mime_type:str //@audio File containing the audio audio duration:int32 title:string performer:string file_name:string mime_type:string album_cover_minithumbnail:minithumbnail album_cover_thumbnail:thumbnail external_album_covers:vector audio:file = Audio; +//@description Contains a list of audio files @total_count Approximate total number of audio files found @audios List of audio files +audios total_count:int32 audios:vector