diff --git a/client/function.go b/client/function.go index 35f1f78..c68b368 100755 --- a/client/function.go +++ b/client/function.go @@ -162,6 +162,8 @@ func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNu } type CheckAuthenticationPremiumPurchaseRequest struct { + // The number of days for which the Telegram Premium subscription will be granted + PremiumDayCount int32 `json:"premium_day_count"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` // Paid amount, in the smallest units of the currency @@ -175,6 +177,7 @@ func (client *Client) CheckAuthenticationPremiumPurchase(req *CheckAuthenticatio Type: "checkAuthenticationPremiumPurchase", }, Data: map[string]interface{}{ + "premium_day_count": req.PremiumDayCount, "currency": req.Currency, "amount": req.Amount, }, @@ -195,6 +198,8 @@ type SetAuthenticationPremiumPurchaseTransactionRequest struct { Transaction StoreTransaction `json:"transaction"` // Pass true if this is a restore of a Telegram Premium purchase; only for App Store IsRestore bool `json:"is_restore"` + // The number of days for which the Telegram Premium subscription will be granted + PremiumDayCount int32 `json:"premium_day_count"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` // Paid amount, in the smallest units of the currency @@ -210,6 +215,7 @@ func (client *Client) SetAuthenticationPremiumPurchaseTransaction(req *SetAuthen Data: map[string]interface{}{ "transaction": req.Transaction, "is_restore": req.IsRestore, + "premium_day_count": req.PremiumDayCount, "currency": req.Currency, "amount": req.Amount, }, @@ -4564,6 +4570,212 @@ func (client *Client) GetMessageLinkInfo(req *GetMessageLinkInfoRequest) (*Messa return UnmarshalMessageLinkInfo(result.Data) } +type CreateTextCompositionStyleRequest struct { + // Title of the style; 1-getOption("text_composition_style_title_length_max") characters + Title string `json:"title"` + // Identifier of the custom emoji corresponding to the style + CustomEmojiId JsonInt64 `json:"custom_emoji_id"` + // Prompt that will be used for text composition; 1-getOption("text_composition_style_prompt_length_max") characters + Prompt string `json:"prompt"` + // Pass true if the current user must be shown as the creator of the style + ShowCreator bool `json:"show_creator"` +} + +// Creates a custom text composition style. May return an error with a message "TONES_SAVED_TOO_MANY" if the maximum number of added custom styles has been reached +func (client *Client) CreateTextCompositionStyle(req *CreateTextCompositionStyleRequest) (*TextCompositionStyle, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createTextCompositionStyle", + }, + Data: map[string]interface{}{ + "title": req.Title, + "custom_emoji_id": req.CustomEmojiId, + "prompt": req.Prompt, + "show_creator": req.ShowCreator, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTextCompositionStyle(result.Data) +} + +type EditTextCompositionStyleRequest struct { + // Name of the style + Name string `json:"name"` + // Title of the style; 1-getOption("text_composition_style_title_length_max") characters + Title string `json:"title"` + // Identifier of the custom emoji corresponding to the style + CustomEmojiId JsonInt64 `json:"custom_emoji_id"` + // Prompt that will be used for text composition; 1-getOption("text_composition_style_prompt_length_max") characters + Prompt string `json:"prompt"` + // Pass true if the current user must be shown as the creator of the style + ShowCreator bool `json:"show_creator"` +} + +// Edits a custom text composition style that was created by the current user +func (client *Client) EditTextCompositionStyle(req *EditTextCompositionStyleRequest) (*TextCompositionStyle, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editTextCompositionStyle", + }, + Data: map[string]interface{}{ + "name": req.Name, + "title": req.Title, + "custom_emoji_id": req.CustomEmojiId, + "prompt": req.Prompt, + "show_creator": req.ShowCreator, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTextCompositionStyle(result.Data) +} + +type DeleteTextCompositionStyleRequest struct { + // Name of the style + Name string `json:"name"` +} + +// Deletes a custom text composition style that was created by the current user +func (client *Client) DeleteTextCompositionStyle(req *DeleteTextCompositionStyleRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteTextCompositionStyle", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SearchTextCompositionStyleRequest struct { + // Name of the style + Name string `json:"name"` +} + +// Searches a custom text composition style by its name +func (client *Client) SearchTextCompositionStyle(req *SearchTextCompositionStyleRequest) (*TextCompositionStyle, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchTextCompositionStyle", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTextCompositionStyle(result.Data) +} + +type GetTextCompositionStyleExampleRequest struct { + // Name of the style + Name string `json:"name"` + // 0-based unique number of the requested example; must be non-negative and less than getOption("text_composition_style_example_count") + ExampleNumber int32 `json:"example_number"` +} + +// Returns an example of usage of a custom text composition style +func (client *Client) GetTextCompositionStyleExample(req *GetTextCompositionStyleExampleRequest) (*TextCompositionStyleExample, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTextCompositionStyleExample", + }, + Data: map[string]interface{}{ + "name": req.Name, + "example_number": req.ExampleNumber, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTextCompositionStyleExample(result.Data) +} + +type AddTextCompositionStyleRequest struct { + // Name of the style + Name string `json:"name"` +} + +// Adds a custom text composition style to the list of used by the user styles. May return an error with a message "TONES_SAVED_TOO_MANY" if the maximum number of added custom styles has been reached +func (client *Client) AddTextCompositionStyle(req *AddTextCompositionStyleRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addTextCompositionStyle", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveTextCompositionStyleRequest struct { + // Name of the style + Name string `json:"name"` +} + +// Removes a custom text composition style from the list of used by the user styles. If the style was created by the current user, then it can only be deleted +func (client *Client) RemoveTextCompositionStyle(req *RemoveTextCompositionStyleRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeTextCompositionStyle", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type TranslateTextRequest struct { // Text to translate Text *FormattedText `json:"text"` @@ -7592,6 +7804,67 @@ func (client *Client) RemoveMessageReaction(req *RemoveMessageReactionRequest) ( return UnmarshalOk(result.Data) } +type DeleteAllRecentMessageReactionsFromSenderRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the sender of reactions to delete + SenderId MessageSender `json:"sender_id"` +} + +// Deletes all recent reactions added by the specified sender in a chat. Supported only for basic groups and supergroups; requires can_delete_messages administrator right +func (client *Client) DeleteAllRecentMessageReactionsFromSender(req *DeleteAllRecentMessageReactionsFromSenderRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteAllRecentMessageReactionsFromSender", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "sender_id": req.SenderId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteMessageReactionsFromSenderRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the reactions. Use messageProperties.can_delete_reactions to check whether the method can be used for a message + MessageId int64 `json:"message_id"` + // Identifier of the sender of reactions to delete + SenderId MessageSender `json:"sender_id"` +} + +// Deletes all reactions added by the specified sender on a message +func (client *Client) DeleteMessageReactionsFromSender(req *DeleteMessageReactionsFromSenderRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteMessageReactionsFromSender", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "sender_id": req.SenderId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetChatAvailablePaidMessageReactionSendersRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -8418,7 +8691,7 @@ type DeletePollOptionRequest struct { OptionId string `json:"option_id"` } -// Adds an option to a poll +// Deletes an option from a poll func (client *Client) DeletePollOption(req *DeletePollOptionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8511,6 +8784,38 @@ func (client *Client) GetPollVoters(req *GetPollVotersRequest) (*PollVoters, err return UnmarshalPollVoters(result.Data) } +type GetPollVoteStatisticsRequest struct { + // Identifier of the chat to which the poll belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the poll. Use messageProperties.can_get_poll_vote_statistics to check whether the method can be used for a message + MessageId int64 `json:"message_id"` + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns statistics of poll votes in a poll +func (client *Client) GetPollVoteStatistics(req *GetPollVoteStatisticsRequest) (*PollVoteStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPollVoteStatistics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPollVoteStatistics(result.Data) +} + type StopPollRequest struct { // Identifier of the chat to which the poll belongs ChatId int64 `json:"chat_id"` @@ -8906,6 +9211,35 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err return UnmarshalOk(result.Data) } +type AnswerGuestQueryRequest struct { + // Identifier of the guest query + GuestQueryId JsonInt64 `json:"guest_query_id"` + // The result of the query + Result InputInlineQueryResult `json:"result"` +} + +// Sets the result of a guest query; for bots only +func (client *Client) AnswerGuestQuery(req *AnswerGuestQueryRequest) (*InlineMessageId, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "answerGuestQuery", + }, + Data: map[string]interface{}{ + "guest_query_id": req.GuestQueryId, + "result": req.Result, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalInlineMessageId(result.Data) +} + type SavePreparedInlineMessageRequest struct { // Identifier of the user UserId int64 `json:"user_id"` @@ -9324,7 +9658,7 @@ type AnswerWebAppQueryRequest struct { } // Sets the result of interaction with a Web App and sends corresponding message on behalf of the user to the chat from which the query originated; for bots only -func (client *Client) AnswerWebAppQuery(req *AnswerWebAppQueryRequest) (*SentWebAppMessage, error) { +func (client *Client) AnswerWebAppQuery(req *AnswerWebAppQueryRequest) (*InlineMessageId, error) { result, err := client.Send(Request{ meta: meta{ Type: "answerWebAppQuery", @@ -9342,7 +9676,7 @@ func (client *Client) AnswerWebAppQuery(req *AnswerWebAppQueryRequest) (*SentWeb return nil, buildResponseError(result.Data) } - return UnmarshalSentWebAppMessage(result.Data) + return UnmarshalInlineMessageId(result.Data) } type CheckWebAppFileDownloadRequest struct { @@ -9719,7 +10053,7 @@ type SendTextMessageDraftRequest struct { ForumTopicId int32 `json:"forum_topic_id"` // Unique identifier of the draft DraftId JsonInt64 `json:"draft_id"` - // Draft text of the message + // Draft text of the message; pass null to show a "Thinking..." placeholder Text *FormattedText `json:"text"` } @@ -10162,6 +10496,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeStoryAlbum: return UnmarshalInternalLinkTypeStoryAlbum(result.Data) + case TypeInternalLinkTypeTextCompositionStyle: + return UnmarshalInternalLinkTypeTextCompositionStyle(result.Data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(result.Data) @@ -12628,7 +12965,7 @@ type GetSavedNotificationSoundRequest struct { } // Returns saved notification sound by its identifier. Returns a 404 error if there is no saved notification sound with the specified identifier -func (client *Client) GetSavedNotificationSound(req *GetSavedNotificationSoundRequest) (*NotificationSounds, error) { +func (client *Client) GetSavedNotificationSound(req *GetSavedNotificationSoundRequest) (*NotificationSound, error) { result, err := client.Send(Request{ meta: meta{ Type: "getSavedNotificationSound", @@ -12645,7 +12982,7 @@ func (client *Client) GetSavedNotificationSound(req *GetSavedNotificationSoundRe return nil, buildResponseError(result.Data) } - return UnmarshalNotificationSounds(result.Data) + return UnmarshalNotificationSound(result.Data) } // Returns the list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used @@ -18150,6 +18487,35 @@ func (client *Client) SetUserEmojiStatus(req *SetUserEmojiStatusRequest) (*Ok, e return UnmarshalOk(result.Data) } +type GetPersonalChatHistoryRequest struct { + // User identifier + UserId int64 `json:"user_id"` + // The maximum number of messages to be returned; 1-20 + Limit int32 `json:"limit"` +} + +// Returns messages in the personal chat of a given user; for bots only +func (client *Client) GetPersonalChatHistory(req *GetPersonalChatHistoryRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPersonalChatHistory", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + type SearchUserByPhoneNumberRequest struct { // Phone number to search for PhoneNumber string `json:"phone_number"` @@ -18296,8 +18662,14 @@ func (client *Client) IsProfileAudio(req *IsProfileAudioRequest) (*Ok, error) { } 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"` + // The audio file to be added + Audio InputFile `json:"audio"` + // Duration of the audio, in seconds; may be replaced by the server; ignored for already uploaded files + Duration int32 `json:"duration"` + // Title of the audio; 0-64 characters; may be replaced by the server; ignored for already uploaded files + Title string `json:"title"` + // Performer of the audio; 0-64 characters, may be replaced by the server; ignored for already uploaded files + Performer string `json:"performer"` } // Adds an audio file to the beginning of the profile audio files of the current user @@ -18307,7 +18679,10 @@ func (client *Client) AddProfileAudio(req *AddProfileAudioRequest) (*Ok, error) Type: "addProfileAudio", }, Data: map[string]interface{}{ - "file_id": req.FileId, + "audio": req.Audio, + "duration": req.Duration, + "title": req.Title, + "performer": req.Performer, }, }) if err != nil { @@ -21106,18 +21481,18 @@ func (client *Client) CreateBot(req *CreateBotRequest) (*User, error) { return UnmarshalUser(result.Data) } -type GetBotTokenRequest struct { - // Identifier of the created bot +type GetManagedBotTokenRequest struct { + // Identifier of the managed bot BotUserId int64 `json:"bot_user_id"` // Pass true to revoke the current token and create a new one Revoke bool `json:"revoke"` } -// Returns token of a created bot; for bots only -func (client *Client) GetBotToken(req *GetBotTokenRequest) (*Text, error) { +// Returns token of a managed bot; for bots only +func (client *Client) GetManagedBotToken(req *GetManagedBotTokenRequest) (*Text, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getBotToken", + Type: "getManagedBotToken", }, Data: map[string]interface{}{ "bot_user_id": req.BotUserId, @@ -21135,6 +21510,61 @@ func (client *Client) GetBotToken(req *GetBotTokenRequest) (*Text, error) { return UnmarshalText(result.Data) } +type GetManagedBotAccessSettingsRequest struct { + // Identifier of the managed bot + BotUserId int64 `json:"bot_user_id"` +} + +// Returns access settings of a managed bot; for bots only +func (client *Client) GetManagedBotAccessSettings(req *GetManagedBotAccessSettingsRequest) (*BotAccessSettings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getManagedBotAccessSettings", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBotAccessSettings(result.Data) +} + +type SetManagedBotAccessSettingsRequest struct { + // Identifier of the managed bot + BotUserId int64 `json:"bot_user_id"` + // New access settings + Settings *BotAccessSettings `json:"settings"` +} + +// Sets access settings of a managed bot; for bots only +func (client *Client) SetManagedBotAccessSettings(req *SetManagedBotAccessSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setManagedBotAccessSettings", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetBotNameRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` @@ -23546,7 +23976,7 @@ func (client *Client) GetUpgradedGiftWithdrawalUrl(req *GetUpgradedGiftWithdrawa return UnmarshalHttpUrl(result.Data) } -// Returns promotional anumation for upgraded gifts +// Returns promotional animation for upgraded gifts func (client *Client) GetUpgradedGiftsPromotionalAnimation() (*Animation, error) { result, err := client.Send(Request{ meta: meta{ @@ -28155,6 +28585,8 @@ type AddProxyRequest struct { Proxy *Proxy `json:"proxy"` // Pass true to immediately enable the proxy Enable bool `json:"enable"` + // Comment to set for the proxy + Comment string `json:"comment"` } // Adds a proxy server for network requests. Can be called before authorization @@ -28166,6 +28598,7 @@ func (client *Client) AddProxy(req *AddProxyRequest) (*AddedProxy, error) { Data: map[string]interface{}{ "proxy": req.Proxy, "enable": req.Enable, + "comment": req.Comment, }, }) if err != nil { @@ -28186,6 +28619,8 @@ type EditProxyRequest struct { Proxy *Proxy `json:"proxy"` // Pass true to immediately enable the proxy Enable bool `json:"enable"` + // New comment for the proxy + Comment string `json:"comment"` } // Edits an existing proxy server for network requests. Can be called before authorization @@ -28198,6 +28633,7 @@ func (client *Client) EditProxy(req *EditProxyRequest) (*AddedProxy, error) { "proxy_id": req.ProxyId, "proxy": req.Proxy, "enable": req.Enable, + "comment": req.Comment, }, }) if err != nil { @@ -28970,6 +29406,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateMessageUnreadReactions: return UnmarshalUpdateMessageUnreadReactions(result.Data) + case TypeUpdateMessageContainsUnreadPollVotes: + return UnmarshalUpdateMessageContainsUnreadPollVotes(result.Data) + case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(result.Data) @@ -29420,6 +29859,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateNewChosenInlineResult: return UnmarshalUpdateNewChosenInlineResult(result.Data) + case TypeUpdateNewGuestQuery: + return UnmarshalUpdateNewGuestQuery(result.Data) + case TypeUpdateNewCallbackQuery: return UnmarshalUpdateNewCallbackQuery(result.Data) diff --git a/client/type.go b/client/type.go index 4e37f1e..7db699e 100755 --- a/client/type.go +++ b/client/type.go @@ -20,6 +20,7 @@ const ( ClassStickerFullType = "StickerFullType" ClassPollType = "PollType" ClassInputPollType = "InputPollType" + ClassPollVoteRestrictionReason = "PollVoteRestrictionReason" ClassProfileTab = "ProfileTab" ClassUserType = "UserType" ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" @@ -216,6 +217,7 @@ const ( ClassDiffEntity = "DiffEntity" ClassDiffText = "DiffText" ClassFixedText = "FixedText" + ClassTextCompositionStyleExample = "TextCompositionStyleExample" ClassTextCompositionStyle = "TextCompositionStyle" ClassTermsOfService = "TermsOfService" ClassPasskey = "Passkey" @@ -265,6 +267,7 @@ const ( ClassBotCommand = "BotCommand" ClassBotCommands = "BotCommands" ClassBotMenuButton = "BotMenuButton" + ClassBotAccessSettings = "BotAccessSettings" ClassBotVerificationParameters = "BotVerificationParameters" ClassBotVerification = "BotVerification" ClassVerificationStatus = "VerificationStatus" @@ -603,12 +606,12 @@ const ( ClassBusinessConnection = "BusinessConnection" ClassAttachmentMenuBotColor = "AttachmentMenuBotColor" ClassAttachmentMenuBot = "AttachmentMenuBot" - ClassSentWebAppMessage = "SentWebAppMessage" ClassHttpUrl = "HttpUrl" ClassUserLink = "UserLink" ClassTargetChatTypes = "TargetChatTypes" ClassInlineQueryResultsButton = "InlineQueryResultsButton" ClassInlineQueryResults = "InlineQueryResults" + ClassInlineMessageId = "InlineMessageId" ClassPreparedInlineMessageId = "PreparedInlineMessageId" ClassPreparedInlineMessage = "PreparedInlineMessage" ClassCallbackQueryAnswer = "CallbackQueryAnswer" @@ -691,6 +694,7 @@ const ( ClassChatRevenueStatistics = "ChatRevenueStatistics" ClassMessageStatistics = "MessageStatistics" ClassStoryStatistics = "StoryStatistics" + ClassPollVoteStatistics = "PollVoteStatistics" ClassChatRevenueTransaction = "ChatRevenueTransaction" ClassChatRevenueTransactions = "ChatRevenueTransactions" ClassStarRevenueStatus = "StarRevenueStatus" @@ -737,6 +741,7 @@ const ( TypeDiffEntity = "diffEntity" TypeDiffText = "diffText" TypeFixedText = "fixedText" + TypeTextCompositionStyleExample = "textCompositionStyleExample" TypeTextCompositionStyle = "textCompositionStyle" TypeTermsOfService = "termsOfService" TypePasskey = "passkey" @@ -798,6 +803,12 @@ const ( TypePollTypeQuiz = "pollTypeQuiz" TypeInputPollTypeRegular = "inputPollTypeRegular" TypeInputPollTypeQuiz = "inputPollTypeQuiz" + TypePollVoteRestrictionReasonClosed = "pollVoteRestrictionReasonClosed" + TypePollVoteRestrictionReasonYetUnsent = "pollVoteRestrictionReasonYetUnsent" + TypePollVoteRestrictionReasonScheduled = "pollVoteRestrictionReasonScheduled" + TypePollVoteRestrictionReasonCountryRestricted = "pollVoteRestrictionReasonCountryRestricted" + TypePollVoteRestrictionReasonMembershipRequired = "pollVoteRestrictionReasonMembershipRequired" + TypePollVoteRestrictionReasonOther = "pollVoteRestrictionReasonOther" TypeChecklistTask = "checklistTask" TypeInputChecklistTask = "inputChecklistTask" TypeChecklist = "checklist" @@ -841,6 +852,7 @@ const ( TypeBotCommand = "botCommand" TypeBotCommands = "botCommands" TypeBotMenuButton = "botMenuButton" + TypeBotAccessSettings = "botAccessSettings" TypeBotVerificationParameters = "botVerificationParameters" TypeBotVerification = "botVerification" TypeVerificationStatus = "verificationStatus" @@ -1416,6 +1428,7 @@ const ( TypeLinkPreviewTypeStory = "linkPreviewTypeStory" TypeLinkPreviewTypeStoryAlbum = "linkPreviewTypeStoryAlbum" TypeLinkPreviewTypeSupergroupBoost = "linkPreviewTypeSupergroupBoost" + TypeLinkPreviewTypeTextCompositionStyle = "linkPreviewTypeTextCompositionStyle" TypeLinkPreviewTypeTheme = "linkPreviewTypeTheme" TypeLinkPreviewTypeUnsupported = "linkPreviewTypeUnsupported" TypeLinkPreviewTypeUpgradedGift = "linkPreviewTypeUpgradedGift" @@ -1899,6 +1912,7 @@ const ( TypeEmojiReaction = "emojiReaction" TypeReactionUnavailabilityReasonAnonymousAdministrator = "reactionUnavailabilityReasonAnonymousAdministrator" TypeReactionUnavailabilityReasonGuest = "reactionUnavailabilityReasonGuest" + TypeReactionUnavailabilityReasonRestricted = "reactionUnavailabilityReasonRestricted" TypeAnimations = "animations" TypeDiceStickersRegular = "diceStickersRegular" TypeDiceStickersSlotMachine = "diceStickersSlotMachine" @@ -1910,7 +1924,6 @@ const ( TypeBusinessConnection = "businessConnection" TypeAttachmentMenuBotColor = "attachmentMenuBotColor" TypeAttachmentMenuBot = "attachmentMenuBot" - TypeSentWebAppMessage = "sentWebAppMessage" TypeBotWriteAccessAllowReasonConnectedWebsite = "botWriteAccessAllowReasonConnectedWebsite" TypeBotWriteAccessAllowReasonAddedToAttachmentMenu = "botWriteAccessAllowReasonAddedToAttachmentMenu" TypeBotWriteAccessAllowReasonLaunchedWebApp = "botWriteAccessAllowReasonLaunchedWebApp" @@ -1949,6 +1962,7 @@ const ( TypeInlineQueryResultsButtonTypeWebApp = "inlineQueryResultsButtonTypeWebApp" TypeInlineQueryResultsButton = "inlineQueryResultsButton" TypeInlineQueryResults = "inlineQueryResults" + TypeInlineMessageId = "inlineMessageId" TypePreparedInlineMessageId = "preparedInlineMessageId" TypePreparedInlineMessage = "preparedInlineMessage" TypeCallbackQueryPayloadData = "callbackQueryPayloadData" @@ -2041,6 +2055,7 @@ const ( TypePremiumLimitTypeStorySuggestedReactionAreaCount = "premiumLimitTypeStorySuggestedReactionAreaCount" TypePremiumLimitTypeSimilarChatCount = "premiumLimitTypeSimilarChatCount" TypePremiumLimitTypeOwnedBotCount = "premiumLimitTypeOwnedBotCount" + TypePremiumLimitTypeCustomTextCompositionStyleCount = "premiumLimitTypeCustomTextCompositionStyleCount" TypePremiumFeatureIncreasedLimits = "premiumFeatureIncreasedLimits" TypePremiumFeatureIncreasedUploadFileSize = "premiumFeatureIncreasedUploadFileSize" TypePremiumFeatureImprovedDownloadSpeed = "premiumFeatureImprovedDownloadSpeed" @@ -2393,6 +2408,7 @@ const ( TypeInternalLinkTypeStickerSet = "internalLinkTypeStickerSet" TypeInternalLinkTypeStory = "internalLinkTypeStory" TypeInternalLinkTypeStoryAlbum = "internalLinkTypeStoryAlbum" + TypeInternalLinkTypeTextCompositionStyle = "internalLinkTypeTextCompositionStyle" TypeInternalLinkTypeTheme = "internalLinkTypeTheme" TypeInternalLinkTypeUnknownDeepLink = "internalLinkTypeUnknownDeepLink" TypeInternalLinkTypeUpgradedGift = "internalLinkTypeUpgradedGift" @@ -2464,6 +2480,7 @@ const ( TypeTopChatCategoryGroups = "topChatCategoryGroups" TypeTopChatCategoryChannels = "topChatCategoryChannels" TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" + TypeTopChatCategoryGuestBots = "topChatCategoryGuestBots" TypeTopChatCategoryWebAppBots = "topChatCategoryWebAppBots" TypeTopChatCategoryCalls = "topChatCategoryCalls" TypeTopChatCategoryForwardChats = "topChatCategoryForwardChats" @@ -2524,6 +2541,7 @@ const ( TypeChatRevenueStatistics = "chatRevenueStatistics" TypeMessageStatistics = "messageStatistics" TypeStoryStatistics = "storyStatistics" + TypePollVoteStatistics = "pollVoteStatistics" TypeRevenueWithdrawalStatePending = "revenueWithdrawalStatePending" TypeRevenueWithdrawalStateSucceeded = "revenueWithdrawalStateSucceeded" TypeRevenueWithdrawalStateFailed = "revenueWithdrawalStateFailed" @@ -2563,6 +2581,7 @@ const ( TypeUpdateMessageContentOpened = "updateMessageContentOpened" TypeUpdateMessageMentionRead = "updateMessageMentionRead" TypeUpdateMessageUnreadReactions = "updateMessageUnreadReactions" + TypeUpdateMessageContainsUnreadPollVotes = "updateMessageContainsUnreadPollVotes" TypeUpdateMessageFactCheck = "updateMessageFactCheck" TypeUpdateMessageSuggestedPostInfo = "updateMessageSuggestedPostInfo" TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" @@ -2713,6 +2732,7 @@ const ( TypeUpdateBusinessMessagesDeleted = "updateBusinessMessagesDeleted" TypeUpdateNewInlineQuery = "updateNewInlineQuery" TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" + TypeUpdateNewGuestQuery = "updateNewGuestQuery" TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" TypeUpdateNewInlineCallbackQuery = "updateNewInlineCallbackQuery" TypeUpdateNewBusinessCallbackQuery = "updateNewBusinessCallbackQuery" @@ -2810,6 +2830,11 @@ type InputPollType interface { InputPollTypeType() string } +// Reason of vote restriction in the poll for the current user +type PollVoteRestrictionReason interface { + PollVoteRestrictionReasonType() string +} + // Describes a tab shown in a user or a chat profile type ProfileTab interface { ProfileTabType() string @@ -4448,7 +4473,7 @@ type DiffText struct { meta // The text Text string `json:"text"` - // Entities describing changes in the text. Entities doesn't mutually intersect with each other + // Entities describing changes in the text. Entities don't mutually intersect with each other Entities []*DiffEntity `json:"entities"` } @@ -4493,15 +4518,52 @@ func (*FixedText) GetType() string { return TypeFixedText } +// Contains an example of text composition style usage +type TextCompositionStyleExample struct { + meta + // Source text + SourceText *FormattedText `json:"source_text"` + // The text after the style was applied to the source text + ResultText *FormattedText `json:"result_text"` +} + +func (entity *TextCompositionStyleExample) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextCompositionStyleExample + + return json.Marshal((*stub)(entity)) +} + +func (*TextCompositionStyleExample) GetClass() string { + return ClassTextCompositionStyleExample +} + +func (*TextCompositionStyleExample) GetType() string { + return TypeTextCompositionStyleExample +} + // Describes a style that can be used to compose a text type TextCompositionStyle struct { meta // Name of the style Name string `json:"name"` - // Identifier of the custom emoji corresponding to the style + // Identifier of the custom emoji corresponding to the style; 0 if none CustomEmojiId JsonInt64 `json:"custom_emoji_id"` // Title of the style in the user application's language Title string `json:"title"` + // True, if the style is created by a user + IsCustom bool `json:"is_custom"` + // True, if the user is creator of the style + IsCreator bool `json:"is_creator"` + // Number of users that installed the style; for created custom styles only; 0 if unknown + InstallCount int32 `json:"install_count"` + // Prompt of the style; for created custom styles only + Prompt string `json:"prompt"` + // User identifier of the creator of the style; 0 if none of unknown + CreatorUserId int64 `json:"creator_user_id"` + // Example of the style usage in English; may be null if unknown + EnglishExample *TextCompositionStyleExample `json:"english_example"` } func (entity *TextCompositionStyle) MarshalJSON() ([]byte, error) { @@ -4656,6 +4718,8 @@ type AuthorizationStateWaitPremiumPurchase struct { meta // Identifier of the store product that must be bought StoreProductId string `json:"store_product_id"` + // Duration of the Telegram Premium subscription after the purchase; may be 0 if Telegram Premium subscription will not be granted + PremiumDayCount int32 `json:"premium_day_count"` // 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 @@ -4821,7 +4885,7 @@ func (*AuthorizationStateWaitOtherDeviceConfirmation) AuthorizationStateType() s return TypeAuthorizationStateWaitOtherDeviceConfirmation } -// The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration. Call registerUser to accept the terms of service and provide the data +// The user is unregistered and needs to accept terms of service and enter their first name and last name to finish registration. Call registerUser to accept the terms of service and provide the data type AuthorizationStateWaitRegistration struct { meta // Telegram terms of service @@ -6068,11 +6132,11 @@ func (*Outline) GetType() string { // Describes one answer option of a poll type PollOption struct { meta - // Unique identifier of the option in the poll + // Unique identifier of the option in the poll; may be empty if yet unassigned Id string `json:"id"` // Option text; 1-100 characters; may contain only custom emoji entities Text *FormattedText `json:"text"` - // Option media. Currently, can be only of the types messageAnimation, messageLocation, messagePhoto, messageSticker, messageVenue, or messageVideo without caption + // Option media; may be null if none. If present, currently, can be only of the types messageAnimation, messageLocation, messagePhoto, messageSticker, messageVenue, or messageVideo without caption Media MessageContent `json:"media"` // Number of voters for this option, available only for closed or voted polls, or if the current user is the creator of the poll VoterCount int32 `json:"voter_count"` @@ -6150,6 +6214,8 @@ type InputPollOption struct { meta // Option text; 1-100 characters. Only custom emoji entities are allowed to be added and only by Premium users Text *FormattedText `json:"text"` + // Option media; pass null if none; ignored in addPollOption. Must be one of the following types: inputMessageAnimation, non-live inputMessageLocation, inputMessagePhoto, inputMessageSticker, inputMessageVenue, or inputMessageVideo without caption + Media InputMessageContent `json:"media"` } func (entity *InputPollOption) MarshalJSON() ([]byte, error) { @@ -6168,6 +6234,25 @@ func (*InputPollOption) GetType() string { return TypeInputPollOption } +func (inputPollOption *InputPollOption) UnmarshalJSON(data []byte) error { + var tmp struct { + Text *FormattedText `json:"text"` + Media json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputPollOption.Text = tmp.Text + + fieldMedia, _ := UnmarshalInputMessageContent(tmp.Media) + inputPollOption.Media = fieldMedia + + return nil +} + // A regular poll type PollTypeRegular struct{ meta @@ -6200,7 +6285,7 @@ type PollTypeQuiz struct { CorrectOptionIds []int32 `json:"correct_option_ids"` // Text that is shown when the user chooses an incorrect answer or taps on the lamp icon; empty for a yet unanswered poll Explanation *FormattedText `json:"explanation"` - // Media that is shown when the user chooses an incorrect answer or taps on the lamp icon; may be null if none or the poll is unanswered yet. Currently, can be only of the types messageAnimation, messageAudio, messageDocument, messageLocation, messagePhoto, messageVenue, or messageVideo without caption + // Media that is shown when the user chooses an incorrect answer or taps on the lamp icon; may be null if none or the poll is unanswered yet. If present, currently, can be only of the types messageAnimation, messageAudio, messageDocument, messageLocation, messagePhoto, messageVenue, or messageVideo without caption ExplanationMedia MessageContent `json:"explanation_media"` } @@ -6279,6 +6364,8 @@ type InputPollTypeQuiz struct { CorrectOptionIds []int32 `json:"correct_option_ids"` // Text that is shown when the user chooses an incorrect answer or taps on the lamp icon; 0-200 characters with at most 2 line feeds Explanation *FormattedText `json:"explanation"` + // Media that is shown when the user chooses an incorrect answer or taps on the lamp icon; pass null if none. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, non-live inputMessageLocation, inputMessagePhoto, inputMessageVenue, or inputMessageVideo without caption + ExplanationMedia InputMessageContent `json:"explanation_media"` } func (entity *InputPollTypeQuiz) MarshalJSON() ([]byte, error) { @@ -6301,6 +6388,181 @@ func (*InputPollTypeQuiz) InputPollTypeType() string { return TypeInputPollTypeQuiz } +func (inputPollTypeQuiz *InputPollTypeQuiz) UnmarshalJSON(data []byte) error { + var tmp struct { + CorrectOptionIds []int32 `json:"correct_option_ids"` + Explanation *FormattedText `json:"explanation"` + ExplanationMedia json.RawMessage `json:"explanation_media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputPollTypeQuiz.CorrectOptionIds = tmp.CorrectOptionIds + inputPollTypeQuiz.Explanation = tmp.Explanation + + fieldExplanationMedia, _ := UnmarshalInputMessageContent(tmp.ExplanationMedia) + inputPollTypeQuiz.ExplanationMedia = fieldExplanationMedia + + return nil +} + +// The poll is closed +type PollVoteRestrictionReasonClosed struct{ + meta +} + +func (entity *PollVoteRestrictionReasonClosed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PollVoteRestrictionReasonClosed + + return json.Marshal((*stub)(entity)) +} + +func (*PollVoteRestrictionReasonClosed) GetClass() string { + return ClassPollVoteRestrictionReason +} + +func (*PollVoteRestrictionReasonClosed) GetType() string { + return TypePollVoteRestrictionReasonClosed +} + +func (*PollVoteRestrictionReasonClosed) PollVoteRestrictionReasonType() string { + return TypePollVoteRestrictionReasonClosed +} + +// The poll isn't sent yet +type PollVoteRestrictionReasonYetUnsent struct{ + meta +} + +func (entity *PollVoteRestrictionReasonYetUnsent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PollVoteRestrictionReasonYetUnsent + + return json.Marshal((*stub)(entity)) +} + +func (*PollVoteRestrictionReasonYetUnsent) GetClass() string { + return ClassPollVoteRestrictionReason +} + +func (*PollVoteRestrictionReasonYetUnsent) GetType() string { + return TypePollVoteRestrictionReasonYetUnsent +} + +func (*PollVoteRestrictionReasonYetUnsent) PollVoteRestrictionReasonType() string { + return TypePollVoteRestrictionReasonYetUnsent +} + +// The poll is from a scheduled message +type PollVoteRestrictionReasonScheduled struct{ + meta +} + +func (entity *PollVoteRestrictionReasonScheduled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PollVoteRestrictionReasonScheduled + + return json.Marshal((*stub)(entity)) +} + +func (*PollVoteRestrictionReasonScheduled) GetClass() string { + return ClassPollVoteRestrictionReason +} + +func (*PollVoteRestrictionReasonScheduled) GetType() string { + return TypePollVoteRestrictionReasonScheduled +} + +func (*PollVoteRestrictionReasonScheduled) PollVoteRestrictionReasonType() string { + return TypePollVoteRestrictionReasonScheduled +} + +// The user is from a country, users from which aren't allowed to vote +type PollVoteRestrictionReasonCountryRestricted struct { + meta + // Two-letter ISO 3166-1 alpha-2 code of the current user's country + CountryCode string `json:"country_code"` +} + +func (entity *PollVoteRestrictionReasonCountryRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PollVoteRestrictionReasonCountryRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*PollVoteRestrictionReasonCountryRestricted) GetClass() string { + return ClassPollVoteRestrictionReason +} + +func (*PollVoteRestrictionReasonCountryRestricted) GetType() string { + return TypePollVoteRestrictionReasonCountryRestricted +} + +func (*PollVoteRestrictionReasonCountryRestricted) PollVoteRestrictionReasonType() string { + return TypePollVoteRestrictionReasonCountryRestricted +} + +// The user must be a member of the chat for at least a day to vote +type PollVoteRestrictionReasonMembershipRequired struct { + meta + // Identifier of the chat which must be joined for at least a day before the user can vote + ChatId int64 `json:"chat_id"` +} + +func (entity *PollVoteRestrictionReasonMembershipRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PollVoteRestrictionReasonMembershipRequired + + return json.Marshal((*stub)(entity)) +} + +func (*PollVoteRestrictionReasonMembershipRequired) GetClass() string { + return ClassPollVoteRestrictionReason +} + +func (*PollVoteRestrictionReasonMembershipRequired) GetType() string { + return TypePollVoteRestrictionReasonMembershipRequired +} + +func (*PollVoteRestrictionReasonMembershipRequired) PollVoteRestrictionReasonType() string { + return TypePollVoteRestrictionReasonMembershipRequired +} + +// The poll can't be voted by the user due to some other reason +type PollVoteRestrictionReasonOther struct{ + meta +} + +func (entity *PollVoteRestrictionReasonOther) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PollVoteRestrictionReasonOther + + return json.Marshal((*stub)(entity)) +} + +func (*PollVoteRestrictionReasonOther) GetClass() string { + return ClassPollVoteRestrictionReason +} + +func (*PollVoteRestrictionReasonOther) GetType() string { + return TypePollVoteRestrictionReasonOther +} + +func (*PollVoteRestrictionReasonOther) PollVoteRestrictionReasonType() string { + return TypePollVoteRestrictionReasonOther +} + // Describes a task in a checklist type ChecklistTask struct { meta @@ -7070,7 +7332,7 @@ type Poll struct { TotalVoterCount int32 `json:"total_voter_count"` // Identifiers of recent voters, if the poll is non-anonymous and poll results are available RecentVoterIds []MessageSender `json:"recent_voter_ids"` - // True, if the current user can get voters in the poll + // True, if the current user can get voters in the poll using getPollVoters CanGetVoters bool `json:"can_get_voters"` // True, if the poll is anonymous IsAnonymous bool `json:"is_anonymous"` @@ -7078,6 +7340,10 @@ type Poll struct { AllowsMultipleAnswers bool `json:"allows_multiple_answers"` // True, if the poll can be answered multiple times AllowsRevoting bool `json:"allows_revoting"` + // True, if only the users that are members of the chat for more than a day will be able to vote + MembersOnly bool `json:"members_only"` + // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be able to vote. If empty, then all users can participate in the poll + CountryCodes []string `json:"country_codes"` // The list of 0-based poll identifiers in which the options of the poll must be shown; empty if the order of options must not be changed OptionOrder []int32 `json:"option_order"` // Type of the poll @@ -7088,6 +7354,8 @@ type Poll struct { CloseDate int32 `json:"close_date"` // True, if the poll is closed IsClosed bool `json:"is_closed"` + // The reason describing, why the current user can't vote in the poll; may be null if the user can vote in the poll + VoteRestrictionReason PollVoteRestrictionReason `json:"vote_restriction_reason"` } func (entity *Poll) MarshalJSON() ([]byte, error) { @@ -7117,11 +7385,14 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { IsAnonymous bool `json:"is_anonymous"` AllowsMultipleAnswers bool `json:"allows_multiple_answers"` AllowsRevoting bool `json:"allows_revoting"` + MembersOnly bool `json:"members_only"` + CountryCodes []string `json:"country_codes"` OptionOrder []int32 `json:"option_order"` Type json.RawMessage `json:"type"` OpenPeriod int32 `json:"open_period"` CloseDate int32 `json:"close_date"` IsClosed bool `json:"is_closed"` + VoteRestrictionReason json.RawMessage `json:"vote_restriction_reason"` } err := json.Unmarshal(data, &tmp) @@ -7137,6 +7408,8 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { poll.IsAnonymous = tmp.IsAnonymous poll.AllowsMultipleAnswers = tmp.AllowsMultipleAnswers poll.AllowsRevoting = tmp.AllowsRevoting + poll.MembersOnly = tmp.MembersOnly + poll.CountryCodes = tmp.CountryCodes poll.OptionOrder = tmp.OptionOrder poll.OpenPeriod = tmp.OpenPeriod poll.CloseDate = tmp.CloseDate @@ -7148,6 +7421,9 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { fieldType, _ := UnmarshalPollType(tmp.Type) poll.Type = fieldType + fieldVoteRestrictionReason, _ := UnmarshalPollVoteRestrictionReason(tmp.VoteRestrictionReason) + poll.VoteRestrictionReason = fieldVoteRestrictionReason + return nil } @@ -7656,9 +7932,11 @@ type UserTypeBot struct { IsInline bool `json:"is_inline"` // Placeholder for inline queries (displayed on the application input field) InlineQueryPlaceholder string `json:"inline_query_placeholder"` + // True, if the bot can be queried by username from any non-secret chat + SupportsGuestQueries bool `json:"supports_guest_queries"` // True, if the location of the user is expected to be sent with every inline query to this bot NeedLocation bool `json:"need_location"` - // True, if the bot supports connection to Telegram Business accounts + // True, if the bot supports connection to user accounts for chat automation CanConnectToBusiness bool `json:"can_connect_to_business"` // True, if the bot can be added to attachment or side menu CanBeAddedToAttachmentMenu bool `json:"can_be_added_to_attachment_menu"` @@ -7786,6 +8064,31 @@ func (*BotMenuButton) GetType() string { return TypeBotMenuButton } +// Describes users that have access to a bot +type BotAccessSettings struct { + meta + // True, if access to the bot is restricted to its owner and selected users + IsRestricted bool `json:"is_restricted"` + // Identifiers of the users who can use the bot additionally to the owner of the bot + AddedUserIds []int64 `json:"added_user_ids"` +} + +func (entity *BotAccessSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotAccessSettings + + return json.Marshal((*stub)(entity)) +} + +func (*BotAccessSettings) GetClass() string { + return ClassBotAccessSettings +} + +func (*BotAccessSettings) GetType() string { + return TypeBotAccessSettings +} + // Describes parameters of verification that is provided by a bot type BotVerificationParameters struct { meta @@ -8868,6 +9171,8 @@ type ChatPermissions struct { CanUseInlineBots bool `json:"can_use_inline_bots"` // True, if the user may add a link preview to their messages CanAddLinkPreviews bool `json:"can_add_link_previews"` + // True, if the user can react to messages + CanReactToMessages bool `json:"can_react_to_messages"` // True, if the user may change the tag of self CanEditTag bool `json:"can_edit_tag"` // True, if the user can change the chat title, photo, and other settings @@ -10831,7 +11136,7 @@ func (*UpgradedGiftOriginCraft) UpgradedGiftOriginType() string { return TypeUpgradedGiftOriginCraft } -// The rarity is represented as the numeric frequence of the model +// The rarity is represented as the numeric frequency of the model type UpgradedGiftAttributeRarityPerMille struct { meta // The number of upgraded gifts that receive this attribute for each 1000 gifts upgraded; if 0, then it can be shown as "<0.1%" @@ -19428,6 +19733,8 @@ type Message struct { 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"` + // True, if the message is a poll message with unread votes + ContainsUnreadPollVotes bool `json:"contains_unread_poll_votes"` // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages Date int32 `json:"date"` // Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages @@ -19456,6 +19763,8 @@ type Message struct { AutoDeleteIn float64 `json:"auto_delete_in"` // If non-zero, the user identifier of the inline bot through which this message was sent ViaBotUserId int64 `json:"via_bot_user_id"` + // The identifier of the user or chat which used a guest bot to send the message; may be null if none + GuestBotCallerId MessageSender `json:"guest_bot_caller_id"` // If non-zero, the user identifier of the business bot that sent this message SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` // Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead @@ -19512,6 +19821,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { IsPaidStarSuggestedPost bool `json:"is_paid_star_suggested_post"` IsPaidTonSuggestedPost bool `json:"is_paid_ton_suggested_post"` ContainsUnreadMention bool `json:"contains_unread_mention"` + ContainsUnreadPollVotes bool `json:"contains_unread_poll_votes"` Date int32 `json:"date"` EditDate int32 `json:"edit_date"` ForwardInfo *MessageForwardInfo `json:"forward_info"` @@ -19526,6 +19836,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { SelfDestructIn float64 `json:"self_destruct_in"` AutoDeleteIn float64 `json:"auto_delete_in"` ViaBotUserId int64 `json:"via_bot_user_id"` + GuestBotCallerId json.RawMessage `json:"guest_bot_caller_id"` SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` SenderBoostCount int32 `json:"sender_boost_count"` SenderTag string `json:"sender_tag"` @@ -19555,6 +19866,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.IsPaidStarSuggestedPost = tmp.IsPaidStarSuggestedPost message.IsPaidTonSuggestedPost = tmp.IsPaidTonSuggestedPost message.ContainsUnreadMention = tmp.ContainsUnreadMention + message.ContainsUnreadPollVotes = tmp.ContainsUnreadPollVotes message.Date = tmp.Date message.EditDate = tmp.EditDate message.ForwardInfo = tmp.ForwardInfo @@ -19594,6 +19906,9 @@ func (message *Message) UnmarshalJSON(data []byte) error { fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) message.SelfDestructType = fieldSelfDestructType + fieldGuestBotCallerId, _ := UnmarshalMessageSender(tmp.GuestBotCallerId) + message.GuestBotCallerId = fieldGuestBotCallerId + fieldContent, _ := UnmarshalMessageContent(tmp.Content) message.Content = fieldContent @@ -20316,7 +20631,7 @@ func (*SponsoredChats) GetType() string { return TypeSponsoredChats } -// Describes an advertisent to be shown while a video from a message is watched +// Describes an advertisement to be shown while a video from a message is watched type VideoMessageAdvertisement struct { meta // Unique identifier of this result @@ -20752,7 +21067,7 @@ type ScopeNotificationSettings struct { meta // Time left before notifications will be unmuted, in seconds MuteFor int32 `json:"mute_for"` - // Identifier of the notification sound to be played; 0 if sound is disabled + // Identifier of the notification sound to be played; 0 if sound is disabled; pass -1 to use the app-dependent default sound SoundId JsonInt64 `json:"sound_id"` // True, if message content must be displayed in notifications ShowPreview bool `json:"show_preview"` @@ -20760,7 +21075,7 @@ type ScopeNotificationSettings struct { UseDefaultMuteStories bool `json:"use_default_mute_stories"` // True, if story notifications are disabled MuteStories bool `json:"mute_stories"` - // Identifier of the notification sound to be played for stories; 0 if sound is disabled + // Identifier of the notification sound to be played for stories; 0 if sound is disabled; pass -1 to use the app-dependent default sound StorySoundId JsonInt64 `json:"story_sound_id"` // True, if the chat that posted a story must be displayed in notifications ShowStoryPoster bool `json:"show_story_poster"` @@ -20870,7 +21185,7 @@ type ReactionNotificationSettings struct { StoryReactionSource ReactionNotificationSource `json:"story_reaction_source"` // Source of poll votes for which notifications are shown PollVoteSource ReactionNotificationSource `json:"poll_vote_source"` - // Identifier of the notification sound to be played; 0 if sound is disabled + // Identifier of the notification sound to be played; 0 if sound is disabled; pass -1 to use the app-dependent default sound SoundId JsonInt64 `json:"sound_id"` // True, if reaction sender and emoji must be displayed in notifications ShowPreview bool `json:"show_preview"` @@ -27700,6 +28015,33 @@ func (*LinkPreviewTypeSupergroupBoost) LinkPreviewTypeType() string { return TypeLinkPreviewTypeSupergroupBoost } +// The link is a link to a text composition style +type LinkPreviewTypeTextCompositionStyle struct { + meta + // Identifier of the custom emoji corresponding to the style; 0 if none + CustomEmojiId JsonInt64 `json:"custom_emoji_id"` +} + +func (entity *LinkPreviewTypeTextCompositionStyle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeTextCompositionStyle + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeTextCompositionStyle) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeTextCompositionStyle) GetType() string { + return TypeLinkPreviewTypeTextCompositionStyle +} + +func (*LinkPreviewTypeTextCompositionStyle) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeTextCompositionStyle +} + // The link is a link to a cloud theme. TDLib has no theme support yet type LinkPreviewTypeTheme struct { meta @@ -32116,7 +32458,7 @@ type MessagePoll struct { Poll *Poll `json:"poll"` // Description of the poll Description *FormattedText `json:"description"` - // Media attached to the poll. Currently, can be only of the types messageAnimation, messageAudio, messageDocument, messageLocation, messagePhoto, messageVenue, or messageVideo without caption + // Media attached to the poll; may be null if none. If present, currently, can be only of the types messageAnimation, messageAudio, messageDocument, messageLocation, messagePhoto, messageVenue, or messageVideo without caption Media MessageContent `json:"media"` // True, if an option can be added to the poll using addPollOption CanAddOption bool `json:"can_add_option"` @@ -37292,16 +37634,22 @@ 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-getOption("poll_answer_count_max") options + // List of poll answer options; 1-getOption("poll_answer_count_max") options Options []*InputPollOption `json:"options"` // Poll description; pass null to use an empty description; 0-getOption("message_caption_length_max") characters Description *FormattedText `json:"description"` + // Media attached to the poll; pass null if none. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, non-live inputMessageLocation, inputMessagePhoto, inputMessageVenue, or inputMessageVideo without caption + Media InputMessageContent `json:"media"` // True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels IsAnonymous bool `json:"is_anonymous"` // True, if multiple answer options can be chosen simultaneously AllowsMultipleAnswers bool `json:"allows_multiple_answers"` // True, if the poll can be answered multiple times AllowsRevoting bool `json:"allows_revoting"` + // True, if only the users that are members of the chat for more than a day will be able to vote; for channel chats only + MembersOnly bool `json:"members_only"` + // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be able to vote; for channel chats only. If empty, then all users can participate in the poll. There can be up to getOption("poll_country_count_max") chosen countries + CountryCodes []string `json:"country_codes"` // True, if poll options must be shown in a fixed random order ShuffleOptions bool `json:"shuffle_options"` // True, if the poll results will appear only after the poll closes @@ -37341,9 +37689,12 @@ func (inputMessagePoll *InputMessagePoll) UnmarshalJSON(data []byte) error { Question *FormattedText `json:"question"` Options []*InputPollOption `json:"options"` Description *FormattedText `json:"description"` + Media json.RawMessage `json:"media"` IsAnonymous bool `json:"is_anonymous"` AllowsMultipleAnswers bool `json:"allows_multiple_answers"` AllowsRevoting bool `json:"allows_revoting"` + MembersOnly bool `json:"members_only"` + CountryCodes []string `json:"country_codes"` ShuffleOptions bool `json:"shuffle_options"` HideResultsUntilCloses bool `json:"hide_results_until_closes"` Type json.RawMessage `json:"type"` @@ -37363,12 +37714,17 @@ func (inputMessagePoll *InputMessagePoll) UnmarshalJSON(data []byte) error { inputMessagePoll.IsAnonymous = tmp.IsAnonymous inputMessagePoll.AllowsMultipleAnswers = tmp.AllowsMultipleAnswers inputMessagePoll.AllowsRevoting = tmp.AllowsRevoting + inputMessagePoll.MembersOnly = tmp.MembersOnly + inputMessagePoll.CountryCodes = tmp.CountryCodes inputMessagePoll.ShuffleOptions = tmp.ShuffleOptions inputMessagePoll.HideResultsUntilCloses = tmp.HideResultsUntilCloses inputMessagePoll.OpenPeriod = tmp.OpenPeriod inputMessagePoll.CloseDate = tmp.CloseDate inputMessagePoll.IsClosed = tmp.IsClosed + fieldMedia, _ := UnmarshalInputMessageContent(tmp.Media) + inputMessagePoll.Media = fieldMedia + fieldType, _ := UnmarshalInputPollType(tmp.Type) inputMessagePoll.Type = fieldType @@ -37534,6 +37890,8 @@ type MessageProperties struct { CanBeSaved bool `json:"can_be_saved"` // True, if the message can be shared in a story using inputStoryAreaTypeMessage CanBeSharedInStory bool `json:"can_be_shared_in_story"` + // True, if the user can delete reactions of other users in the message using the method deleteMessageReactionsFromSender + CanDeleteReactions bool `json:"can_delete_reactions"` // True, if the message can be edited using the method editMessageMedia CanEditMedia bool `json:"can_edit_media"` // True, if scheduling state of the message can be edited @@ -37550,11 +37908,13 @@ type MessageProperties struct { CanGetMediaTimestampLinks bool `json:"can_get_media_timestamp_links"` // True, if information about the message thread is available through getMessageThread and getMessageThreadHistory CanGetMessageThread bool `json:"can_get_message_thread"` + // True, if the message is a poll and vote statistics are available through getPollVoteStatistics + CanGetPollVoteStatistics bool `json:"can_get_poll_vote_statistics"` // True, if read date of the message can be received through getMessageReadDate 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 + // True, if advertisements for video of the message can be received through 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"` @@ -40788,7 +41148,7 @@ type ChatActiveStories struct { ChatId int64 `json:"chat_id"` // Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list List StoryList `json:"list"` - // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order + // A parameter used to determine order of the stories in the story list; 0 if the stories don'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"` @@ -44022,6 +44382,31 @@ func (*ReactionUnavailabilityReasonGuest) ReactionUnavailabilityReasonType() str return TypeReactionUnavailabilityReasonGuest } +// The user is restricted in the chat +type ReactionUnavailabilityReasonRestricted struct{ + meta +} + +func (entity *ReactionUnavailabilityReasonRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionUnavailabilityReasonRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionUnavailabilityReasonRestricted) GetClass() string { + return ClassReactionUnavailabilityReason +} + +func (*ReactionUnavailabilityReasonRestricted) GetType() string { + return TypeReactionUnavailabilityReasonRestricted +} + +func (*ReactionUnavailabilityReasonRestricted) ReactionUnavailabilityReasonType() string { + return TypeReactionUnavailabilityReasonRestricted +} + // Represents a list of animations type Animations struct { meta @@ -44367,29 +44752,6 @@ func (*AttachmentMenuBot) GetType() string { return TypeAttachmentMenuBot } -// Information about the message sent by answerWebAppQuery -type SentWebAppMessage struct { - meta - // Identifier of the sent inline message, if known - InlineMessageId string `json:"inline_message_id"` -} - -func (entity *SentWebAppMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SentWebAppMessage - - return json.Marshal((*stub)(entity)) -} - -func (*SentWebAppMessage) GetClass() string { - return ClassSentWebAppMessage -} - -func (*SentWebAppMessage) GetType() string { - return TypeSentWebAppMessage -} - // The user connected a website by logging in using Telegram Login Widget on it type BotWriteAccessAllowReasonConnectedWebsite struct { meta @@ -46080,6 +46442,29 @@ func (inlineQueryResults *InlineQueryResults) UnmarshalJSON(data []byte) error { return nil } +// Contains identifier of a sent guest message +type InlineMessageId struct { + meta + // Unique identifier for the message + Id string `json:"id"` +} + +func (entity *InlineMessageId) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineMessageId + + return json.Marshal((*stub)(entity)) +} + +func (*InlineMessageId) GetClass() string { + return ClassInlineMessageId +} + +func (*InlineMessageId) GetType() string { + return TypeInlineMessageId +} + // Represents an inline message that can be sent via the bot type PreparedInlineMessageId struct { meta @@ -48842,6 +49227,31 @@ func (*PremiumLimitTypeOwnedBotCount) PremiumLimitTypeType() string { return TypePremiumLimitTypeOwnedBotCount } +// The maximum number of added text composition styles +type PremiumLimitTypeCustomTextCompositionStyleCount struct{ + meta +} + +func (entity *PremiumLimitTypeCustomTextCompositionStyleCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumLimitTypeCustomTextCompositionStyleCount + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumLimitTypeCustomTextCompositionStyleCount) GetClass() string { + return ClassPremiumLimitType +} + +func (*PremiumLimitTypeCustomTextCompositionStyleCount) GetType() string { + return TypePremiumLimitTypeCustomTextCompositionStyleCount +} + +func (*PremiumLimitTypeCustomTextCompositionStyleCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypeCustomTextCompositionStyleCount +} + // Increased limits type PremiumFeatureIncreasedLimits struct{ meta @@ -58584,7 +58994,7 @@ type InternalLinkTypeRequestManagedBot struct { meta // Username of the bot which will manage the new bot ManagerBotUsername string `json:"manager_bot_username"` - // Suggested username for the bot + // Suggested username for the bot; always ends with "bot" case-insensitive SuggestedBotUsername string `json:"suggested_bot_username"` // Suggested name for the bot; may be empty if not specified SuggestedBotName string `json:"suggested_bot_name"` @@ -58844,6 +59254,33 @@ func (*InternalLinkTypeStoryAlbum) InternalLinkTypeType() string { return TypeInternalLinkTypeStoryAlbum } +// The link is a link to a text composition style. Call searchTextCompositionStyle with the given style name to get information about the style. If the style is found and the user wants to add it, then call addTextCompositionStyle +type InternalLinkTypeTextCompositionStyle struct { + meta + // Name of the style + StyleName string `json:"style_name"` +} + +func (entity *InternalLinkTypeTextCompositionStyle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeTextCompositionStyle + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeTextCompositionStyle) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeTextCompositionStyle) GetType() string { + return TypeInternalLinkTypeTextCompositionStyle +} + +func (*InternalLinkTypeTextCompositionStyle) InternalLinkTypeType() string { + return TypeInternalLinkTypeTextCompositionStyle +} + // The link is a link to a cloud theme. TDLib has no theme support yet type InternalLinkTypeTheme struct { meta @@ -59563,7 +60000,7 @@ func (*FileTypeSecure) FileTypeType() string { return TypeFileTypeSecure } -// The file is a seld-destructing video for a live photo in a private chat +// The file is a self-destructing video for a live photo in a private chat type FileTypeSelfDestructingLivePhotoVideo struct{ meta } @@ -60855,6 +61292,31 @@ func (*TopChatCategoryInlineBots) TopChatCategoryType() string { return TypeTopChatCategoryInlineBots } +// A category containing frequently used chats with bots, which were used as guest bots +type TopChatCategoryGuestBots struct{ + meta +} + +func (entity *TopChatCategoryGuestBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TopChatCategoryGuestBots + + return json.Marshal((*stub)(entity)) +} + +func (*TopChatCategoryGuestBots) GetClass() string { + return ClassTopChatCategory +} + +func (*TopChatCategoryGuestBots) GetType() string { + return TypeTopChatCategoryGuestBots +} + +func (*TopChatCategoryGuestBots) TopChatCategoryType() string { + return TypeTopChatCategoryGuestBots +} + // A category containing frequently used chats with bots, which Web Apps were opened type TopChatCategoryWebAppBots struct{ meta @@ -61905,6 +62367,8 @@ type AddedProxy struct { LastUsedDate int32 `json:"last_used_date"` // True, if the proxy is enabled now IsEnabled bool `json:"is_enabled"` + // Comment for the proxy added by the user + Comment string `json:"comment"` // The proxy Proxy *Proxy `json:"proxy"` } @@ -62771,6 +63235,45 @@ func (storyStatistics *StoryStatistics) UnmarshalJSON(data []byte) error { return nil } +// A detailed statistics about poll votes +type PollVoteStatistics struct { + meta + // A graph containing distribution of votes in the poll + VoteGraph StatisticalGraph `json:"vote_graph"` +} + +func (entity *PollVoteStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PollVoteStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*PollVoteStatistics) GetClass() string { + return ClassPollVoteStatistics +} + +func (*PollVoteStatistics) GetType() string { + return TypePollVoteStatistics +} + +func (pollVoteStatistics *PollVoteStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + VoteGraph json.RawMessage `json:"vote_graph"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldVoteGraph, _ := UnmarshalStatisticalGraph(tmp.VoteGraph) + pollVoteStatistics.VoteGraph = fieldVoteGraph + + return nil +} + // Withdrawal is pending type RevenueWithdrawalStatePending struct{ meta @@ -63289,7 +63792,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 @@ -63978,7 +64481,7 @@ type UpdateMessageUnreadReactions struct { MessageId int64 `json:"message_id"` // The new list of unread reactions UnreadReactions []*UnreadReaction `json:"unread_reactions"` - // The new number of messages with unread reactions left in the chat + // The new number of messages with unread reactions in the chat UnreadReactionCount int32 `json:"unread_reaction_count"` } @@ -64002,6 +64505,39 @@ func (*UpdateMessageUnreadReactions) UpdateType() string { return TypeUpdateMessageUnreadReactions } +// Unread votes were added or removed from a poll message +type UpdateMessageContainsUnreadPollVotes struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // True, if the message is a poll message with unread votes + ContainsUnreadPollVotes bool `json:"contains_unread_poll_votes"` + // The new number of messages with unread poll votes in the chat + UnreadPollVoteCount int32 `json:"unread_poll_vote_count"` +} + +func (entity *UpdateMessageContainsUnreadPollVotes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageContainsUnreadPollVotes + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageContainsUnreadPollVotes) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageContainsUnreadPollVotes) GetType() string { + return TypeUpdateMessageContainsUnreadPollVotes +} + +func (*UpdateMessageContainsUnreadPollVotes) UpdateType() string { + return TypeUpdateMessageContainsUnreadPollVotes +} + // A fact-check added to a message was changed type UpdateMessageFactCheck struct { meta @@ -68969,6 +69505,37 @@ func (*UpdateNewChosenInlineResult) UpdateType() string { return TypeUpdateNewChosenInlineResult } +// A new incoming guest query; for bots only +type UpdateNewGuestQuery struct { + meta + // Unique query identifier + Id JsonInt64 `json:"id"` + // The message with the query + Message *Message `json:"message"` + // The list of reference messages + ReferenceMessages []*Message `json:"reference_messages"` +} + +func (entity *UpdateNewGuestQuery) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewGuestQuery + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewGuestQuery) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewGuestQuery) GetType() string { + return TypeUpdateNewGuestQuery +} + +func (*UpdateNewGuestQuery) UpdateType() string { + return TypeUpdateNewGuestQuery +} + // A new incoming callback query; for bots only type UpdateNewCallbackQuery struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 2f45531..13a0b00 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -545,6 +545,52 @@ func UnmarshalListOfInputPollType(dataList []json.RawMessage) ([]InputPollType, return list, nil } +func UnmarshalPollVoteRestrictionReason(data json.RawMessage) (PollVoteRestrictionReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePollVoteRestrictionReasonClosed: + return UnmarshalPollVoteRestrictionReasonClosed(data) + + case TypePollVoteRestrictionReasonYetUnsent: + return UnmarshalPollVoteRestrictionReasonYetUnsent(data) + + case TypePollVoteRestrictionReasonScheduled: + return UnmarshalPollVoteRestrictionReasonScheduled(data) + + case TypePollVoteRestrictionReasonCountryRestricted: + return UnmarshalPollVoteRestrictionReasonCountryRestricted(data) + + case TypePollVoteRestrictionReasonMembershipRequired: + return UnmarshalPollVoteRestrictionReasonMembershipRequired(data) + + case TypePollVoteRestrictionReasonOther: + return UnmarshalPollVoteRestrictionReasonOther(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPollVoteRestrictionReason(dataList []json.RawMessage) ([]PollVoteRestrictionReason, error) { + list := []PollVoteRestrictionReason{} + + for _, data := range dataList { + entity, err := UnmarshalPollVoteRestrictionReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalProfileTab(data json.RawMessage) (ProfileTab, error) { var meta meta @@ -3578,6 +3624,9 @@ func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { case TypeLinkPreviewTypeSupergroupBoost: return UnmarshalLinkPreviewTypeSupergroupBoost(data) + case TypeLinkPreviewTypeTextCompositionStyle: + return UnmarshalLinkPreviewTypeTextCompositionStyle(data) + case TypeLinkPreviewTypeTheme: return UnmarshalLinkPreviewTypeTheme(data) @@ -6072,6 +6121,9 @@ func UnmarshalReactionUnavailabilityReason(data json.RawMessage) (ReactionUnavai case TypeReactionUnavailabilityReasonGuest: return UnmarshalReactionUnavailabilityReasonGuest(data) + case TypeReactionUnavailabilityReasonRestricted: + return UnmarshalReactionUnavailabilityReasonRestricted(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6731,6 +6783,9 @@ func UnmarshalPremiumLimitType(data json.RawMessage) (PremiumLimitType, error) { case TypePremiumLimitTypeOwnedBotCount: return UnmarshalPremiumLimitTypeOwnedBotCount(data) + case TypePremiumLimitTypeCustomTextCompositionStyleCount: + return UnmarshalPremiumLimitTypeCustomTextCompositionStyleCount(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -8680,6 +8735,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeStoryAlbum: return UnmarshalInternalLinkTypeStoryAlbum(data) + case TypeInternalLinkTypeTextCompositionStyle: + return UnmarshalInternalLinkTypeTextCompositionStyle(data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(data) @@ -9041,6 +9099,9 @@ func UnmarshalTopChatCategory(data json.RawMessage) (TopChatCategory, error) { case TypeTopChatCategoryInlineBots: return UnmarshalTopChatCategoryInlineBots(data) + case TypeTopChatCategoryGuestBots: + return UnmarshalTopChatCategoryGuestBots(data) + case TypeTopChatCategoryWebAppBots: return UnmarshalTopChatCategoryWebAppBots(data) @@ -9609,6 +9670,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateMessageUnreadReactions: return UnmarshalUpdateMessageUnreadReactions(data) + case TypeUpdateMessageContainsUnreadPollVotes: + return UnmarshalUpdateMessageContainsUnreadPollVotes(data) + case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(data) @@ -10059,6 +10123,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateNewChosenInlineResult: return UnmarshalUpdateNewChosenInlineResult(data) + case TypeUpdateNewGuestQuery: + return UnmarshalUpdateNewGuestQuery(data) + case TypeUpdateNewCallbackQuery: return UnmarshalUpdateNewCallbackQuery(data) @@ -10363,6 +10430,14 @@ func UnmarshalFixedText(data json.RawMessage) (*FixedText, error) { return &resp, err } +func UnmarshalTextCompositionStyleExample(data json.RawMessage) (*TextCompositionStyleExample, error) { + var resp TextCompositionStyleExample + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTextCompositionStyle(data json.RawMessage) (*TextCompositionStyle, error) { var resp TextCompositionStyle @@ -10851,6 +10926,54 @@ func UnmarshalInputPollTypeQuiz(data json.RawMessage) (*InputPollTypeQuiz, error return &resp, err } +func UnmarshalPollVoteRestrictionReasonClosed(data json.RawMessage) (*PollVoteRestrictionReasonClosed, error) { + var resp PollVoteRestrictionReasonClosed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPollVoteRestrictionReasonYetUnsent(data json.RawMessage) (*PollVoteRestrictionReasonYetUnsent, error) { + var resp PollVoteRestrictionReasonYetUnsent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPollVoteRestrictionReasonScheduled(data json.RawMessage) (*PollVoteRestrictionReasonScheduled, error) { + var resp PollVoteRestrictionReasonScheduled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPollVoteRestrictionReasonCountryRestricted(data json.RawMessage) (*PollVoteRestrictionReasonCountryRestricted, error) { + var resp PollVoteRestrictionReasonCountryRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPollVoteRestrictionReasonMembershipRequired(data json.RawMessage) (*PollVoteRestrictionReasonMembershipRequired, error) { + var resp PollVoteRestrictionReasonMembershipRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPollVoteRestrictionReasonOther(data json.RawMessage) (*PollVoteRestrictionReasonOther, error) { + var resp PollVoteRestrictionReasonOther + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChecklistTask(data json.RawMessage) (*ChecklistTask, error) { var resp ChecklistTask @@ -11195,6 +11318,14 @@ func UnmarshalBotMenuButton(data json.RawMessage) (*BotMenuButton, error) { return &resp, err } +func UnmarshalBotAccessSettings(data json.RawMessage) (*BotAccessSettings, error) { + var resp BotAccessSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBotVerificationParameters(data json.RawMessage) (*BotVerificationParameters, error) { var resp BotVerificationParameters @@ -15795,6 +15926,14 @@ func UnmarshalLinkPreviewTypeSupergroupBoost(data json.RawMessage) (*LinkPreview return &resp, err } +func UnmarshalLinkPreviewTypeTextCompositionStyle(data json.RawMessage) (*LinkPreviewTypeTextCompositionStyle, error) { + var resp LinkPreviewTypeTextCompositionStyle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLinkPreviewTypeTheme(data json.RawMessage) (*LinkPreviewTypeTheme, error) { var resp LinkPreviewTypeTheme @@ -19659,6 +19798,14 @@ func UnmarshalReactionUnavailabilityReasonGuest(data json.RawMessage) (*Reaction return &resp, err } +func UnmarshalReactionUnavailabilityReasonRestricted(data json.RawMessage) (*ReactionUnavailabilityReasonRestricted, error) { + var resp ReactionUnavailabilityReasonRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAnimations(data json.RawMessage) (*Animations, error) { var resp Animations @@ -19747,14 +19894,6 @@ func UnmarshalAttachmentMenuBot(data json.RawMessage) (*AttachmentMenuBot, error return &resp, err } -func UnmarshalSentWebAppMessage(data json.RawMessage) (*SentWebAppMessage, error) { - var resp SentWebAppMessage - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalBotWriteAccessAllowReasonConnectedWebsite(data json.RawMessage) (*BotWriteAccessAllowReasonConnectedWebsite, error) { var resp BotWriteAccessAllowReasonConnectedWebsite @@ -20059,6 +20198,14 @@ func UnmarshalInlineQueryResults(data json.RawMessage) (*InlineQueryResults, err return &resp, err } +func UnmarshalInlineMessageId(data json.RawMessage) (*InlineMessageId, error) { + var resp InlineMessageId + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPreparedInlineMessageId(data json.RawMessage) (*PreparedInlineMessageId, error) { var resp PreparedInlineMessageId @@ -20795,6 +20942,14 @@ func UnmarshalPremiumLimitTypeOwnedBotCount(data json.RawMessage) (*PremiumLimit return &resp, err } +func UnmarshalPremiumLimitTypeCustomTextCompositionStyleCount(data json.RawMessage) (*PremiumLimitTypeCustomTextCompositionStyleCount, error) { + var resp PremiumLimitTypeCustomTextCompositionStyleCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumFeatureIncreasedLimits(data json.RawMessage) (*PremiumFeatureIncreasedLimits, error) { var resp PremiumFeatureIncreasedLimits @@ -23611,6 +23766,14 @@ func UnmarshalInternalLinkTypeStoryAlbum(data json.RawMessage) (*InternalLinkTyp return &resp, err } +func UnmarshalInternalLinkTypeTextCompositionStyle(data json.RawMessage) (*InternalLinkTypeTextCompositionStyle, error) { + var resp InternalLinkTypeTextCompositionStyle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeTheme(data json.RawMessage) (*InternalLinkTypeTheme, error) { var resp InternalLinkTypeTheme @@ -24179,6 +24342,14 @@ func UnmarshalTopChatCategoryInlineBots(data json.RawMessage) (*TopChatCategoryI return &resp, err } +func UnmarshalTopChatCategoryGuestBots(data json.RawMessage) (*TopChatCategoryGuestBots, error) { + var resp TopChatCategoryGuestBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTopChatCategoryWebAppBots(data json.RawMessage) (*TopChatCategoryWebAppBots, error) { var resp TopChatCategoryWebAppBots @@ -24659,6 +24830,14 @@ func UnmarshalStoryStatistics(data json.RawMessage) (*StoryStatistics, error) { return &resp, err } +func UnmarshalPollVoteStatistics(data json.RawMessage) (*PollVoteStatistics, error) { + var resp PollVoteStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalRevenueWithdrawalStatePending(data json.RawMessage) (*RevenueWithdrawalStatePending, error) { var resp RevenueWithdrawalStatePending @@ -24971,6 +25150,14 @@ func UnmarshalUpdateMessageUnreadReactions(data json.RawMessage) (*UpdateMessage return &resp, err } +func UnmarshalUpdateMessageContainsUnreadPollVotes(data json.RawMessage) (*UpdateMessageContainsUnreadPollVotes, error) { + var resp UpdateMessageContainsUnreadPollVotes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateMessageFactCheck(data json.RawMessage) (*UpdateMessageFactCheck, error) { var resp UpdateMessageFactCheck @@ -26171,6 +26358,14 @@ func UnmarshalUpdateNewChosenInlineResult(data json.RawMessage) (*UpdateNewChose return &resp, err } +func UnmarshalUpdateNewGuestQuery(data json.RawMessage) (*UpdateNewGuestQuery, error) { + var resp UpdateNewGuestQuery + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewCallbackQuery(data json.RawMessage) (*UpdateNewCallbackQuery, error) { var resp UpdateNewCallbackQuery @@ -26495,6 +26690,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFixedText: return UnmarshalFixedText(data) + case TypeTextCompositionStyleExample: + return UnmarshalTextCompositionStyleExample(data) + case TypeTextCompositionStyle: return UnmarshalTextCompositionStyle(data) @@ -26678,6 +26876,24 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputPollTypeQuiz: return UnmarshalInputPollTypeQuiz(data) + case TypePollVoteRestrictionReasonClosed: + return UnmarshalPollVoteRestrictionReasonClosed(data) + + case TypePollVoteRestrictionReasonYetUnsent: + return UnmarshalPollVoteRestrictionReasonYetUnsent(data) + + case TypePollVoteRestrictionReasonScheduled: + return UnmarshalPollVoteRestrictionReasonScheduled(data) + + case TypePollVoteRestrictionReasonCountryRestricted: + return UnmarshalPollVoteRestrictionReasonCountryRestricted(data) + + case TypePollVoteRestrictionReasonMembershipRequired: + return UnmarshalPollVoteRestrictionReasonMembershipRequired(data) + + case TypePollVoteRestrictionReasonOther: + return UnmarshalPollVoteRestrictionReasonOther(data) + case TypeChecklistTask: return UnmarshalChecklistTask(data) @@ -26807,6 +27023,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBotMenuButton: return UnmarshalBotMenuButton(data) + case TypeBotAccessSettings: + return UnmarshalBotAccessSettings(data) + case TypeBotVerificationParameters: return UnmarshalBotVerificationParameters(data) @@ -28532,6 +28751,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewTypeSupergroupBoost: return UnmarshalLinkPreviewTypeSupergroupBoost(data) + case TypeLinkPreviewTypeTextCompositionStyle: + return UnmarshalLinkPreviewTypeTextCompositionStyle(data) + case TypeLinkPreviewTypeTheme: return UnmarshalLinkPreviewTypeTheme(data) @@ -29981,6 +30203,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeReactionUnavailabilityReasonGuest: return UnmarshalReactionUnavailabilityReasonGuest(data) + case TypeReactionUnavailabilityReasonRestricted: + return UnmarshalReactionUnavailabilityReasonRestricted(data) + case TypeAnimations: return UnmarshalAnimations(data) @@ -30014,9 +30239,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAttachmentMenuBot: return UnmarshalAttachmentMenuBot(data) - case TypeSentWebAppMessage: - return UnmarshalSentWebAppMessage(data) - case TypeBotWriteAccessAllowReasonConnectedWebsite: return UnmarshalBotWriteAccessAllowReasonConnectedWebsite(data) @@ -30131,6 +30353,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInlineQueryResults: return UnmarshalInlineQueryResults(data) + case TypeInlineMessageId: + return UnmarshalInlineMessageId(data) + case TypePreparedInlineMessageId: return UnmarshalPreparedInlineMessageId(data) @@ -30407,6 +30632,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumLimitTypeOwnedBotCount: return UnmarshalPremiumLimitTypeOwnedBotCount(data) + case TypePremiumLimitTypeCustomTextCompositionStyleCount: + return UnmarshalPremiumLimitTypeCustomTextCompositionStyleCount(data) + case TypePremiumFeatureIncreasedLimits: return UnmarshalPremiumFeatureIncreasedLimits(data) @@ -31463,6 +31691,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeStoryAlbum: return UnmarshalInternalLinkTypeStoryAlbum(data) + case TypeInternalLinkTypeTextCompositionStyle: + return UnmarshalInternalLinkTypeTextCompositionStyle(data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(data) @@ -31676,6 +31907,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTopChatCategoryInlineBots: return UnmarshalTopChatCategoryInlineBots(data) + case TypeTopChatCategoryGuestBots: + return UnmarshalTopChatCategoryGuestBots(data) + case TypeTopChatCategoryWebAppBots: return UnmarshalTopChatCategoryWebAppBots(data) @@ -31856,6 +32090,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryStatistics: return UnmarshalStoryStatistics(data) + case TypePollVoteStatistics: + return UnmarshalPollVoteStatistics(data) + case TypeRevenueWithdrawalStatePending: return UnmarshalRevenueWithdrawalStatePending(data) @@ -31973,6 +32210,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateMessageUnreadReactions: return UnmarshalUpdateMessageUnreadReactions(data) + case TypeUpdateMessageContainsUnreadPollVotes: + return UnmarshalUpdateMessageContainsUnreadPollVotes(data) + case TypeUpdateMessageFactCheck: return UnmarshalUpdateMessageFactCheck(data) @@ -32423,6 +32663,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateNewChosenInlineResult: return UnmarshalUpdateNewChosenInlineResult(data) + case TypeUpdateNewGuestQuery: + return UnmarshalUpdateNewGuestQuery(data) + case TypeUpdateNewCallbackQuery: return UnmarshalUpdateNewCallbackQuery(data) diff --git a/data/td_api.tl b/data/td_api.tl index 78e880a..cdbcf9d 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -119,18 +119,29 @@ formattedText text:string entities:vector = FormattedText; //@description Represents a change of a text @offset Offset of the entity, in UTF-16 code units @length Length of the entity, in UTF-16 code units @type Type of the entity diffEntity offset:int32 length:int32 type:DiffEntityType = DiffEntity; -//@description A text with some changes highlighted @text The text @entities Entities describing changes in the text. Entities doesn't mutually intersect with each other +//@description A text with some changes highlighted @text The text @entities Entities describing changes in the text. Entities don't mutually intersect with each other diffText text:string entities:vector = DiffText; //@description A text fixed using fixTextWithAi @text The resulting text @diff_text Changes made to the original text fixedText text:formattedText diff_text:diffText = FixedText; +//@description Contains an example of text composition style usage +//@source_text Source text +//@result_text The text after the style was applied to the source text +textCompositionStyleExample source_text:formattedText result_text:formattedText = TextCompositionStyleExample; + //@description Describes a style that can be used to compose a text //@name Name of the style -//@custom_emoji_id Identifier of the custom emoji corresponding to the style +//@custom_emoji_id Identifier of the custom emoji corresponding to the style; 0 if none //@title Title of the style in the user application's language -textCompositionStyle name:string custom_emoji_id:int64 title:string = TextCompositionStyle; +//@is_custom True, if the style is created by a user +//@is_creator True, if the user is creator of the style +//@install_count Number of users that installed the style; for created custom styles only; 0 if unknown +//@prompt Prompt of the style; for created custom styles only +//@creator_user_id User identifier of the creator of the style; 0 if none of unknown +//@english_example Example of the style usage in English; may be null if unknown +textCompositionStyle name:string custom_emoji_id:int64 title:string is_custom:Bool is_creator:Bool install_count:int32 prompt:string creator_user_id:int53 english_example:textCompositionStyleExample = TextCompositionStyle; //@description Contains Telegram terms of service @text Text of the terms of service @min_user_age The minimum age of a user to be able to accept the terms; 0 if age isn't restricted @show_popup True, if a blocking popup with terms of service must be shown to the user @@ -160,9 +171,10 @@ 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 +//@premium_day_count Duration of the Telegram Premium subscription after the purchase; may be 0 if Telegram Premium subscription will not be granted //@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; +authorizationStateWaitPremiumPurchase store_product_id:string premium_day_count:int32 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 @@ -182,7 +194,7 @@ authorizationStateWaitCode code_info:authenticationCodeInfo = AuthorizationState //@description The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link @link A tg:// URL for the QR code. The link will be updated frequently authorizationStateWaitOtherDeviceConfirmation link:string = AuthorizationState; -//@description The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration. Call registerUser to accept the terms of service and provide the data @terms_of_service Telegram terms of service +//@description The user is unregistered and needs to accept terms of service and enter their first name and last name to finish registration. Call registerUser to accept the terms of service and provide the data @terms_of_service Telegram terms of service authorizationStateWaitRegistration terms_of_service:termsOfService = AuthorizationState; //@description The user has been authorized, but needs to enter a 2-step verification password to start using the application. @@ -400,9 +412,9 @@ outline paths:vector = Outline; //@description Describes one answer option of a poll -//@id Unique identifier of the option in the poll +//@id Unique identifier of the option in the poll; may be empty if yet unassigned //@text Option text; 1-100 characters; may contain only custom emoji entities -//@media Option media. Currently, can be only of the types messageAnimation, messageLocation, messagePhoto, messageSticker, messageVenue, or messageVideo without caption +//@media Option media; may be null if none. If present, currently, can be only of the types messageAnimation, messageLocation, messagePhoto, messageSticker, messageVenue, or messageVideo without caption //@voter_count Number of voters for this option, available only for closed or voted polls, or if the current user is the creator of the poll //@vote_percentage The percentage of votes for this option; 0-100 //@recent_voter_ids Identifiers of recent voters for the option, if the poll is non-anonymous and poll results are available @@ -414,7 +426,9 @@ pollOption id:string text:formattedText media:MessageContent voter_count:int32 v //@description Describes one answer option of a poll to be created //@text Option text; 1-100 characters. Only custom emoji entities are allowed to be added and only by Premium users -inputPollOption text:formattedText = InputPollOption; +//@media Option media; pass null if none; ignored in addPollOption. Must be one of the following types: +//-inputMessageAnimation, non-live inputMessageLocation, inputMessagePhoto, inputMessageSticker, inputMessageVenue, or inputMessageVideo without caption +inputPollOption text:formattedText media:InputMessageContent = InputPollOption; //@class PollType @description Describes the type of poll @@ -426,7 +440,7 @@ pollTypeRegular = PollType; //@correct_option_ids Increasing list of 0-based identifiers of the correct answer options; empty for a yet unanswered poll //@explanation Text that is shown when the user chooses an incorrect answer or taps on the lamp icon; empty for a yet unanswered poll //@explanation_media Media that is shown when the user chooses an incorrect answer or taps on the lamp icon; may be null if none or the poll is unanswered yet. -//-Currently, can be only of the types messageAnimation, messageAudio, messageDocument, messageLocation, messagePhoto, messageVenue, or messageVideo without caption +//-If present, currently, can be only of the types messageAnimation, messageAudio, messageDocument, messageLocation, messagePhoto, messageVenue, or messageVideo without caption pollTypeQuiz correct_option_ids:vector explanation:formattedText explanation_media:MessageContent = PollType; @@ -438,7 +452,31 @@ inputPollTypeRegular allow_adding_options:Bool = InputPollType; //@description A poll in quiz mode, which has predefined correct answers //@correct_option_ids Increasing list of 0-based identifiers of the correct answer options; must be non-empty //@explanation Text that is shown when the user chooses an incorrect answer or taps on the lamp icon; 0-200 characters with at most 2 line feeds -inputPollTypeQuiz correct_option_ids:vector explanation:formattedText = InputPollType; +//@explanation_media Media that is shown when the user chooses an incorrect answer or taps on the lamp icon; pass null if none. Must be one of the following types: +//-inputMessageAnimation, inputMessageAudio, inputMessageDocument, non-live inputMessageLocation, inputMessagePhoto, inputMessageVenue, or inputMessageVideo without caption +inputPollTypeQuiz correct_option_ids:vector explanation:formattedText explanation_media:InputMessageContent = InputPollType; + + +//@class PollVoteRestrictionReason @description Reason of vote restriction in the poll for the current user + +//@description The poll is closed +pollVoteRestrictionReasonClosed = PollVoteRestrictionReason; + +//@description The poll isn't sent yet +pollVoteRestrictionReasonYetUnsent = PollVoteRestrictionReason; + +//@description The poll is from a scheduled message +pollVoteRestrictionReasonScheduled = PollVoteRestrictionReason; + +//@description The user is from a country, users from which aren't allowed to vote +//@country_code Two-letter ISO 3166-1 alpha-2 code of the current user's country +pollVoteRestrictionReasonCountryRestricted country_code:string = PollVoteRestrictionReason; + +//@description The user must be a member of the chat for at least a day to vote @chat_id Identifier of the chat which must be joined for at least a day before the user can vote +pollVoteRestrictionReasonMembershipRequired chat_id:int53 = PollVoteRestrictionReason; + +//@description The poll can't be voted by the user due to some other reason +pollVoteRestrictionReasonOther = PollVoteRestrictionReason; //@description Describes a task in a checklist @@ -618,16 +656,19 @@ webApp short_name:string title:string description:string photo:photo animation:a //@options List of poll answer options //@total_voter_count Total number of voters, participating in the poll //@recent_voter_ids Identifiers of recent voters, if the poll is non-anonymous and poll results are available -//@can_get_voters True, if the current user can get voters in the poll +//@can_get_voters True, if the current user can get voters in the poll using getPollVoters //@is_anonymous True, if the poll is anonymous //@allows_multiple_answers True, if multiple answer options can be chosen simultaneously //@allows_revoting True, if the poll can be answered multiple times +//@members_only True, if only the users that are members of the chat for more than a day will be able to vote +//@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be able to vote. If empty, then all users can participate in the poll //@option_order The list of 0-based poll identifiers in which the options of the poll must be shown; empty if the order of options must not be changed //@type Type of the poll //@open_period Amount of time the poll will be active after creation, in seconds //@close_date Point in time (Unix timestamp) when the poll will automatically be closed //@is_closed True, if the poll is closed -poll id:int64 question:formattedText options:vector total_voter_count:int32 recent_voter_ids:vector can_get_voters:Bool is_anonymous:Bool allows_multiple_answers:Bool allows_revoting:Bool option_order:vector type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll; +//@vote_restriction_reason The reason describing, why the current user can't vote in the poll; may be null if the user can vote in the poll +poll id:int64 question:formattedText options:vector total_voter_count:int32 recent_voter_ids:vector can_get_voters:Bool is_anonymous:Bool allows_multiple_answers:Bool allows_revoting:Bool members_only:Bool country_codes:vector option_order:vector type:PollType open_period:int32 close_date:int32 is_closed:Bool vote_restriction_reason:PollVoteRestrictionReason = Poll; //@description Describes an alternative re-encoded quality of a video file @@ -726,11 +767,12 @@ userTypeDeleted = UserType; //@can_manage_bots True, if the bot can manage other bots //@is_inline True, if the bot supports inline queries //@inline_query_placeholder Placeholder for inline queries (displayed on the application input field) +//@supports_guest_queries True, if the bot can be queried by username from any non-secret chat //@need_location True, if the location of the user is expected to be sent with every inline query to this bot -//@can_connect_to_business True, if the bot supports connection to Telegram Business accounts +//@can_connect_to_business True, if the bot supports connection to user accounts for chat automation //@can_be_added_to_attachment_menu True, if the bot can be added to attachment or side menu //@active_user_count The number of recently active users of the bot -userTypeBot can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool has_main_web_app:Bool has_topics:Bool allows_users_to_create_topics:Bool can_manage_bots:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_connect_to_business:Bool can_be_added_to_attachment_menu:Bool active_user_count:int32 = UserType; +userTypeBot can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool has_main_web_app:Bool has_topics:Bool allows_users_to_create_topics:Bool can_manage_bots:Bool is_inline:Bool inline_query_placeholder:string supports_guest_queries:Bool need_location:Bool can_connect_to_business:Bool can_be_added_to_attachment_menu:Bool active_user_count:int32 = UserType; //@description No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type userTypeUnknown = UserType; @@ -747,6 +789,11 @@ botCommands bot_user_id:int53 commands:vector = BotCommands; //@url URL of a Web App to open when the button is pressed. If the link is of the type internalLinkTypeWebApp, then it must be processed accordingly. Otherwise, the link must be passed to openWebApp botMenuButton text:string url:string = BotMenuButton; +//@description Describes users that have access to a bot +//@is_restricted True, if access to the bot is restricted to its owner and selected users +//@added_user_ids Identifiers of the users who can use the bot additionally to the owner of the bot +botAccessSettings is_restricted:Bool added_user_ids:vector = BotAccessSettings; + //@description Describes parameters of verification that is provided by a bot //@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign @@ -966,12 +1013,13 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; //@can_send_games True, if the user can send games. Implies can_send_messages permissions //@can_use_inline_bots True, if the user can use inline bots. Implies can_send_messages permissions //@can_add_link_previews True, if the user may add a link preview to their messages +//@can_react_to_messages True, if the user can react to messages //@can_edit_tag True, if the user may change the tag of self //@can_change_info True, if the user can change the chat title, photo, and other settings //@can_invite_users True, if the user can invite new users to the chat //@can_pin_messages True, if the user can pin messages //@can_create_topics True, if the user can create topics -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_edit_tag:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_create_topics:Bool = ChatPermissions; +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_react_to_messages:Bool can_edit_tag: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, @@ -1359,7 +1407,7 @@ upgradedGiftOriginCraft = UpgradedGiftOrigin; //@class UpgradedGiftAttributeRarity @description Describes rarity of an upgraded gift attribute -//@description The rarity is represented as the numeric frequence of the model +//@description The rarity is represented as the numeric frequency of the model //@per_mille The number of upgraded gifts that receive this attribute for each 1000 gifts upgraded; if 0, then it can be shown as "<0.1%" upgradedGiftAttributeRarityPerMille per_mille:int32 = UpgradedGiftAttributeRarity; @@ -2867,6 +2915,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@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 +//@contains_unread_poll_votes True, if the message is a poll message with unread votes //@date Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages //@edit_date Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages //@forward_info Information about the initial message sender; may be null if none or unknown @@ -2881,6 +2930,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@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 //@via_bot_user_id If non-zero, the user identifier of the inline bot through which this message was sent +//@guest_bot_caller_id The identifier of the user or chat which used a guest bot to send the message; may be null if none //@sender_business_bot_user_id If non-zero, the user identifier of the business bot that sent this message //@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead //@sender_tag Tag of the sender of the message in the supergroup at the time the message was sent; may be empty if none or unknown. For messages sent in basic groups or supergroup administrators, the current custom title or tag must be used instead @@ -2892,7 +2942,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@summary_language_code IETF language tag of the message language on which it can be summarized; empty if summary isn't available for the message //@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 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 sender_tag:string paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 restriction_info:restrictionInfo summary_language_code: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 contains_unread_poll_votes: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 topic_id:MessageTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 guest_bot_caller_id:MessageSender sender_business_bot_user_id:int53 sender_boost_count:int32 sender_tag:string paid_message_star_count:int53 author_signature:string media_album_id:int64 effect_id:int64 restriction_info:restrictionInfo summary_language_code: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 @@ -3000,7 +3050,7 @@ 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 +//@description Describes an advertisement 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 displayed before it can be hidden by the user, in seconds @@ -3094,11 +3144,11 @@ chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_so //@description Contains information about notification settings for several chats //@mute_for Time left before notifications will be unmuted, in seconds -//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled +//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled; pass -1 to use the app-dependent default sound //@show_preview True, if message content must be displayed in notifications //@use_default_mute_stories If true, story notifications are received only for the first 5 chats from topChatCategoryUsers regardless of the value of mute_stories //@mute_stories True, if story notifications are disabled -//@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled +//@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled; pass -1 to use the app-dependent default sound //@show_story_poster True, if the chat that posted a story must be displayed in notifications //@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message //@disable_mention_notifications True, if notifications for messages with mentions will be created as for an ordinary unread message @@ -3121,7 +3171,7 @@ reactionNotificationSourceAll = ReactionNotificationSource; //@message_reaction_source Source of message reactions for which notifications are shown //@story_reaction_source Source of story reactions for which notifications are shown //@poll_vote_source Source of poll votes for which notifications are shown -//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled +//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled; pass -1 to use the app-dependent default sound //@show_preview True, if reaction sender and emoji must be displayed in notifications reactionNotificationSettings message_reaction_source:ReactionNotificationSource story_reaction_source:ReactionNotificationSource poll_vote_source:ReactionNotificationSource sound_id:int64 show_preview:Bool = ReactionNotificationSettings; @@ -4167,6 +4217,9 @@ 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; +//@description The link is a link to a text composition style @custom_emoji_id Identifier of the custom emoji corresponding to the style; 0 if none +linkPreviewTypeTextCompositionStyle custom_emoji_id:int64 = LinkPreviewType; + //@description The link is a link to a cloud theme. TDLib has no theme support yet @documents The list of files with theme description @settings Settings for the cloud theme; may be null if unknown linkPreviewTypeTheme documents:vector settings:themeSettings = LinkPreviewType; @@ -4845,7 +4898,7 @@ messageGame game:game = MessageContent; //@description A message with a poll //@poll Information about the poll //@param_description Description of the poll -//@media Media attached to the poll. Currently, can be only of the types messageAnimation, messageAudio, messageDocument, messageLocation, messagePhoto, messageVenue, or messageVideo without caption +//@media Media attached to the poll; may be null if none. If present, currently, can be only of the types messageAnimation, messageAudio, messageDocument, messageLocation, messagePhoto, messageVenue, or messageVideo without caption //@can_add_option True, if an option can be added to the poll using addPollOption messagePoll poll:poll description:formattedText media:MessageContent can_add_option:Bool = MessageContent; @@ -5608,18 +5661,23 @@ inputMessageInvoice invoice:invoice title:string description:string photo_url:st //@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-getOption("poll_answer_count_max") options +//@options List of poll answer options; 1-getOption("poll_answer_count_max") options //@param_description Poll description; pass null to use an empty description; 0-getOption("message_caption_length_max") characters +//@media Media attached to the poll; pass null if none. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, non-live inputMessageLocation, +//-inputMessagePhoto, inputMessageVenue, or inputMessageVideo without caption //@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels //@allows_multiple_answers True, if multiple answer options can be chosen simultaneously //@allows_revoting True, if the poll can be answered multiple times +//@members_only True, if only the users that are members of the chat for more than a day will be able to vote; for channel chats only +//@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be able to vote; for channel chats only. If empty, then all users can participate in the poll. +//-There can be up to getOption("poll_country_count_max") chosen countries //@shuffle_options True, if poll options must be shown in a fixed random order //@hide_results_until_closes True, if the poll results will appear only after the poll closes //@type Type of the poll //@open_period Amount of time the poll will be active after creation, in seconds; 0-getOption("poll_open_period_max"); pass 0 if not specified //@close_date Point in time (Unix timestamp) when the poll will automatically be closed; must be 0-getOption("poll_open_period_max") seconds in the future; pass 0 if not specified //@is_closed True, if the poll needs to be sent already closed; for bots only -inputMessagePoll question:formattedText options:vector description:formattedText is_anonymous:Bool allows_multiple_answers:Bool allows_revoting:Bool shuffle_options:Bool hide_results_until_closes:Bool type:InputPollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent; +inputMessagePoll question:formattedText options:vector description:formattedText media:InputMessageContent is_anonymous:Bool allows_multiple_answers:Bool allows_revoting:Bool members_only:Bool country_codes:vector shuffle_options:Bool hide_results_until_closes:Bool type:InputPollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent; //@description A stake dice message //@state_hash Hash of the stake dice state. The state hash can be used only if it was received recently enough. Otherwise, a new state must be requested using getStakeDiceState @@ -5665,6 +5723,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@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 //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage +//@can_delete_reactions True, if the user can delete reactions of other users in the message using the method deleteMessageReactionsFromSender //@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 @@ -5673,9 +5732,10 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@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 //@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory +//@can_get_poll_vote_statistics True, if the message is a poll and vote statistics are available through getPollVoteStatistics //@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_video_advertisements True, if advertisements for video of the message can be received through 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 @@ -5686,7 +5746,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@has_protected_content_by_current_user True, if content of the message can't be saved locally, because it is protected by the current user; if true, then can_be_saved is false //@has_protected_content_by_other_user True, if content of the message can't be saved locally, because it is protected by the other user; if true, then can_be_saved is false //@need_show_statistics True, if message statistics must be available from context menu of the message -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 has_protected_content_by_current_user:Bool has_protected_content_by_other_user: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_delete_reactions: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_poll_vote_statistics: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 has_protected_content_by_current_user:Bool has_protected_content_by_other_user:Bool need_show_statistics:Bool = MessageProperties; //@description Contains properties of a poll option and describes actions that can be done with the option right now //@can_be_deleted True, if the option can be deleted using deletePollOption @@ -6190,7 +6250,7 @@ storyInfo story_id:int32 date:int32 is_for_close_friends:Bool is_live:Bool = Sto //@description Describes active stories posted by a chat //@chat_id Identifier of the chat that posted the stories //@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list -//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order +//@order A parameter used to determine order of the stories in the story list; 0 if the stories don'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 @@ -6760,6 +6820,9 @@ reactionUnavailabilityReasonAnonymousAdministrator = ReactionUnavailabilityReaso //@description The user isn't a member of the supergroup and can't send messages and reactions there without joining reactionUnavailabilityReasonGuest = ReactionUnavailabilityReason; +//@description The user is restricted in the chat +reactionUnavailabilityReasonRestricted = ReactionUnavailabilityReason; + //@description Represents a list of animations @animations List of animations animations animations:vector = Animations; @@ -6844,9 +6907,6 @@ attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotCol //@web_app_placeholder Default placeholder for opened Web Apps in SVG format; may be null attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool request_write_access:Bool is_added:Bool show_in_attachment_menu:Bool show_in_side_menu:Bool show_disclaimer_in_side_menu:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file ios_side_menu_icon:file android_icon:file android_side_menu_icon:file macos_icon:file macos_side_menu_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; -//@description Information about the message sent by answerWebAppQuery @inline_message_id Identifier of the sent inline message, if known -sentWebAppMessage inline_message_id:string = SentWebAppMessage; - //@class BotWriteAccessAllowReason @description Describes a reason why a bot was allowed to write messages to the current user @@ -7125,6 +7185,9 @@ inlineQueryResultsButton text:string type:InlineQueryResultsButtonType = InlineQ inlineQueryResults inline_query_id:int64 button:inlineQueryResultsButton results:vector next_offset:string = InlineQueryResults; +//@description Contains identifier of a sent guest message @id Unique identifier for the message +inlineMessageId id:string = InlineMessageId; + //@description Represents an inline message that can be sent via the bot //@id Unique identifier for the message //@expiration_date Point in time (Unix timestamp) when the message can't be used anymore @@ -7468,6 +7531,9 @@ premiumLimitTypeSimilarChatCount = PremiumLimitType; //@description The maximum number of owned bots premiumLimitTypeOwnedBotCount = PremiumLimitType; +//@description The maximum number of added text composition styles +premiumLimitTypeCustomTextCompositionStyleCount = PremiumLimitType; + //@class PremiumFeature @description Describes a feature available to Premium users @@ -8964,7 +9030,7 @@ internalLinkTypeQrCodeAuthentication = InternalLinkType; //-If the chat is found, the chat is a chat with a bot and the bot has can_manage_bots == true, then show bot creation confirmation dialog //-with the given suggested_bot_username and suggested_bot_name. If user agrees, call createBot with via_link == true to create the bot //@manager_bot_username Username of the bot which will manage the new bot -//@suggested_bot_username Suggested username for the bot +//@suggested_bot_username Suggested username for the bot; always ends with "bot" case-insensitive //@suggested_bot_name Suggested name for the bot; may be empty if not specified internalLinkTypeRequestManagedBot manager_bot_username:string suggested_bot_username:string suggested_bot_name:string = InternalLinkType; @@ -9002,6 +9068,11 @@ internalLinkTypeStory story_poster_username:string story_id:int32 = InternalLink //@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 text composition style. Call searchTextCompositionStyle with the given style name to get information about the style. +//-If the style is found and the user wants to add it, then call addTextCompositionStyle +//@style_name Name of the style +internalLinkTypeTextCompositionStyle style_name:string = 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; @@ -9112,7 +9183,7 @@ fileTypeSecretThumbnail = FileType; //@description The file is a file from Secure storage used for storing Telegram Passport files fileTypeSecure = FileType; -//@description The file is a seld-destructing video for a live photo in a private chat +//@description The file is a self-destructing video for a live photo in a private chat fileTypeSelfDestructingLivePhotoVideo = FileType; //@description The file is a self-destructing photo in a private chat @@ -9317,6 +9388,9 @@ topChatCategoryChannels = TopChatCategory; //@description A category containing frequently used chats with inline bots sorted by their usage in inline mode topChatCategoryInlineBots = TopChatCategory; +//@description A category containing frequently used chats with bots, which were used as guest bots +topChatCategoryGuestBots = TopChatCategory; + //@description A category containing frequently used chats with bots, which Web Apps were opened topChatCategoryWebAppBots = TopChatCategory; @@ -9465,8 +9539,9 @@ proxyTypeMtproto secret:string = ProxyType; //@id Unique identifier of the proxy //@last_used_date Point in time (Unix timestamp) when the proxy was last used; 0 if never //@is_enabled True, if the proxy is enabled now +//@comment Comment for the proxy added by the user //@proxy The proxy -addedProxy id:int32 last_used_date:int32 is_enabled:Bool proxy:proxy = AddedProxy; +addedProxy id:int32 last_used_date:int32 is_enabled:Bool comment:string proxy:proxy = AddedProxy; //@description Represents a list of added proxy servers @proxies List of proxy servers addedProxies proxies:vector = AddedProxies; @@ -9609,6 +9684,10 @@ messageStatistics message_interaction_graph:StatisticalGraph message_reaction_gr //@story_reaction_graph A graph containing number of story reactions storyStatistics story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph = StoryStatistics; +//@description A detailed statistics about poll votes +//@vote_graph A graph containing distribution of votes in the poll +pollVoteStatistics vote_graph:StatisticalGraph = PollVoteStatistics; + //@class RevenueWithdrawalState @description Describes state of a revenue withdrawal @@ -9697,7 +9776,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; @@ -9790,9 +9869,16 @@ updateMessageMentionRead chat_id:int53 message_id:int53 unread_mention_count:int //@chat_id Chat identifier //@message_id Message identifier //@unread_reactions The new list of unread reactions -//@unread_reaction_count The new number of messages with unread reactions left in the chat +//@unread_reaction_count The new number of messages with unread reactions in the chat updateMessageUnreadReactions chat_id:int53 message_id:int53 unread_reactions:vector unread_reaction_count:int32 = Update; +//@description Unread votes were added or removed from a poll message +//@chat_id Chat identifier +//@message_id Message identifier +//@contains_unread_poll_votes True, if the message is a poll message with unread votes +//@unread_poll_vote_count The new number of messages with unread poll votes in the chat +updateMessageContainsUnreadPollVotes chat_id:int53 message_id:int53 contains_unread_poll_votes:Bool unread_poll_vote_count:int32 = Update; + //@description A fact-check added to a message was changed //@chat_id Chat identifier //@message_id Message identifier @@ -10418,6 +10504,12 @@ updateNewInlineQuery id:int64 sender_user_id:int53 user_location:location chat_t //@inline_message_id Identifier of the sent inline message, if known updateNewChosenInlineResult sender_user_id:int53 user_location:location query:string result_id:string inline_message_id:string = Update; +//@description A new incoming guest query; for bots only +//@id Unique query identifier +//@message The message with the query +//@reference_messages The list of reference messages +updateNewGuestQuery id:int64 message:message reference_messages:vector = Update; + //@description A new incoming callback query; for bots only //@id Unique query identifier //@sender_user_id Identifier of the user who sent the query @@ -10603,16 +10695,18 @@ setTdlibParameters use_test_dc:Bool database_directory:string files_directory:st setAuthenticationPhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = Ok; //@description Checks whether an in-store purchase of Telegram Premium is possible before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +//@premium_day_count The number of days for which the Telegram Premium subscription will be granted //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency -checkAuthenticationPremiumPurchase currency:string amount:int53 = Ok; +checkAuthenticationPremiumPurchase premium_day_count:int32 currency:string amount:int53 = Ok; //@description Informs server about an in-store purchase of Telegram Premium before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase //@transaction Information about the transaction //@is_restore Pass true if this is a restore of a Telegram Premium purchase; only for App Store +//@premium_day_count The number of days for which the Telegram Premium subscription will be granted //@currency ISO 4217 currency code of the payment currency //@amount Paid amount, in the smallest units of the currency -setAuthenticationPremiumPurchaseTransaction transaction:StoreTransaction is_restore:Bool currency:string amount:int53 = Ok; +setAuthenticationPremiumPurchaseTransaction transaction:StoreTransaction is_restore:Bool premium_day_count:int32 currency:string amount:int53 = Ok; //@description Sets the email address of the user and sends an authentication code to the email address. Works only when the current authorization state is authorizationStateWaitEmailAddress @email_address The email address of the user setAuthenticationEmailAddress email_address:string = Ok; @@ -11331,6 +11425,41 @@ getMessageEmbeddingCode chat_id:int53 message_id:int53 for_album:Bool = Text; getMessageLinkInfo url:string = MessageLinkInfo; +//@description Creates a custom text composition style. May return an error with a message "TONES_SAVED_TOO_MANY" if the maximum number of added custom styles has been reached +//@title Title of the style; 1-getOption("text_composition_style_title_length_max") characters +//@custom_emoji_id Identifier of the custom emoji corresponding to the style +//@prompt Prompt that will be used for text composition; 1-getOption("text_composition_style_prompt_length_max") characters +//@show_creator Pass true if the current user must be shown as the creator of the style +createTextCompositionStyle title:string custom_emoji_id:int64 prompt:string show_creator:Bool = TextCompositionStyle; + +//@description Edits a custom text composition style that was created by the current user +//@name Name of the style +//@title Title of the style; 1-getOption("text_composition_style_title_length_max") characters +//@custom_emoji_id Identifier of the custom emoji corresponding to the style +//@prompt Prompt that will be used for text composition; 1-getOption("text_composition_style_prompt_length_max") characters +//@show_creator Pass true if the current user must be shown as the creator of the style +editTextCompositionStyle name:string title:string custom_emoji_id:int64 prompt:string show_creator:Bool = TextCompositionStyle; + +//@description Deletes a custom text composition style that was created by the current user +//@name Name of the style +deleteTextCompositionStyle name:string = Ok; + +//@description Searches a custom text composition style by its name @name Name of the style +searchTextCompositionStyle name:string = TextCompositionStyle; + +//@description Returns an example of usage of a custom text composition style +//@name Name of the style +//@example_number 0-based unique number of the requested example; must be non-negative and less than getOption("text_composition_style_example_count") +getTextCompositionStyleExample name:string example_number:int32 = TextCompositionStyleExample; + +//@description Adds a custom text composition style to the list of used by the user styles. May return an error with a message "TONES_SAVED_TOO_MANY" if the maximum number of added custom styles has been reached +//@name Name of the style +addTextCompositionStyle name:string = Ok; + +//@description Removes a custom text composition style from the list of used by the user styles. If the style was created by the current user, then it can only be deleted +//@name Name of the style +removeTextCompositionStyle name:string = Ok; + //@description Translates a text to the given language; must not be used in secret chats. If the current user is a Telegram Premium user, then text formatting is preserved //@text Text to translate //@to_language_code Language code of the language to which the message is translated. Must be one of @@ -11922,6 +12051,17 @@ addMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_ //@reaction_type Type of the reaction to remove. The paid reaction can't be removed removeMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType = Ok; +//@description Deletes all recent reactions added by the specified sender in a chat. Supported only for basic groups and supergroups; requires can_delete_messages administrator right +//@chat_id Chat identifier +//@sender_id Identifier of the sender of reactions to delete +deleteAllRecentMessageReactionsFromSender chat_id:int53 sender_id:MessageSender = Ok; + +//@description Deletes all reactions added by the specified sender on a message +//@chat_id Chat identifier +//@message_id Identifier of the message containing the reactions. Use messageProperties.can_delete_reactions to check whether the method can be used for a message +//@sender_id Identifier of the sender of reactions to delete +deleteMessageReactionsFromSender chat_id:int53 message_id:int53 sender_id:MessageSender = Ok; + //@description Returns the list of message sender identifiers, which can be used to send a paid reaction in a chat @chat_id Chat identifier getChatAvailablePaidMessageReactionSenders chat_id:int53 = MessageSenders; @@ -12030,7 +12170,7 @@ getThemeParametersJsonString theme:themeParameters = Text; //@option The new option addPollOption chat_id:int53 message_id:int53 option:inputPollOption = Ok; -//@description Adds an option to a poll +//@description Deletes an option from a poll //@chat_id Identifier of the chat to which the poll belongs //@message_id Identifier of the message containing the poll //@option_id Unique identifier of the option. Use pollOptionProperties.can_be_deleted to check whether the option can be deleted by the user @@ -12051,6 +12191,12 @@ setPollAnswer chat_id:int53 message_id:int53 option_ids:vector = Ok; //@limit The maximum number of voters to be returned; must be positive and can't be greater than 50. For optimal performance, the number of returned voters is chosen by TDLib and can be smaller than the specified limit, even if the end of the voter list has not been reached getPollVoters chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit:int32 = PollVoters; +//@description Returns statistics of poll votes in a poll +//@chat_id Identifier of the chat to which the poll belongs +//@message_id Identifier of the message containing the poll. Use messageProperties.can_get_poll_vote_statistics to check whether the method can be used for a message +//@is_dark Pass true if a dark theme is used by the application +getPollVoteStatistics chat_id:int53 message_id:int53 is_dark:Bool = PollVoteStatistics; + //@description Stops a poll //@chat_id Identifier of the chat to which the poll belongs //@message_id Identifier of the message containing the poll. Use messageProperties.can_be_edited to check whether the poll can be stopped @@ -12132,6 +12278,11 @@ getInlineQueryResults bot_user_id:int53 chat_id:int53 user_location:location que //@next_offset Offset for the next inline query; pass an empty string if there are no more results answerInlineQuery inline_query_id:int64 is_personal:Bool button:inlineQueryResultsButton results:vector cache_time:int32 next_offset:string = Ok; +//@description Sets the result of a guest query; for bots only +//@guest_query_id Identifier of the guest query +//@result The result of the query +answerGuestQuery guest_query_id:int64 result:InputInlineQueryResult = InlineMessageId; + //@description Saves an inline message to be sent by the given user; for bots only //@user_id Identifier of the user //@result The description of the message @@ -12211,7 +12362,7 @@ closeWebApp web_app_launch_id:int64 = Ok; //@description Sets the result of interaction with a Web App and sends corresponding message on behalf of the user to the chat from which the query originated; for bots only //@web_app_query_id Identifier of the Web App query //@result The result of the query -answerWebAppQuery web_app_query_id:string result:InputInlineQueryResult = SentWebAppMessage; +answerWebAppQuery web_app_query_id:string result:InputInlineQueryResult = InlineMessageId; //@description Checks whether a file can be downloaded and saved locally by Web App request //@bot_user_id Identifier of the bot, providing the Web App @@ -12283,7 +12434,7 @@ sendChatAction chat_id:int53 topic_id:MessageTopic business_connection_id:string //@chat_id Chat identifier //@forum_topic_id The forum topic identifier in which the message will be sent; pass 0 if none //@draft_id Unique identifier of the draft -//@text Draft text of the message +//@text Draft text of the message; pass null to show a "Thinking..." placeholder sendTextMessageDraft chat_id:int53 forum_topic_id:int32 draft_id:int64 text:formattedText = Ok; @@ -12707,7 +12858,7 @@ getStakeDiceState = StakeDiceState; //@description Returns saved notification sound by its identifier. Returns a 404 error if there is no saved notification sound with the specified identifier @notification_sound_id Identifier of the notification sound -getSavedNotificationSound notification_sound_id:int64 = NotificationSounds; +getSavedNotificationSound notification_sound_id:int64 = NotificationSound; //@description Returns the list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used getSavedNotificationSounds = NotificationSounds; @@ -13634,6 +13785,11 @@ toggleBotCanManageEmojiStatus bot_user_id:int53 can_manage_emoji_status:Bool = O //@description Changes the emoji status of a user; for bots only @user_id Identifier of the user @emoji_status New emoji status; pass null to switch to the default badge setUserEmojiStatus user_id:int53 emoji_status:emojiStatus = Ok; +//@description Returns messages in the personal chat of a given user; for bots only +//@user_id User identifier +//@limit The maximum number of messages to be returned; 1-20 +getPersonalChatHistory user_id:int53 limit:int32 = Messages; + //@description Searches a user by their phone number. Returns a 404 error if the user can't be found //@phone_number Phone number to search for @@ -13662,8 +13818,11 @@ getUserProfileAudios user_id:int53 offset:int32 limit:int32 = Audios; isProfileAudio file_id:int32 = Ok; //@description Adds an audio file to the beginning of the profile audio files of the current user -//@file_id Identifier of the audio file to be added. The file must have been uploaded to the server -addProfileAudio file_id:int32 = Ok; +//@audio The audio file to be added +//@duration Duration of the audio, in seconds; may be replaced by the server; ignored for already uploaded files +//@title Title of the audio; 0-64 characters; may be replaced by the server; ignored for already uploaded files +//@performer Performer of the audio; 0-64 characters, may be replaced by the server; ignored for already uploaded files +addProfileAudio audio:InputFile duration:int32 title:string performer:string = Ok; //@description Changes position of an audio file in the profile audio files of the current user //@file_id Identifier of the file from profile audio files, which position will be changed @@ -14086,10 +14245,16 @@ checkBotUsername username:string = CheckChatUsernameResult; //@via_link Pass true if the bot is created from an internalLinkTypeRequestManagedBot link createBot manager_bot_user_id:int53 name:string username:string via_link:Bool = User; -//@description Returns token of a created bot; for bots only -//@bot_user_id Identifier of the created bot +//@description Returns token of a managed bot; for bots only +//@bot_user_id Identifier of the managed bot //@revoke Pass true to revoke the current token and create a new one -getBotToken bot_user_id:int53 revoke:Bool = Text; +getManagedBotToken bot_user_id:int53 revoke:Bool = Text; + +//@description Returns access settings of a managed bot; for bots only @bot_user_id Identifier of the managed bot +getManagedBotAccessSettings bot_user_id:int53 = BotAccessSettings; + +//@description Sets access settings of a managed bot; for bots only @bot_user_id Identifier of the managed bot @settings New access settings +setManagedBotAccessSettings bot_user_id:int53 settings:botAccessSettings = Ok; //@description Sets the name of a bot. Can be called only if userTypeBot.can_be_edited == true //@bot_user_id Identifier of the target bot @@ -14500,7 +14665,7 @@ getUpgradedGiftValueInfo name:string = UpgradedGiftValueInfo; //@password The 2-step verification password of the current user getUpgradedGiftWithdrawalUrl received_gift_id:string password:string = HttpUrl; -//@description Returns promotional anumation for upgraded gifts +//@description Returns promotional animation for upgraded gifts getUpgradedGiftsPromotionalAnimation = Animation; //@description Changes resale price of a unique gift owned by the current user @@ -15229,13 +15394,15 @@ getApplicationDownloadLink = HttpUrl; //@description Adds a proxy server for network requests. Can be called before authorization //@proxy The proxy to add //@enable Pass true to immediately enable the proxy -addProxy proxy:proxy enable:Bool = AddedProxy; +//@comment Comment to set for the proxy +addProxy proxy:proxy enable:Bool comment:string = AddedProxy; //@description Edits an existing proxy server for network requests. Can be called before authorization //@proxy_id Proxy identifier //@proxy The new information about the proxy //@enable Pass true to immediately enable the proxy -editProxy proxy_id:int32 proxy:proxy enable:Bool = AddedProxy; +//@comment New comment for the proxy +editProxy proxy_id:int32 proxy:proxy enable:Bool comment:string = AddedProxy; //@description Enables a proxy. Only one proxy can be enabled at a time. Can be called before authorization @proxy_id Proxy identifier enableProxy proxy_id:int32 = Ok;