From 869b97df283ff46517dd45381443f7cc8d30b376 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sun, 5 Feb 2023 06:54:46 +0800 Subject: [PATCH] Update to TDLib 1.8.11 --- client/function.go | 357 ++++++++++++- client/type.go | 1148 +++++++++++++++++++++++++++++++++++++++-- client/unmarshaler.go | 560 +++++++++++++++++++- data/td_api.tl | 365 ++++++++++--- 4 files changed, 2270 insertions(+), 160 deletions(-) diff --git a/client/function.go b/client/function.go index 5a165ca..c6d3dc8 100755 --- a/client/function.go +++ b/client/function.go @@ -71,7 +71,7 @@ type SetTdlibParametersRequest struct { DatabaseDirectory string `json:"database_directory"` // The path to the directory for storing files; if empty, database_directory will be used FilesDirectory string `json:"files_directory"` - // Encryption key for the database + // Encryption key for the database. If the encryption key is invalid, then an error with code 401 will be returned DatabaseEncryptionKey []byte `json:"database_encryption_key"` // Pass true to keep information about downloaded and uploaded files between application restarts UseFileDatabase bool `json:"use_file_database"` @@ -142,7 +142,7 @@ type SetAuthenticationPhoneNumberRequest struct { Settings *PhoneNumberAuthenticationSettings `json:"settings"` } -// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNumberRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -266,7 +266,7 @@ type RequestQrCodeAuthenticationRequest struct { OtherUserIds []int64 `json:"other_user_ids"` } -// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword func (client *Client) RequestQrCodeAuthentication(req *RequestQrCodeAuthenticationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -419,6 +419,32 @@ func (client *Client) RecoverAuthenticationPassword(req *RecoverAuthenticationPa return UnmarshalOk(result.Data) } +type SendAuthenticationFirebaseSmsRequest struct { + // SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application + Token string `json:"token"` +} + +// Sends Firebase Authentication SMS to the phone number of the user. Works only when the current authorization state is authorizationStateWaitCode and the server returned code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos +func (client *Client) SendAuthenticationFirebaseSms(req *SendAuthenticationFirebaseSmsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendAuthenticationFirebaseSms", + }, + Data: map[string]interface{}{ + "token": req.Token, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CheckAuthenticationBotTokenRequest struct { // The bot token Token string `json:"token"` @@ -1268,7 +1294,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, the invoice message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, and topic messages without replied message respectively +// Returns information about a message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, and topic messages without replied message respectively func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1553,7 +1579,7 @@ type SearchPublicChatRequest struct { Username string `json:"username"` } -// Searches a public chat by its username. Currently, only private chats, supergroups and channels can be public. Returns the chat if found; otherwise an error is returned +// Searches a public chat by its username. Currently, only private chats, supergroups and channels can be public. Returns the chat if found; otherwise, an error is returned func (client *Client) SearchPublicChat(req *SearchPublicChatRequest) (*Chat, error) { result, err := client.Send(Request{ meta: meta{ @@ -2815,22 +2841,19 @@ func (client *Client) GetMessageLinkInfo(req *GetMessageLinkInfoRequest) (*Messa type TranslateTextRequest struct { // Text to translate - Text string `json:"text"` - // A two-letter ISO 639-1 language code of the language from which the message is translated. If empty, the language will be detected automatically - FromLanguageCode string `json:"from_language_code"` - // A two-letter ISO 639-1 language code of the language to which the message is translated + Text *FormattedText `json:"text"` + // ISO language code of the language to which the message is translated. Must be one of "af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", "fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", "ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", "st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu" ToLanguageCode string `json:"to_language_code"` } -// Translates a text to the given language. Returns a 404 error if the translation can't be performed -func (client *Client) TranslateText(req *TranslateTextRequest) (*Text, error) { +// Translates a text to the given language. If the current user is a Telegram Premium user, then text formatting is preserved +func (client *Client) TranslateText(req *TranslateTextRequest) (*FormattedText, error) { result, err := client.Send(Request{ meta: meta{ Type: "translateText", }, Data: map[string]interface{}{ "text": req.Text, - "from_language_code": req.FromLanguageCode, "to_language_code": req.ToLanguageCode, }, }) @@ -2842,7 +2865,39 @@ func (client *Client) TranslateText(req *TranslateTextRequest) (*Text, error) { return nil, buildResponseError(result.Data) } - return UnmarshalText(result.Data) + return UnmarshalFormattedText(result.Data) +} + +type TranslateMessageTextRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // ISO language code of the language to which the message is translated. Must be one of "af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", "fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", "ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", "st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu" + ToLanguageCode string `json:"to_language_code"` +} + +// Extracts text or caption of the given message and translates it to the given language. If the current user is a Telegram Premium user, then text formatting is preserved +func (client *Client) TranslateMessageText(req *TranslateMessageTextRequest) (*FormattedText, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "translateMessageText", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "to_language_code": req.ToLanguageCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFormattedText(result.Data) } type RecognizeSpeechRequest struct { @@ -4919,6 +4974,82 @@ func (client *Client) GetLoginUrl(req *GetLoginUrlRequest) (*HttpUrl, error) { return UnmarshalHttpUrl(result.Data) } +type ShareUserWithBotRequest struct { + // Identifier of the chat with the bot + ChatId int64 `json:"chat_id"` + // Identifier of the message with the button + MessageId int64 `json:"message_id"` + // Identifier of the button + ButtonId int32 `json:"button_id"` + // Identifier of the shared user + SharedUserId int64 `json:"shared_user_id"` + // Pass true to check that the user can be shared by the button instead of actually sharing them + OnlyCheck bool `json:"only_check"` +} + +// Shares a user after pressing a keyboardButtonTypeRequestUser button with the bot +func (client *Client) ShareUserWithBot(req *ShareUserWithBotRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "shareUserWithBot", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "button_id": req.ButtonId, + "shared_user_id": req.SharedUserId, + "only_check": req.OnlyCheck, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ShareChatWithBotRequest struct { + // Identifier of the chat with the bot + ChatId int64 `json:"chat_id"` + // Identifier of the message with the button + MessageId int64 `json:"message_id"` + // Identifier of the button + ButtonId int32 `json:"button_id"` + // Identifier of the shared chat + SharedChatId int64 `json:"shared_chat_id"` + // Pass true to check that the chat can be shared by the button instead of actually sharing it. Doesn't check bot_is_member and bot_administrator_rights restrictions. If the bot must be a member, then all chats from getGroupsInCommon and all chats, where the user can add the bot, are suitable. In the latter case the bot will be automatically added to the chat. If the bot must be an administrator, then all chats, where the bot already has requested rights or can be added to administrators by the user, are suitable. In the latter case the bot will be automatically granted requested rights + OnlyCheck bool `json:"only_check"` +} + +// Shares a chat after pressing a keyboardButtonTypeRequestChat button with the bot +func (client *Client) ShareChatWithBot(req *ShareChatWithBotRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "shareChatWithBot", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "button_id": req.ButtonId, + "shared_chat_id": req.SharedChatId, + "only_check": req.OnlyCheck, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetInlineQueryResultsRequest struct { // The identifier of the target bot BotUserId int64 `json:"bot_user_id"` @@ -6103,7 +6234,9 @@ func (client *Client) CreateNewBasicGroupChat(req *CreateNewBasicGroupChatReques type CreateNewSupergroupChatRequest struct { // Title of the new chat; 1-128 characters Title string `json:"title"` - // Pass true to create a channel chat + // Pass true to create a forum supergroup chat + IsForum bool `json:"is_forum"` + // Pass true to create a channel chat; ignored if a forum is created IsChannel bool `json:"is_channel"` // Chat description; 0-255 characters Description string `json:"description"` @@ -6123,6 +6256,7 @@ func (client *Client) CreateNewSupergroupChat(req *CreateNewSupergroupChatReques }, Data: map[string]interface{}{ "title": req.Title, + "is_forum": req.IsForum, "is_channel": req.IsChannel, "description": req.Description, "location": req.Location, @@ -6669,6 +6803,35 @@ func (client *Client) ToggleChatHasProtectedContent(req *ToggleChatHasProtectedC return UnmarshalOk(result.Data) } +type ToggleChatIsTranslatableRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of is_translatable + IsTranslatable bool `json:"is_translatable"` +} + +// Changes the tranlatable state of a chat; for Telegram Premium users only +func (client *Client) ToggleChatIsTranslatable(req *ToggleChatIsTranslatableRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatIsTranslatable", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_translatable": req.IsTranslatable, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleChatIsMarkedAsUnreadRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -10413,7 +10576,7 @@ func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*C type GetStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` - // Search query; an emoji or a keyword prefix. If empty, returns all known installed stickers + // Search query; a space-separated list of emoji or a keyword prefix. If empty, returns all known installed stickers Query string `json:"query"` // The maximum number of stickers to be returned Limit int32 `json:"limit"` @@ -10421,7 +10584,7 @@ type GetStickersRequest struct { ChatId int64 `json:"chat_id"` } -// Returns stickers from the installed sticker sets that correspond to a given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned +// Returns stickers from the installed sticker sets that correspond to any of the given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned func (client *Client) GetStickers(req *GetStickersRequest) (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -10446,20 +10609,23 @@ func (client *Client) GetStickers(req *GetStickersRequest) (*Stickers, error) { } type SearchStickersRequest struct { - // String representation of emoji; must be non-empty - Emoji string `json:"emoji"` + // Type of the stickers to return + StickerType StickerType `json:"sticker_type"` + // Space-separated list of emoji to search for; must be non-empty + Emojis string `json:"emojis"` // The maximum number of stickers to be returned; 0-100 Limit int32 `json:"limit"` } -// Searches for stickers from public sticker sets that correspond to a given emoji +// Searches for stickers from public sticker sets that correspond to any of the given emoji func (client *Client) SearchStickers(req *SearchStickersRequest) (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ Type: "searchStickers", }, Data: map[string]interface{}{ - "emoji": req.Emoji, + "sticker_type": req.StickerType, + "emojis": req.Emojis, "limit": req.Limit, }, }) @@ -11052,6 +11218,32 @@ func (client *Client) SearchEmojis(req *SearchEmojisRequest) (*Emojis, error) { return UnmarshalEmojis(result.Data) } +type GetEmojiCategoriesRequest struct { + // Type of emoji categories to return; pass null to get default emoji categories + Type EmojiCategoryType `json:"type"` +} + +// Returns available emojis categories +func (client *Client) GetEmojiCategories(req *GetEmojiCategoriesRequest) (*EmojiCategories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getEmojiCategories", + }, + Data: map[string]interface{}{ + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiCategories(result.Data) +} + type GetAnimatedEmojiRequest struct { // The emoji Emoji string `json:"emoji"` @@ -11130,6 +11322,44 @@ func (client *Client) GetCustomEmojiStickers(req *GetCustomEmojiStickersRequest) return UnmarshalStickers(result.Data) } +// Returns default list of custom emoji stickers for placing on a chat photo +func (client *Client) GetDefaultChatPhotoCustomEmojiStickers() (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDefaultChatPhotoCustomEmojiStickers", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + +// Returns default list of custom emoji stickers for placing on a profile photo +func (client *Client) GetDefaultProfilePhotoCustomEmojiStickers() (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDefaultProfilePhotoCustomEmojiStickers", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + // Returns saved animations func (client *Client) GetSavedAnimations() (*Animations, error) { result, err := client.Send(Request{ @@ -11763,7 +11993,7 @@ type GetCommandsRequest struct { LanguageCode string `json:"language_code"` } -// Returns the list of commands supported by the bot for the given user scope and language; for bots only +// Returns list of commands supported by the bot for the given user scope and language; for bots only func (client *Client) GetCommands(req *GetCommandsRequest) (*BotCommands, error) { result, err := client.Send(Request{ meta: meta{ @@ -12426,11 +12656,11 @@ func (client *Client) ToggleSupergroupHasAggressiveAntiSpamEnabled(req *ToggleSu type ToggleSupergroupIsForumRequest struct { // Identifier of the supergroup SupergroupId int64 `json:"supergroup_id"` - // New value of is_forum. A supergroup can be converted to a forum, only if it has at least getOption("forum_member_count_min") members + // New value of is_forum IsForum bool `json:"is_forum"` } -// Toggles whether the supergroup is a forum; requires owner privileges in the supergroup +// Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums func (client *Client) ToggleSupergroupIsForum(req *ToggleSupergroupIsForumRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14134,6 +14364,73 @@ func (client *Client) SetAutoDownloadSettings(req *SetAutoDownloadSettingsReques return UnmarshalOk(result.Data) } +// Returns autosave settings for the current user +func (client *Client) GetAutosaveSettings() (*AutosaveSettings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAutosaveSettings", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAutosaveSettings(result.Data) +} + +type SetAutosaveSettingsRequest struct { + // Autosave settings scope + Scope AutosaveSettingsScope `json:"scope"` + // New autosave settings for the scope; pass null to set autosave settings to default + Settings *ScopeAutosaveSettings `json:"settings"` +} + +// Sets autosave settings for the given scope +func (client *Client) SetAutosaveSettings(req *SetAutosaveSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAutosaveSettings", + }, + Data: map[string]interface{}{ + "scope": req.Scope, + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Clears the list of all autosave settings exceptions +func (client *Client) ClearAutosaveSettingsExceptions() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clearAutosaveSettingsExceptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetBankCardInfoRequest struct { // The bank card number BankCardNumber string `json:"bank_card_number"` @@ -16511,14 +16808,17 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatHasProtectedContent: return UnmarshalUpdateChatHasProtectedContent(result.Data) - case TypeUpdateChatHasScheduledMessages: - return UnmarshalUpdateChatHasScheduledMessages(result.Data) + case TypeUpdateChatIsTranslatable: + return UnmarshalUpdateChatIsTranslatable(result.Data) + + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(result.Data) case TypeUpdateChatIsBlocked: return UnmarshalUpdateChatIsBlocked(result.Data) - case TypeUpdateChatIsMarkedAsUnread: - return UnmarshalUpdateChatIsMarkedAsUnread(result.Data) + case TypeUpdateChatHasScheduledMessages: + return UnmarshalUpdateChatHasScheduledMessages(result.Data) case TypeUpdateChatFilters: return UnmarshalUpdateChatFilters(result.Data) @@ -16685,6 +16985,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(result.Data) + case TypeUpdateAutosaveSettings: + return UnmarshalUpdateAutosaveSettings(result.Data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(result.Data) diff --git a/client/type.go b/client/type.go index 7570da1..ec2d7a4 100755 --- a/client/type.go +++ b/client/type.go @@ -18,6 +18,7 @@ const ( ClassStickerFullType = "StickerFullType" ClassPollType = "PollType" ClassUserType = "UserType" + ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" ClassChatMemberStatus = "ChatMemberStatus" ClassChatMembersFilter = "ChatMembersFilter" @@ -58,11 +59,13 @@ const ( ClassSearchMessagesFilter = "SearchMessagesFilter" ClassChatAction = "ChatAction" ClassUserStatus = "UserStatus" + ClassEmojiCategoryType = "EmojiCategoryType" ClassCallDiscardReason = "CallDiscardReason" ClassCallServerType = "CallServerType" ClassCallState = "CallState" ClassGroupCallVideoQuality = "GroupCallVideoQuality" ClassCallProblem = "CallProblem" + ClassFirebaseAuthenticationSettings = "FirebaseAuthenticationSettings" ClassDiceStickers = "DiceStickers" ClassSpeechRecognitionResult = "SpeechRecognitionResult" ClassInputInlineQueryResult = "InputInlineQueryResult" @@ -97,6 +100,7 @@ const ( ClassFileType = "FileType" ClassNetworkType = "NetworkType" ClassNetworkStatisticsEntry = "NetworkStatisticsEntry" + ClassAutosaveSettingsScope = "AutosaveSettingsScope" ClassConnectionState = "ConnectionState" ClassTopChatCategory = "TopChatCategory" ClassTMeUrlType = "TMeUrlType" @@ -149,12 +153,14 @@ const ( ClassBotCommands = "BotCommands" ClassBotMenuButton = "BotMenuButton" ClassChatLocation = "ChatLocation" + ClassChatPhotoSticker = "ChatPhotoSticker" ClassAnimatedChatPhoto = "AnimatedChatPhoto" ClassChatPhoto = "ChatPhoto" ClassChatPhotos = "ChatPhotos" ClassChatPermissions = "ChatPermissions" ClassChatAdministratorRights = "ChatAdministratorRights" ClassPremiumPaymentOption = "PremiumPaymentOption" + ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" ClassEmojiStatus = "EmojiStatus" ClassEmojiStatuses = "EmojiStatuses" ClassUsernames = "Usernames" @@ -272,6 +278,8 @@ const ( ClassStickerSetInfo = "StickerSetInfo" ClassStickerSets = "StickerSets" ClassTrendingStickerSets = "TrendingStickerSets" + ClassEmojiCategory = "EmojiCategory" + ClassEmojiCategories = "EmojiCategories" ClassCallProtocol = "CallProtocol" ClassCallServer = "CallServer" ClassCallId = "CallId" @@ -314,6 +322,7 @@ const ( ClassPremiumFeatures = "PremiumFeatures" ClassPremiumFeaturePromotionAnimation = "PremiumFeaturePromotionAnimation" ClassPremiumState = "PremiumState" + Class//-To = "https://my.telegram.org" ClassPushReceiverId = "PushReceiverId" ClassBackground = "Background" ClassBackgrounds = "Backgrounds" @@ -343,6 +352,9 @@ const ( ClassNetworkStatistics = "NetworkStatistics" ClassAutoDownloadSettings = "AutoDownloadSettings" ClassAutoDownloadSettingsPresets = "AutoDownloadSettingsPresets" + ClassScopeAutosaveSettings = "ScopeAutosaveSettings" + ClassAutosaveSettingsException = "AutosaveSettingsException" + ClassAutosaveSettings = "AutosaveSettings" ClassTMeUrl = "TMeUrl" ClassTMeUrls = "TMeUrls" ClassCount = "Count" @@ -383,6 +395,8 @@ const ( TypeAuthenticationCodeTypeFlashCall = "authenticationCodeTypeFlashCall" TypeAuthenticationCodeTypeMissedCall = "authenticationCodeTypeMissedCall" TypeAuthenticationCodeTypeFragment = "authenticationCodeTypeFragment" + TypeAuthenticationCodeTypeFirebaseAndroid = "authenticationCodeTypeFirebaseAndroid" + TypeAuthenticationCodeTypeFirebaseIos = "authenticationCodeTypeFirebaseIos" TypeAuthenticationCodeInfo = "authenticationCodeInfo" TypeEmailAddressAuthenticationCodeInfo = "emailAddressAuthenticationCodeInfo" TypeEmailAddressAuthenticationCode = "emailAddressAuthenticationCode" @@ -466,15 +480,20 @@ const ( TypeBotCommands = "botCommands" TypeBotMenuButton = "botMenuButton" TypeChatLocation = "chatLocation" + TypeChatPhotoStickerTypeRegularOrMask = "chatPhotoStickerTypeRegularOrMask" + TypeChatPhotoStickerTypeCustomEmoji = "chatPhotoStickerTypeCustomEmoji" + TypeChatPhotoSticker = "chatPhotoSticker" TypeAnimatedChatPhoto = "animatedChatPhoto" TypeChatPhoto = "chatPhoto" TypeChatPhotos = "chatPhotos" TypeInputChatPhotoPrevious = "inputChatPhotoPrevious" TypeInputChatPhotoStatic = "inputChatPhotoStatic" TypeInputChatPhotoAnimation = "inputChatPhotoAnimation" + TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" TypePremiumPaymentOption = "premiumPaymentOption" + TypePremiumStatePaymentOption = "premiumStatePaymentOption" TypeEmojiStatus = "emojiStatus" TypeEmojiStatuses = "emojiStatuses" TypeUsernames = "usernames" @@ -598,6 +617,8 @@ const ( TypeKeyboardButtonTypeRequestPhoneNumber = "keyboardButtonTypeRequestPhoneNumber" TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation" TypeKeyboardButtonTypeRequestPoll = "keyboardButtonTypeRequestPoll" + TypeKeyboardButtonTypeRequestUser = "keyboardButtonTypeRequestUser" + TypeKeyboardButtonTypeRequestChat = "keyboardButtonTypeRequestChat" TypeKeyboardButtonTypeWebApp = "keyboardButtonTypeWebApp" TypeKeyboardButton = "keyboardButton" TypeInlineKeyboardButtonTypeUrl = "inlineKeyboardButtonTypeUrl" @@ -833,6 +854,8 @@ const ( TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot" TypeMessageGiftedPremium = "messageGiftedPremium" TypeMessageContactRegistered = "messageContactRegistered" + TypeMessageUserShared = "messageUserShared" + TypeMessageChatShared = "messageChatShared" TypeMessageWebsiteConnected = "messageWebsiteConnected" TypeMessageBotWriteAccessAllowed = "messageBotWriteAccessAllowed" TypeMessageWebAppDataSent = "messageWebAppDataSent" @@ -927,6 +950,11 @@ const ( TypeStickerSetInfo = "stickerSetInfo" TypeStickerSets = "stickerSets" TypeTrendingStickerSets = "trendingStickerSets" + TypeEmojiCategory = "emojiCategory" + TypeEmojiCategories = "emojiCategories" + TypeEmojiCategoryTypeDefault = "emojiCategoryTypeDefault" + TypeEmojiCategoryTypeEmojiStatus = "emojiCategoryTypeEmojiStatus" + TypeEmojiCategoryTypeChatPhoto = "emojiCategoryTypeChatPhoto" TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" TypeCallDiscardReasonMissed = "callDiscardReasonMissed" TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" @@ -965,6 +993,8 @@ const ( TypeCallProblemDistortedVideo = "callProblemDistortedVideo" TypeCallProblemPixelatedVideo = "callProblemPixelatedVideo" TypeCall = "call" + TypeFirebaseAuthenticationSettingsAndroid = "firebaseAuthenticationSettingsAndroid" + TypeFirebaseAuthenticationSettingsIos = "firebaseAuthenticationSettingsIos" TypePhoneNumberAuthenticationSettings = "phoneNumberAuthenticationSettings" TypeAddedReaction = "addedReaction" TypeAddedReactions = "addedReactions" @@ -1093,6 +1123,7 @@ const ( TypePremiumFeatureAnimatedProfilePhoto = "premiumFeatureAnimatedProfilePhoto" TypePremiumFeatureForumTopicIcon = "premiumFeatureForumTopicIcon" TypePremiumFeatureAppIcons = "premiumFeatureAppIcons" + TypePremiumFeatureRealTimeChatTranslation = "premiumFeatureRealTimeChatTranslation" TypePremiumLimit = "premiumLimit" TypePremiumFeatures = "premiumFeatures" TypePremiumSourceLimitExceeded = "premiumSourceLimitExceeded" @@ -1103,6 +1134,7 @@ const ( TypePremiumState = "premiumState" TypeStorePaymentPurposePremiumSubscription = "storePaymentPurposePremiumSubscription" TypeStorePaymentPurposeGiftedPremium = "storePaymentPurposeGiftedPremium" + Type//-To = "//-To" TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" TypeDeviceTokenApplePush = "deviceTokenApplePush" TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" @@ -1114,6 +1146,7 @@ const ( TypeDeviceTokenUbuntuPush = "deviceTokenUbuntuPush" TypeDeviceTokenBlackBerryPush = "deviceTokenBlackBerryPush" TypeDeviceTokenTizenPush = "deviceTokenTizenPush" + TypeDeviceTokenHuaweiPush = "deviceTokenHuaweiPush" TypePushReceiverId = "pushReceiverId" TypeBackgroundFillSolid = "backgroundFillSolid" TypeBackgroundFillGradient = "backgroundFillGradient" @@ -1325,6 +1358,13 @@ const ( TypeNetworkStatistics = "networkStatistics" TypeAutoDownloadSettings = "autoDownloadSettings" TypeAutoDownloadSettingsPresets = "autoDownloadSettingsPresets" + TypeAutosaveSettingsScopePrivateChats = "autosaveSettingsScopePrivateChats" + TypeAutosaveSettingsScopeGroupChats = "autosaveSettingsScopeGroupChats" + TypeAutosaveSettingsScopeChannelChats = "autosaveSettingsScopeChannelChats" + TypeAutosaveSettingsScopeChat = "autosaveSettingsScopeChat" + TypeScopeAutosaveSettings = "scopeAutosaveSettings" + TypeAutosaveSettingsException = "autosaveSettingsException" + TypeAutosaveSettings = "autosaveSettings" TypeConnectionStateWaitingForNetwork = "connectionStateWaitingForNetwork" TypeConnectionStateConnectingToProxy = "connectionStateConnectingToProxy" TypeConnectionStateConnecting = "connectionStateConnecting" @@ -1349,6 +1389,8 @@ const ( TypeSuggestedActionViewChecksHint = "suggestedActionViewChecksHint" TypeSuggestedActionConvertToBroadcastGroup = "suggestedActionConvertToBroadcastGroup" TypeSuggestedActionSetPassword = "suggestedActionSetPassword" + TypeSuggestedActionUpgradePremium = "suggestedActionUpgradePremium" + TypeSuggestedActionSubscribeToAnnualPremium = "suggestedActionSubscribeToAnnualPremium" TypeCount = "count" TypeText = "text" TypeSeconds = "seconds" @@ -1419,9 +1461,10 @@ const ( TypeUpdateChatVideoChat = "updateChatVideoChat" TypeUpdateChatDefaultDisableNotification = "updateChatDefaultDisableNotification" TypeUpdateChatHasProtectedContent = "updateChatHasProtectedContent" - TypeUpdateChatHasScheduledMessages = "updateChatHasScheduledMessages" - TypeUpdateChatIsBlocked = "updateChatIsBlocked" + TypeUpdateChatIsTranslatable = "updateChatIsTranslatable" TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread" + TypeUpdateChatIsBlocked = "updateChatIsBlocked" + TypeUpdateChatHasScheduledMessages = "updateChatHasScheduledMessages" TypeUpdateChatFilters = "updateChatFilters" TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" TypeUpdateForumTopicInfo = "updateForumTopicInfo" @@ -1477,6 +1520,7 @@ const ( TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" TypeUpdateAnimationSearchParameters = "updateAnimationSearchParameters" TypeUpdateSuggestedActions = "updateSuggestedActions" + TypeUpdateAutosaveSettings = "updateAutosaveSettings" TypeUpdateNewInlineQuery = "updateNewInlineQuery" TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" @@ -1560,6 +1604,11 @@ type UserType interface { UserTypeType() string } +// Describes type of a sticker, which was used to create a chat photo +type ChatPhotoStickerType interface { + ChatPhotoStickerTypeType() string +} + // Describes a photo to be set as a user profile or chat photo type InputChatPhoto interface { InputChatPhotoType() string @@ -1760,6 +1809,11 @@ type UserStatus interface { UserStatusType() string } +// Describes type of an emoji category +type EmojiCategoryType interface { + EmojiCategoryTypeType() string +} + // Describes the reason why a call was discarded type CallDiscardReason interface { CallDiscardReasonType() string @@ -1785,6 +1839,11 @@ type CallProblem interface { CallProblemType() string } +// Contains settings for Firebase Authentication in the official applications +type FirebaseAuthenticationSettings interface { + FirebaseAuthenticationSettingsType() string +} + // Contains animated stickers which must be used for dice animation rendering type DiceStickers interface { DiceStickersType() string @@ -1840,7 +1899,7 @@ type StorePaymentPurpose interface { StorePaymentPurposeType() string } -// Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org +// Represents a data needed to subscribe for push notifications through registerDevice method. type DeviceToken interface { DeviceTokenType() string } @@ -1955,6 +2014,11 @@ type NetworkStatisticsEntry interface { NetworkStatisticsEntryType() string } +// Describes scope of autosave settings +type AutosaveSettingsScope interface { + AutosaveSettingsScopeType() string +} + // Describes the current state of the connection to Telegram servers type ConnectionState interface { ConnectionStateType() string @@ -2227,6 +2291,66 @@ func (*AuthenticationCodeTypeFragment) AuthenticationCodeTypeType() string { return TypeAuthenticationCodeTypeFragment } +// An authentication code is delivered via Firebase Authentication to the official Android application +type AuthenticationCodeTypeFirebaseAndroid struct { + meta + // Nonce to pass to the SafetyNet Attestation API + Nonce []byte `json:"nonce"` + // Length of the code + Length int32 `json:"length"` +} + +func (entity *AuthenticationCodeTypeFirebaseAndroid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeFirebaseAndroid + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeFirebaseAndroid) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeFirebaseAndroid) GetType() string { + return TypeAuthenticationCodeTypeFirebaseAndroid +} + +func (*AuthenticationCodeTypeFirebaseAndroid) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeFirebaseAndroid +} + +// An authentication code is delivered via Firebase Authentication to the official iOS application +type AuthenticationCodeTypeFirebaseIos struct { + meta + // Receipt of successful applikation token validation to compare with receipt from push notification + Receipt string `json:"receipt"` + // Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds + PushTimeout int32 `json:"push_timeout"` + // Length of the code + Length int32 `json:"length"` +} + +func (entity *AuthenticationCodeTypeFirebaseIos) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeFirebaseIos + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeFirebaseIos) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeFirebaseIos) GetType() string { + return TypeAuthenticationCodeTypeFirebaseIos +} + +func (*AuthenticationCodeTypeFirebaseIos) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeFirebaseIos +} + // Information about the authentication code that was sent type AuthenticationCodeInfo struct { meta @@ -3776,7 +3900,7 @@ type StickerFullTypeCustomEmoji struct { meta // Identifier of the custom emoji CustomEmojiId JsonInt64 `json:"custom_emoji_id"` - // True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, or another appropriate color in other places + // True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, or another appropriate color in other places. The sticker must not be repainted on chat photos NeedsRepainting bool `json:"needs_repainting"` } @@ -4065,6 +4189,8 @@ func (*Photo) GetType() string { // Describes a sticker type Sticker struct { meta + // Unique sticker identifier within the set; 0 if none + Id JsonInt64 `json:"id"` // The identifier of the sticker set to which the sticker belongs; 0 if none SetId JsonInt64 `json:"set_id"` // Sticker width; as defined by the sender @@ -4103,6 +4229,7 @@ func (*Sticker) GetType() string { func (sticker *Sticker) UnmarshalJSON(data []byte) error { var tmp struct { + Id JsonInt64 `json:"id"` SetId JsonInt64 `json:"set_id"` Width int32 `json:"width"` Height int32 `json:"height"` @@ -4119,6 +4246,7 @@ func (sticker *Sticker) UnmarshalJSON(data []byte) error { return err } + sticker.Id = tmp.Id sticker.SetId = tmp.SetId sticker.Width = tmp.Width sticker.Height = tmp.Height @@ -4339,7 +4467,7 @@ type Contact struct { LastName string `json:"last_name"` // Additional data about the user in a form of vCard; 0-2048 bytes in length Vcard string `json:"vcard"` - // Identifier of the user, if known; otherwise 0 + // Identifier of the user, if known; 0 otherwise UserId int64 `json:"user_id"` } @@ -4806,6 +4934,107 @@ func (*ChatLocation) GetType() string { return TypeChatLocation } +// Information about the sticker, which was used to create the chat photo +type ChatPhotoStickerTypeRegularOrMask struct { + meta + // Sticker set identifier + StickerSetId JsonInt64 `json:"sticker_set_id"` + // Identifier of the sticker in the set + StickerId JsonInt64 `json:"sticker_id"` +} + +func (entity *ChatPhotoStickerTypeRegularOrMask) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatPhotoStickerTypeRegularOrMask + + return json.Marshal((*stub)(entity)) +} + +func (*ChatPhotoStickerTypeRegularOrMask) GetClass() string { + return ClassChatPhotoStickerType +} + +func (*ChatPhotoStickerTypeRegularOrMask) GetType() string { + return TypeChatPhotoStickerTypeRegularOrMask +} + +func (*ChatPhotoStickerTypeRegularOrMask) ChatPhotoStickerTypeType() string { + return TypeChatPhotoStickerTypeRegularOrMask +} + +// Information about the custom emoji, which was used to create the chat photo +type ChatPhotoStickerTypeCustomEmoji struct { + meta + // Identifier of the custom emoji + CustomEmojiId JsonInt64 `json:"custom_emoji_id"` +} + +func (entity *ChatPhotoStickerTypeCustomEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatPhotoStickerTypeCustomEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*ChatPhotoStickerTypeCustomEmoji) GetClass() string { + return ClassChatPhotoStickerType +} + +func (*ChatPhotoStickerTypeCustomEmoji) GetType() string { + return TypeChatPhotoStickerTypeCustomEmoji +} + +func (*ChatPhotoStickerTypeCustomEmoji) ChatPhotoStickerTypeType() string { + return TypeChatPhotoStickerTypeCustomEmoji +} + +// Information about the sticker, which was used to create the chat photo. The sticker is shown at the center of the photo and occupies at most 67% of it +type ChatPhotoSticker struct { + meta + // Type of the sticker + Type ChatPhotoStickerType `json:"type"` + // The fill to be used as background for the sticker; rotation angle in backgroundFillGradient isn't supported + BackgroundFill BackgroundFill `json:"background_fill"` +} + +func (entity *ChatPhotoSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatPhotoSticker + + return json.Marshal((*stub)(entity)) +} + +func (*ChatPhotoSticker) GetClass() string { + return ClassChatPhotoSticker +} + +func (*ChatPhotoSticker) GetType() string { + return TypeChatPhotoSticker +} + +func (chatPhotoSticker *ChatPhotoSticker) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + BackgroundFill json.RawMessage `json:"background_fill"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldType, _ := UnmarshalChatPhotoStickerType(tmp.Type) + chatPhotoSticker.Type = fieldType + + fieldBackgroundFill, _ := UnmarshalBackgroundFill(tmp.BackgroundFill) + chatPhotoSticker.BackgroundFill = fieldBackgroundFill + + return nil +} + // Animated variant of a chat photo in MPEG4 format type AnimatedChatPhoto struct { meta @@ -4844,10 +5073,12 @@ type ChatPhoto struct { Minithumbnail *Minithumbnail `json:"minithumbnail"` // Available variants of the photo in JPEG format, in different size Sizes []*PhotoSize `json:"sizes"` - // A big (640x640) animated variant of the photo in MPEG4 format; may be null + // A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null Animation *AnimatedChatPhoto `json:"animation"` // A small (160x160) animated variant of the photo in MPEG4 format; may be null even the big animation is available SmallAnimation *AnimatedChatPhoto `json:"small_animation"` + // Sticker-based version of the chat photo; may be null + Sticker *ChatPhotoSticker `json:"sticker"` } func (entity *ChatPhoto) MarshalJSON() ([]byte, error) { @@ -4961,7 +5192,7 @@ func (inputChatPhotoStatic *InputChatPhotoStatic) UnmarshalJSON(data []byte) err return nil } -// An animation in MPEG4 format; must be square, at most 10 seconds long, have width between 160 and 800 and be at most 2MB in size +// An animation in MPEG4 format; must be square, at most 10 seconds long, have width between 160 and 1280 and be at most 2MB in size type InputChatPhotoAnimation struct { meta // Animation to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed @@ -5009,14 +5240,51 @@ func (inputChatPhotoAnimation *InputChatPhotoAnimation) UnmarshalJSON(data []byt return nil } +// A sticker on a custom background +type InputChatPhotoSticker struct { + meta + // Information about the sticker + Sticker *ChatPhotoSticker `json:"sticker"` +} + +func (entity *InputChatPhotoSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatPhotoSticker + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatPhotoSticker) GetClass() string { + return ClassInputChatPhoto +} + +func (*InputChatPhotoSticker) GetType() string { + return TypeInputChatPhotoSticker +} + +func (*InputChatPhotoSticker) InputChatPhotoType() string { + return TypeInputChatPhotoSticker +} + // Describes actions that a user is allowed to take in a chat type ChatPermissions struct { meta - // True, if the user can send text messages, contacts, locations, and venues + // True, if the user can send text messages, contacts, invoices, locations, and venues CanSendMessages bool `json:"can_send_messages"` - // True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions - CanSendMediaMessages bool `json:"can_send_media_messages"` - // True, if the user can send polls. Implies can_send_messages permissions + // True, if the user can send music files + CanSendAudios bool `json:"can_send_audios"` + // True, if the user can send documents + CanSendDocuments bool `json:"can_send_documents"` + // True, if the user can send audio photos + CanSendPhotos bool `json:"can_send_photos"` + // True, if the user can send audio videos + CanSendVideos bool `json:"can_send_videos"` + // True, if the user can send video notes + CanSendVideoNotes bool `json:"can_send_video_notes"` + // True, if the user can send voice notes + CanSendVoiceNotes bool `json:"can_send_voice_notes"` + // True, if the user can send polls CanSendPolls bool `json:"can_send_polls"` // True, if the user can send stickers. Implies can_send_messages permissions CanSendStickers bool `json:"can_send_stickers"` @@ -5026,7 +5294,7 @@ type ChatPermissions struct { CanSendGames bool `json:"can_send_games"` // True, if the user can use inline bots. Implies can_send_messages permissions CanUseInlineBots bool `json:"can_use_inline_bots"` - // True, if the user may add a web page preview to their messages. Implies can_send_messages permissions + // True, if the user may add a web page preview to their messages CanAddWebPagePreviews bool `json:"can_add_web_page_previews"` // True, if the user can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` @@ -5159,6 +5427,35 @@ func (premiumPaymentOption *PremiumPaymentOption) UnmarshalJSON(data []byte) err return nil } +// Describes an option for buying or upgrading Telegram Premium for self +type PremiumStatePaymentOption struct { + meta + // Information about the payment option + PaymentOption *PremiumPaymentOption `json:"payment_option"` + // True, if this is the currently used Telegram Premium subscription option + IsCurrent bool `json:"is_current"` + // True, if the payment option can be used to upgrade the existing Telegram Premium subscription + IsUpgrade bool `json:"is_upgrade"` + // Identifier of the last in-store transaction for the currently used option + LastTransactionId string `json:"last_transaction_id"` +} + +func (entity *PremiumStatePaymentOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumStatePaymentOption + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumStatePaymentOption) GetClass() string { + return ClassPremiumStatePaymentOption +} + +func (*PremiumStatePaymentOption) GetType() string { + return TypePremiumStatePaymentOption +} + // Describes a custom emoji to be shown instead of the Telegram Premium badge type EmojiStatus struct { meta @@ -5394,11 +5691,11 @@ func (*BotInfo) GetType() string { // Contains full information about a user type UserFullInfo struct { meta - // User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty, otherwise unknown. If non-null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos + // User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. If non-null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos PersonalPhoto *ChatPhoto `json:"personal_photo"` - // User profile photo; may be null. If null and user.profile_photo is null, then the photo is empty, otherwise unknown. If non-null and personal_photo is null, then it is the same photo as in user.profile_photo and chat.photo + // User profile photo; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. If non-null and personal_photo is null, then it is the same photo as in user.profile_photo and chat.photo Photo *ChatPhoto `json:"photo"` - // User profile photo visible if the main photo is hidden by privacy settings; may be null. If null and user.profile_photo is null, then the photo is empty, otherwise unknown. If non-null and both photo and personal_photo are null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos + // User profile photo visible if the main photo is hidden by privacy settings; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. If non-null and both photo and personal_photo are null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos PublicPhoto *ChatPhoto `json:"public_photo"` // True, if the user is blocked by the current user IsBlocked bool `json:"is_blocked"` @@ -6842,7 +7139,7 @@ type SecretChat struct { UserId int64 `json:"user_id"` // State of the secret chat State SecretChatState `json:"state"` - // True, if the chat was created by the current user; otherwise false + // True, if the chat was created by the current user; false otherwise IsOutbound bool `json:"is_outbound"` // Hash of the currently used key for comparison with the hash of the chat partner's key. This is a string of 36 little-endian bytes, which must be split into groups of 2 bits, each denoting a pixel of one of 4 colors FFFFFF, D5E6F3, 2D5775, and 2F99C9. The pixels must be used to make a 12x12 square image filled from left to right, top to bottom. Alternatively, the first 32 bytes of the hash can be converted to the hexadecimal format and printed as 32 2-digit hex numbers KeyHash []byte `json:"key_hash"` @@ -8905,6 +9202,8 @@ type Chat struct { MessageSenderId MessageSender `json:"message_sender_id"` // True, if chat content can't be saved locally, forwarded, or copied HasProtectedContent bool `json:"has_protected_content"` + // True, if translation of all messages in the chat must be suggested to the user + IsTranslatable bool `json:"is_translatable"` // True, if the chat is marked as unread IsMarkedAsUnread bool `json:"is_marked_as_unread"` // True, if the chat is blocked by the current user and private messages from the chat can't be received @@ -8978,6 +9277,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { Positions []*ChatPosition `json:"positions"` MessageSenderId json.RawMessage `json:"message_sender_id"` HasProtectedContent bool `json:"has_protected_content"` + IsTranslatable bool `json:"is_translatable"` IsMarkedAsUnread bool `json:"is_marked_as_unread"` IsBlocked bool `json:"is_blocked"` HasScheduledMessages bool `json:"has_scheduled_messages"` @@ -9014,6 +9314,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.LastMessage = tmp.LastMessage chat.Positions = tmp.Positions chat.HasProtectedContent = tmp.HasProtectedContent + chat.IsTranslatable = tmp.IsTranslatable chat.IsMarkedAsUnread = tmp.IsMarkedAsUnread chat.IsBlocked = tmp.IsBlocked chat.HasScheduledMessages = tmp.HasScheduledMessages @@ -9466,6 +9767,86 @@ func (*KeyboardButtonTypeRequestPoll) KeyboardButtonTypeType() string { return TypeKeyboardButtonTypeRequestPoll } +// A button that requests a user to be shared by the current user; available only in private chats. Use the method shareUserWithBot to complete the request +type KeyboardButtonTypeRequestUser struct { + meta + // Unique button identifier + Id int32 `json:"id"` + // True, if the shared user must or must not be a bot + RestrictUserIsBot bool `json:"restrict_user_is_bot"` + // True, if the shared user must be a bot; otherwise, the shared user must no be a bot. Ignored if restrict_user_is_bot is false + UserIsBot bool `json:"user_is_bot"` + // True, if the shared user must or must not be a Telegram Premium user + RestrictUserIsPremium bool `json:"restrict_user_is_premium"` + // True, if the shared user must be a Telegram Premium user; otherwise, the shared user must no be a Telegram Premium user. Ignored if restrict_user_is_premium is false + UserIsPremium bool `json:"user_is_premium"` +} + +func (entity *KeyboardButtonTypeRequestUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub KeyboardButtonTypeRequestUser + + return json.Marshal((*stub)(entity)) +} + +func (*KeyboardButtonTypeRequestUser) GetClass() string { + return ClassKeyboardButtonType +} + +func (*KeyboardButtonTypeRequestUser) GetType() string { + return TypeKeyboardButtonTypeRequestUser +} + +func (*KeyboardButtonTypeRequestUser) KeyboardButtonTypeType() string { + return TypeKeyboardButtonTypeRequestUser +} + +// A button that requests a chat to be shared by the current user; available only in private chats. Use the method shareChatWithBot to complete the request +type KeyboardButtonTypeRequestChat struct { + meta + // Unique button identifier + Id int32 `json:"id"` + // True, if the chat must be a channel; otherwise, a basic group or a supergroup chat is shared + ChatIsChannel bool `json:"chat_is_channel"` + // True, if the chat must or must not be a forum supergroup + RestrictChatIsForum bool `json:"restrict_chat_is_forum"` + // True, if the chat must be a forum supergroup; otherwise, the chat must not be a forum supergroup. Ignored if restrict_chat_is_forum is false + ChatIsForum bool `json:"chat_is_forum"` + // True, if the chat must or must not have a username + RestrictChatHasUsername bool `json:"restrict_chat_has_username"` + // True, if the chat must have a username; otherwise, the chat must not have a username. Ignored if restrict_chat_has_username is false + ChatHasUsername bool `json:"chat_has_username"` + // True, if the chat must be created by the current user + ChatIsCreated bool `json:"chat_is_created"` + // Expected user administrator rights in the chat; may be null if they aren't restricted + UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights"` + // Expected bot administrator rights in the chat; may be null if they aren't restricted + BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights"` + // True, if the bot must be a member of the chat; for basic group and supergroup chats only + BotIsMember bool `json:"bot_is_member"` +} + +func (entity *KeyboardButtonTypeRequestChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub KeyboardButtonTypeRequestChat + + return json.Marshal((*stub)(entity)) +} + +func (*KeyboardButtonTypeRequestChat) GetClass() string { + return ClassKeyboardButtonType +} + +func (*KeyboardButtonTypeRequestChat) GetType() string { + return TypeKeyboardButtonTypeRequestChat +} + +func (*KeyboardButtonTypeRequestChat) KeyboardButtonTypeType() string { + return TypeKeyboardButtonTypeRequestChat +} + // A button that opens a Web App by calling getWebAppUrl type KeyboardButtonTypeWebApp struct { meta @@ -9887,7 +10268,7 @@ type ReplyMarkupShowKeyboard struct { meta // A list of rows of bot keyboard buttons Rows [][]*KeyboardButton `json:"rows"` - // True, if the keyboard is supposed to be always shown when the ordinary keyboard is hidden + // True, if the keyboard is supposed to always be shown when the ordinary keyboard is hidden IsPersistent bool `json:"is_persistent"` // True, if the application needs to resize the keyboard vertically ResizeKeyboard bool `json:"resize_keyboard"` @@ -9946,7 +10327,7 @@ func (*ReplyMarkupInlineKeyboard) ReplyMarkupType() string { return TypeReplyMarkupInlineKeyboard } -// An HTTP url needs to be open +// An HTTP URL needs to be open type LoginUrlInfoOpen struct { meta // The URL to open @@ -13279,7 +13660,7 @@ func (paymentForm *PaymentForm) UnmarshalJSON(data []byte) error { return nil } -// Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options +// Contains a temporary identifier of validated order information, which is stored for one hour, and the available shipping options type ValidatedOrderInfo struct { meta // Temporary identifier of the order information @@ -13307,7 +13688,7 @@ func (*ValidatedOrderInfo) GetType() string { // Contains the result of a payment request type PaymentResult struct { meta - // True, if the payment request was successful; otherwise the verification_url will be non-empty + // True, if the payment request was successful; otherwise, the verification_url will be non-empty Success bool `json:"success"` // URL for additional payment credentials verification VerificationUrl string `json:"verification_url"` @@ -16852,7 +17233,7 @@ func (*MessageScreenshotTaken) MessageContentType() string { // A theme in the chat has been changed type MessageChatSetTheme struct { meta - // If non-empty, name of a new theme, set for the chat. Otherwise chat theme was reset to the default one + // If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset to the default one ThemeName string `json:"theme_name"` } @@ -16968,7 +17349,7 @@ func (*MessageForumTopicEdited) MessageContentType() string { // A forum topic has been closed or opened type MessageForumTopicIsClosedToggled struct { meta - // True, if the topic was closed, otherwise the topic was reopened + // True, if the topic was closed; otherwise, the topic was reopened IsClosed bool `json:"is_closed"` } @@ -16995,7 +17376,7 @@ func (*MessageForumTopicIsClosedToggled) MessageContentType() string { // A General forum topic has been hidden or unhidden type MessageForumTopicIsHiddenToggled struct { meta - // True, if the topic was hidden, otherwise the topic was unhidden + // True, if the topic was hidden; otherwise, the topic was unhidden IsHidden bool `json:"is_hidden"` } @@ -17244,6 +17625,64 @@ func (*MessageContactRegistered) MessageContentType() string { return TypeMessageContactRegistered } +// The current user shared a user, which was requested by the bot +type MessageUserShared struct { + meta + // Identifier of the shared user + UserId int64 `json:"user_id"` + // Identifier of the keyboard button with the request + ButtonId int32 `json:"button_id"` +} + +func (entity *MessageUserShared) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageUserShared + + return json.Marshal((*stub)(entity)) +} + +func (*MessageUserShared) GetClass() string { + return ClassMessageContent +} + +func (*MessageUserShared) GetType() string { + return TypeMessageUserShared +} + +func (*MessageUserShared) MessageContentType() string { + return TypeMessageUserShared +} + +// The current user shared a chat, which was requested by the bot +type MessageChatShared struct { + meta + // Identifier of the shared chat + ChatId int64 `json:"chat_id"` + // Identifier of the keyboard button with the request + ButtonId int32 `json:"button_id"` +} + +func (entity *MessageChatShared) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatShared + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatShared) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatShared) GetType() string { + return TypeMessageChatShared +} + +func (*MessageChatShared) MessageContentType() string { + return TypeMessageChatShared +} + // The current user has connected a website by logging in using Telegram Login Widget on it type MessageWebsiteConnected struct { meta @@ -20321,6 +20760,131 @@ func (*TrendingStickerSets) GetType() string { return TypeTrendingStickerSets } +// Contains a list of similar emoji to search for in getStickers and searchStickers +type EmojiCategory struct { + meta + // Name of the category + Name string `json:"name"` + // Unique identifier of the custom emoji, which represents icon of the category + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + // List of emojis in the category + Emojis []string `json:"emojis"` +} + +func (entity *EmojiCategory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategory + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategory) GetClass() string { + return ClassEmojiCategory +} + +func (*EmojiCategory) GetType() string { + return TypeEmojiCategory +} + +// Represents a list of emoji categories +type EmojiCategories struct { + meta + // List of categories + Categories []*EmojiCategory `json:"categories"` +} + +func (entity *EmojiCategories) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategories + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategories) GetClass() string { + return ClassEmojiCategories +} + +func (*EmojiCategories) GetType() string { + return TypeEmojiCategories +} + +// The category must be used by default +type EmojiCategoryTypeDefault struct{ + meta +} + +func (entity *EmojiCategoryTypeDefault) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategoryTypeDefault + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategoryTypeDefault) GetClass() string { + return ClassEmojiCategoryType +} + +func (*EmojiCategoryTypeDefault) GetType() string { + return TypeEmojiCategoryTypeDefault +} + +func (*EmojiCategoryTypeDefault) EmojiCategoryTypeType() string { + return TypeEmojiCategoryTypeDefault +} + +// The category must be used for emoji status selection +type EmojiCategoryTypeEmojiStatus struct{ + meta +} + +func (entity *EmojiCategoryTypeEmojiStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategoryTypeEmojiStatus + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategoryTypeEmojiStatus) GetClass() string { + return ClassEmojiCategoryType +} + +func (*EmojiCategoryTypeEmojiStatus) GetType() string { + return TypeEmojiCategoryTypeEmojiStatus +} + +func (*EmojiCategoryTypeEmojiStatus) EmojiCategoryTypeType() string { + return TypeEmojiCategoryTypeEmojiStatus +} + +// The category must be used for chat photo emoji selection +type EmojiCategoryTypeChatPhoto struct{ + meta +} + +func (entity *EmojiCategoryTypeChatPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategoryTypeChatPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategoryTypeChatPhoto) GetClass() string { + return ClassEmojiCategoryType +} + +func (*EmojiCategoryTypeChatPhoto) GetType() string { + return TypeEmojiCategoryTypeChatPhoto +} + +func (*EmojiCategoryTypeChatPhoto) EmojiCategoryTypeType() string { + return TypeEmojiCategoryTypeChatPhoto +} + // The call wasn't discarded, or the reason is unknown type CallDiscardReasonEmpty struct{ meta @@ -20965,7 +21529,7 @@ func (*GroupCallStreams) GetType() string { return TypeGroupCallStreams } -// Represents an RTMP url +// Represents an RTMP URL type RtmpUrl struct { meta // The URL @@ -21538,6 +22102,60 @@ func (call *Call) UnmarshalJSON(data []byte) error { return nil } +// Settings for Firebase Authentication in the official Android application +type FirebaseAuthenticationSettingsAndroid struct{ + meta +} + +func (entity *FirebaseAuthenticationSettingsAndroid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FirebaseAuthenticationSettingsAndroid + + return json.Marshal((*stub)(entity)) +} + +func (*FirebaseAuthenticationSettingsAndroid) GetClass() string { + return ClassFirebaseAuthenticationSettings +} + +func (*FirebaseAuthenticationSettingsAndroid) GetType() string { + return TypeFirebaseAuthenticationSettingsAndroid +} + +func (*FirebaseAuthenticationSettingsAndroid) FirebaseAuthenticationSettingsType() string { + return TypeFirebaseAuthenticationSettingsAndroid +} + +// Settings for Firebase Authentication in the official iOS application +type FirebaseAuthenticationSettingsIos struct { + meta + // Device token from Apple Push Notification service + DeviceToken string `json:"device_token"` + // True, if App Sandbox is enabled + IsAppSandbox bool `json:"is_app_sandbox"` +} + +func (entity *FirebaseAuthenticationSettingsIos) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FirebaseAuthenticationSettingsIos + + return json.Marshal((*stub)(entity)) +} + +func (*FirebaseAuthenticationSettingsIos) GetClass() string { + return ClassFirebaseAuthenticationSettings +} + +func (*FirebaseAuthenticationSettingsIos) GetType() string { + return TypeFirebaseAuthenticationSettingsIos +} + +func (*FirebaseAuthenticationSettingsIos) FirebaseAuthenticationSettingsType() string { + return TypeFirebaseAuthenticationSettingsIos +} + // Contains settings for the authentication of the user's phone number type PhoneNumberAuthenticationSettings struct { meta @@ -21549,6 +22167,8 @@ type PhoneNumberAuthenticationSettings struct { IsCurrentPhoneNumber bool `json:"is_current_phone_number"` // For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details AllowSmsRetrieverApi bool `json:"allow_sms_retriever_api"` + // For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication + FirebaseAuthenticationSettings FirebaseAuthenticationSettings `json:"firebase_authentication_settings"` // List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions AuthenticationTokens []string `json:"authentication_tokens"` } @@ -21569,6 +22189,33 @@ func (*PhoneNumberAuthenticationSettings) GetType() string { return TypePhoneNumberAuthenticationSettings } +func (phoneNumberAuthenticationSettings *PhoneNumberAuthenticationSettings) UnmarshalJSON(data []byte) error { + var tmp struct { + AllowFlashCall bool `json:"allow_flash_call"` + AllowMissedCall bool `json:"allow_missed_call"` + IsCurrentPhoneNumber bool `json:"is_current_phone_number"` + AllowSmsRetrieverApi bool `json:"allow_sms_retriever_api"` + FirebaseAuthenticationSettings json.RawMessage `json:"firebase_authentication_settings"` + AuthenticationTokens []string `json:"authentication_tokens"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + phoneNumberAuthenticationSettings.AllowFlashCall = tmp.AllowFlashCall + phoneNumberAuthenticationSettings.AllowMissedCall = tmp.AllowMissedCall + phoneNumberAuthenticationSettings.IsCurrentPhoneNumber = tmp.IsCurrentPhoneNumber + phoneNumberAuthenticationSettings.AllowSmsRetrieverApi = tmp.AllowSmsRetrieverApi + phoneNumberAuthenticationSettings.AuthenticationTokens = tmp.AuthenticationTokens + + fieldFirebaseAuthenticationSettings, _ := UnmarshalFirebaseAuthenticationSettings(tmp.FirebaseAuthenticationSettings) + phoneNumberAuthenticationSettings.FirebaseAuthenticationSettings = fieldFirebaseAuthenticationSettings + + return nil +} + // Represents a reaction applied to a message type AddedReaction struct { meta @@ -25914,6 +26561,31 @@ func (*PremiumFeatureAppIcons) PremiumFeatureType() string { return TypePremiumFeatureAppIcons } +// Allowed to translate chat messages real-time +type PremiumFeatureRealTimeChatTranslation struct{ + meta +} + +func (entity *PremiumFeatureRealTimeChatTranslation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureRealTimeChatTranslation + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureRealTimeChatTranslation) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureRealTimeChatTranslation) GetType() string { + return TypePremiumFeatureRealTimeChatTranslation +} + +func (*PremiumFeatureRealTimeChatTranslation) PremiumFeatureType() string { + return TypePremiumFeatureRealTimeChatTranslation +} + // Contains information about a limit, increased for Premium users type PremiumLimit struct { meta @@ -26200,7 +26872,7 @@ type PremiumState struct { // Text description of the state of the current Premium subscription; may be empty if the current user has no Telegram Premium subscription State *FormattedText `json:"state"` // The list of available options for buying Telegram Premium - PaymentOptions []*PremiumPaymentOption `json:"payment_options"` + PaymentOptions []*PremiumStatePaymentOption `json:"payment_options"` // The list of available promotion animations for Premium features Animations []*PremiumFeaturePromotionAnimation `json:"animations"` } @@ -26226,6 +26898,8 @@ type StorePaymentPurposePremiumSubscription struct { meta // Pass true if this is a restore of a Telegram Premium purchase; only for App Store IsRestore bool `json:"is_restore"` + // Pass true if this is an upgrade from a monthly subscription to early subscription; only for App Store + IsUpgrade bool `json:"is_upgrade"` } func (entity *StorePaymentPurposePremiumSubscription) MarshalJSON() ([]byte, error) { @@ -26279,6 +26953,27 @@ func (*StorePaymentPurposeGiftedPremium) StorePaymentPurposeType() string { return TypeStorePaymentPurposeGiftedPremium } +// +type //-To struct{ + meta +} + +func (entity *//-To) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub //-To + + return json.Marshal((*stub)(entity)) +} + +func (*//-To) GetClass() string { + return Class//-To +} + +func (*//-To) GetType() string { + return Type//-To +} + // A token for Firebase Cloud Messaging type DeviceTokenFirebaseCloudMessaging struct { meta @@ -26588,6 +27283,35 @@ func (*DeviceTokenTizenPush) DeviceTokenType() string { return TypeDeviceTokenTizenPush } +// A token for HUAWEI Push Service +type DeviceTokenHuaweiPush struct { + meta + // Device registration token; may be empty to deregister a device + Token string `json:"token"` + // True, if push notifications must be additionally encrypted + Encrypt bool `json:"encrypt"` +} + +func (entity *DeviceTokenHuaweiPush) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenHuaweiPush + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenHuaweiPush) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenHuaweiPush) GetType() string { + return TypeDeviceTokenHuaweiPush +} + +func (*DeviceTokenHuaweiPush) DeviceTokenType() string { + return TypeDeviceTokenHuaweiPush +} + // Contains a globally unique push receiver identifier, which can be used to identify which account has received a push notification type PushReceiverId struct { meta @@ -28209,7 +28933,7 @@ func (*PushMessageContentChatChangeTitle) PushMessageContentType() string { // A chat theme was edited type PushMessageContentChatSetTheme struct { meta - // If non-empty, name of a new theme, set for the chat. Otherwise chat theme was reset to the default one + // If non-empty, name of a new theme, set for the chat. Otherwise, the chat theme was reset to the default one ThemeName string `json:"theme_name"` } @@ -30675,7 +31399,7 @@ func (*InternalLinkTypeActiveSessions) InternalLinkTypeType() string { return TypeInternalLinkTypeActiveSessions } -// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then user needs to confirm adding the bot to attachment menu. If user confirms adding, then use toggleBotIsAddedToAttachmentMenu to add it. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL +// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then user needs to confirm adding the bot to attachment menu. If user confirms adding, then use toggleBotIsAddedToAttachmentMenu to add it. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL type InternalLinkTypeAttachmentMenuBot struct { meta // Target chat to be opened @@ -30812,7 +31536,7 @@ func (*InternalLinkTypeBotStart) InternalLinkTypeType() string { return TypeInternalLinkTypeBotStart } -// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat, otherwise just send /start message with bot's username added to the chat. +// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat. type InternalLinkTypeBotStartInGroup struct { meta // Username of the bot @@ -30843,7 +31567,7 @@ func (*InternalLinkTypeBotStartInGroup) InternalLinkTypeType() string { return TypeInternalLinkTypeBotStartInGroup } -// The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, ask the current user to select a channel chat to add the bot to as an administrator. Then call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights +// The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, ask the current user to select a channel chat to add the bot to as an administrator. Then, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights type InternalLinkTypeBotAddToChannel struct { meta // Username of the bot @@ -31192,7 +31916,7 @@ func (*InternalLinkTypeMessageDraft) InternalLinkTypeType() string { return TypeInternalLinkTypeMessageDraft } -// The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application, otherwise ignore it +// The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it type InternalLinkTypePassportDataRequest struct { meta // User identifier of the service's bot @@ -31203,7 +31927,7 @@ type InternalLinkTypePassportDataRequest struct { PublicKey string `json:"public_key"` // Unique request identifier provided by the service Nonce string `json:"nonce"` - // An HTTP URL to open once the request is finished or canceled with the parameter tg_passport=success or tg_passport=cancel respectively. If empty, then the link tgbot{bot_user_id}://passport/success or tgbot{bot_user_id}://passport/cancel needs to be opened instead + // An HTTP URL to open once the request is finished, canceled, or failed with the parameters tg_passport=success, tg_passport=cancel, or tg_passport=error&error=... respectively. If empty, then onActivityResult method must be used to return response on Android, or the link tgbot{bot_user_id}://passport/success or tgbot{bot_user_id}://passport/cancel must be opened otherwise CallbackUrl string `json:"callback_url"` } @@ -32691,6 +33415,189 @@ func (*AutoDownloadSettingsPresets) GetType() string { return TypeAutoDownloadSettingsPresets } +// Autosave settings applied to all private chats without chat-specific settings +type AutosaveSettingsScopePrivateChats struct{ + meta +} + +func (entity *AutosaveSettingsScopePrivateChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AutosaveSettingsScopePrivateChats + + return json.Marshal((*stub)(entity)) +} + +func (*AutosaveSettingsScopePrivateChats) GetClass() string { + return ClassAutosaveSettingsScope +} + +func (*AutosaveSettingsScopePrivateChats) GetType() string { + return TypeAutosaveSettingsScopePrivateChats +} + +func (*AutosaveSettingsScopePrivateChats) AutosaveSettingsScopeType() string { + return TypeAutosaveSettingsScopePrivateChats +} + +// Autosave settings applied to all basic group and supergroup chats without chat-specific settings +type AutosaveSettingsScopeGroupChats struct{ + meta +} + +func (entity *AutosaveSettingsScopeGroupChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AutosaveSettingsScopeGroupChats + + return json.Marshal((*stub)(entity)) +} + +func (*AutosaveSettingsScopeGroupChats) GetClass() string { + return ClassAutosaveSettingsScope +} + +func (*AutosaveSettingsScopeGroupChats) GetType() string { + return TypeAutosaveSettingsScopeGroupChats +} + +func (*AutosaveSettingsScopeGroupChats) AutosaveSettingsScopeType() string { + return TypeAutosaveSettingsScopeGroupChats +} + +// Autosave settings applied to all channel chats without chat-specific settings +type AutosaveSettingsScopeChannelChats struct{ + meta +} + +func (entity *AutosaveSettingsScopeChannelChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AutosaveSettingsScopeChannelChats + + return json.Marshal((*stub)(entity)) +} + +func (*AutosaveSettingsScopeChannelChats) GetClass() string { + return ClassAutosaveSettingsScope +} + +func (*AutosaveSettingsScopeChannelChats) GetType() string { + return TypeAutosaveSettingsScopeChannelChats +} + +func (*AutosaveSettingsScopeChannelChats) AutosaveSettingsScopeType() string { + return TypeAutosaveSettingsScopeChannelChats +} + +// Autosave settings applied to a chat +type AutosaveSettingsScopeChat struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +func (entity *AutosaveSettingsScopeChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AutosaveSettingsScopeChat + + return json.Marshal((*stub)(entity)) +} + +func (*AutosaveSettingsScopeChat) GetClass() string { + return ClassAutosaveSettingsScope +} + +func (*AutosaveSettingsScopeChat) GetType() string { + return TypeAutosaveSettingsScopeChat +} + +func (*AutosaveSettingsScopeChat) AutosaveSettingsScopeType() string { + return TypeAutosaveSettingsScopeChat +} + +// Contains autosave settings for an autosave settings scope +type ScopeAutosaveSettings struct { + meta + // True, if photo autosave is enabled + AutosavePhotos bool `json:"autosave_photos"` + // True, if video autosave is enabled + AutosaveVideos bool `json:"autosave_videos"` + // The maximum size of a video file to be autosaved, in bytes; 512 KB - 4000 MB + MaxVideoFileSize int64 `json:"max_video_file_size"` +} + +func (entity *ScopeAutosaveSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ScopeAutosaveSettings + + return json.Marshal((*stub)(entity)) +} + +func (*ScopeAutosaveSettings) GetClass() string { + return ClassScopeAutosaveSettings +} + +func (*ScopeAutosaveSettings) GetType() string { + return TypeScopeAutosaveSettings +} + +// Contains autosave settings for a chat, which overrides default settings for the corresponding scope +type AutosaveSettingsException struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Autosave settings for the chat + Settings *ScopeAutosaveSettings `json:"settings"` +} + +func (entity *AutosaveSettingsException) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AutosaveSettingsException + + return json.Marshal((*stub)(entity)) +} + +func (*AutosaveSettingsException) GetClass() string { + return ClassAutosaveSettingsException +} + +func (*AutosaveSettingsException) GetType() string { + return TypeAutosaveSettingsException +} + +// Describes autosave settings +type AutosaveSettings struct { + meta + // Default autosave settings for private chats + PrivateChatSettings *ScopeAutosaveSettings `json:"private_chat_settings"` + // Default autosave settings for basic group and supergroup chats + GroupSettings *ScopeAutosaveSettings `json:"group_settings"` + // Default autosave settings for channel chats + ChannelSettings *ScopeAutosaveSettings `json:"channel_settings"` + // Autosave settings for specific chats + Exceptions []*AutosaveSettingsException `json:"exceptions"` +} + +func (entity *AutosaveSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AutosaveSettings + + return json.Marshal((*stub)(entity)) +} + +func (*AutosaveSettings) GetClass() string { + return ClassAutosaveSettings +} + +func (*AutosaveSettings) GetType() string { + return TypeAutosaveSettings +} + // Currently waiting for the network to become available. Use setNetworkType to change the available network type type ConnectionStateWaitingForNetwork struct{ meta @@ -33296,7 +34203,7 @@ func (*SuggestedActionConvertToBroadcastGroup) SuggestedActionType() string { // Suggests the user to set a 2-step verification password to be able to log in again type SuggestedActionSetPassword struct { meta - // The number of days to pass between consecutive authorizations if the user declines to set password + // The number of days to pass between consecutive authorizations if the user declines to set password; if 0, then the user is advised to set the password for security reasons AuthorizationDelay int32 `json:"authorization_delay"` } @@ -33320,6 +34227,56 @@ func (*SuggestedActionSetPassword) SuggestedActionType() string { return TypeSuggestedActionSetPassword } +// Suggests the user to upgrade the Premium subscription from monthly payments to annual payments +type SuggestedActionUpgradePremium struct{ + meta +} + +func (entity *SuggestedActionUpgradePremium) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionUpgradePremium + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionUpgradePremium) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionUpgradePremium) GetType() string { + return TypeSuggestedActionUpgradePremium +} + +func (*SuggestedActionUpgradePremium) SuggestedActionType() string { + return TypeSuggestedActionUpgradePremium +} + +// Suggests the user to subscribe to the Premium subscription with annual payments +type SuggestedActionSubscribeToAnnualPremium struct{ + meta +} + +func (entity *SuggestedActionSubscribeToAnnualPremium) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionSubscribeToAnnualPremium + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionSubscribeToAnnualPremium) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionSubscribeToAnnualPremium) GetType() string { + return TypeSuggestedActionSubscribeToAnnualPremium +} + +func (*SuggestedActionSubscribeToAnnualPremium) SuggestedActionType() string { + return TypeSuggestedActionSubscribeToAnnualPremium +} + // Contains a counter type Count struct { meta @@ -35093,7 +36050,7 @@ func (*UpdateChatLastMessage) UpdateType() string { return TypeUpdateChatLastMessage } -// The position of a chat in a chat list has changed. Instead of this update updateChatLastMessage or updateChatDraftMessage might be sent +// The position of a chat in a chat list has changed. An updateChatLastMessage or updateChatDraftMessage update might be sent instead of the update type UpdateChatPosition struct { meta // Chat identifier @@ -35647,33 +36604,62 @@ func (*UpdateChatHasProtectedContent) UpdateType() string { return TypeUpdateChatHasProtectedContent } -// A chat's has_scheduled_messages field has changed -type UpdateChatHasScheduledMessages struct { +// Translation of chat messages was enabled or disabled +type UpdateChatIsTranslatable struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // New value of has_scheduled_messages - HasScheduledMessages bool `json:"has_scheduled_messages"` + // New value of is_translatable + IsTranslatable bool `json:"is_translatable"` } -func (entity *UpdateChatHasScheduledMessages) MarshalJSON() ([]byte, error) { +func (entity *UpdateChatIsTranslatable) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateChatHasScheduledMessages + type stub UpdateChatIsTranslatable return json.Marshal((*stub)(entity)) } -func (*UpdateChatHasScheduledMessages) GetClass() string { +func (*UpdateChatIsTranslatable) GetClass() string { return ClassUpdate } -func (*UpdateChatHasScheduledMessages) GetType() string { - return TypeUpdateChatHasScheduledMessages +func (*UpdateChatIsTranslatable) GetType() string { + return TypeUpdateChatIsTranslatable } -func (*UpdateChatHasScheduledMessages) UpdateType() string { - return TypeUpdateChatHasScheduledMessages +func (*UpdateChatIsTranslatable) UpdateType() string { + return TypeUpdateChatIsTranslatable +} + +// A chat was marked as unread or was read +type UpdateChatIsMarkedAsUnread struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of is_marked_as_unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` +} + +func (entity *UpdateChatIsMarkedAsUnread) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatIsMarkedAsUnread + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatIsMarkedAsUnread) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatIsMarkedAsUnread) GetType() string { + return TypeUpdateChatIsMarkedAsUnread +} + +func (*UpdateChatIsMarkedAsUnread) UpdateType() string { + return TypeUpdateChatIsMarkedAsUnread } // A chat was blocked or unblocked @@ -35705,33 +36691,33 @@ func (*UpdateChatIsBlocked) UpdateType() string { return TypeUpdateChatIsBlocked } -// A chat was marked as unread or was read -type UpdateChatIsMarkedAsUnread struct { +// A chat's has_scheduled_messages field has changed +type UpdateChatHasScheduledMessages struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // New value of is_marked_as_unread - IsMarkedAsUnread bool `json:"is_marked_as_unread"` + // New value of has_scheduled_messages + HasScheduledMessages bool `json:"has_scheduled_messages"` } -func (entity *UpdateChatIsMarkedAsUnread) MarshalJSON() ([]byte, error) { +func (entity *UpdateChatHasScheduledMessages) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateChatIsMarkedAsUnread + type stub UpdateChatHasScheduledMessages return json.Marshal((*stub)(entity)) } -func (*UpdateChatIsMarkedAsUnread) GetClass() string { +func (*UpdateChatHasScheduledMessages) GetClass() string { return ClassUpdate } -func (*UpdateChatIsMarkedAsUnread) GetType() string { - return TypeUpdateChatIsMarkedAsUnread +func (*UpdateChatHasScheduledMessages) GetType() string { + return TypeUpdateChatHasScheduledMessages } -func (*UpdateChatIsMarkedAsUnread) UpdateType() string { - return TypeUpdateChatIsMarkedAsUnread +func (*UpdateChatHasScheduledMessages) UpdateType() string { + return TypeUpdateChatHasScheduledMessages } // The list of chat filters or a chat filter has changed @@ -37067,7 +38053,7 @@ func (updateTrendingStickerSets *UpdateTrendingStickerSets) UnmarshalJSON(data [ // The list of recently used stickers was updated type UpdateRecentStickers struct { meta - // True, if the list of stickers attached to photo or video files was updated, otherwise the list of sent stickers is updated + // True, if the list of stickers attached to photo or video files was updated; otherwise, the list of sent stickers is updated IsAttached bool `json:"is_attached"` // The new list of file identifiers of recently used stickers StickerIds []int32 `json:"sticker_ids"` @@ -37620,6 +38606,54 @@ func (updateSuggestedActions *UpdateSuggestedActions) UnmarshalJSON(data []byte) return nil } +// Autosave settings for some type of chats were updated +type UpdateAutosaveSettings struct { + meta + // Type of chats for which autosave settings were updated + Scope AutosaveSettingsScope `json:"scope"` + // The new autosave settings; may be null if the settings are reset to default + Settings *ScopeAutosaveSettings `json:"settings"` +} + +func (entity *UpdateAutosaveSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAutosaveSettings + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAutosaveSettings) GetClass() string { + return ClassUpdate +} + +func (*UpdateAutosaveSettings) GetType() string { + return TypeUpdateAutosaveSettings +} + +func (*UpdateAutosaveSettings) UpdateType() string { + return TypeUpdateAutosaveSettings +} + +func (updateAutosaveSettings *UpdateAutosaveSettings) UnmarshalJSON(data []byte) error { + var tmp struct { + Scope json.RawMessage `json:"scope"` + Settings *ScopeAutosaveSettings `json:"settings"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateAutosaveSettings.Settings = tmp.Settings + + fieldScope, _ := UnmarshalAutosaveSettingsScope(tmp.Scope) + updateAutosaveSettings.Scope = fieldScope + + return nil +} + // A new incoming inline query; for bots only type UpdateNewInlineQuery struct { meta @@ -38075,6 +39109,8 @@ type UpdateNewChatJoinRequest struct { ChatId int64 `json:"chat_id"` // Join request Request *ChatJoinRequest `json:"request"` + // Chat identifier of the private chat with the user + UserChatId int64 `json:"user_chat_id"` // The invite link, which was used to send join request; may be null InviteLink *ChatInviteLink `json:"invite_link"` } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index b5dee82..fc5c07c 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -34,6 +34,12 @@ func UnmarshalAuthenticationCodeType(data json.RawMessage) (AuthenticationCodeTy case TypeAuthenticationCodeTypeFragment: return UnmarshalAuthenticationCodeTypeFragment(data) + case TypeAuthenticationCodeTypeFirebaseAndroid: + return UnmarshalAuthenticationCodeTypeFirebaseAndroid(data) + + case TypeAuthenticationCodeTypeFirebaseIos: + return UnmarshalAuthenticationCodeTypeFirebaseIos(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -468,6 +474,40 @@ func UnmarshalListOfUserType(dataList []json.RawMessage) ([]UserType, error) { return list, nil } +func UnmarshalChatPhotoStickerType(data json.RawMessage) (ChatPhotoStickerType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatPhotoStickerTypeRegularOrMask: + return UnmarshalChatPhotoStickerTypeRegularOrMask(data) + + case TypeChatPhotoStickerTypeCustomEmoji: + return UnmarshalChatPhotoStickerTypeCustomEmoji(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatPhotoStickerType(dataList []json.RawMessage) ([]ChatPhotoStickerType, error) { + list := []ChatPhotoStickerType{} + + for _, data := range dataList { + entity, err := UnmarshalChatPhotoStickerType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputChatPhoto(data json.RawMessage) (InputChatPhoto, error) { var meta meta @@ -486,6 +526,9 @@ func UnmarshalInputChatPhoto(data json.RawMessage) (InputChatPhoto, error) { case TypeInputChatPhotoAnimation: return UnmarshalInputChatPhotoAnimation(data) + case TypeInputChatPhotoSticker: + return UnmarshalInputChatPhotoSticker(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -1120,6 +1163,12 @@ func UnmarshalKeyboardButtonType(data json.RawMessage) (KeyboardButtonType, erro case TypeKeyboardButtonTypeRequestPoll: return UnmarshalKeyboardButtonTypeRequestPoll(data) + case TypeKeyboardButtonTypeRequestUser: + return UnmarshalKeyboardButtonTypeRequestUser(data) + + case TypeKeyboardButtonTypeRequestChat: + return UnmarshalKeyboardButtonTypeRequestChat(data) + case TypeKeyboardButtonTypeWebApp: return UnmarshalKeyboardButtonTypeWebApp(data) @@ -2160,6 +2209,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) + case TypeMessageUserShared: + return UnmarshalMessageUserShared(data) + + case TypeMessageChatShared: + return UnmarshalMessageChatShared(data) + case TypeMessageWebsiteConnected: return UnmarshalMessageWebsiteConnected(data) @@ -2602,6 +2657,43 @@ func UnmarshalListOfUserStatus(dataList []json.RawMessage) ([]UserStatus, error) return list, nil } +func UnmarshalEmojiCategoryType(data json.RawMessage) (EmojiCategoryType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeEmojiCategoryTypeDefault: + return UnmarshalEmojiCategoryTypeDefault(data) + + case TypeEmojiCategoryTypeEmojiStatus: + return UnmarshalEmojiCategoryTypeEmojiStatus(data) + + case TypeEmojiCategoryTypeChatPhoto: + return UnmarshalEmojiCategoryTypeChatPhoto(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfEmojiCategoryType(dataList []json.RawMessage) ([]EmojiCategoryType, error) { + list := []EmojiCategoryType{} + + for _, data := range dataList { + entity, err := UnmarshalEmojiCategoryType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) { var meta meta @@ -2817,6 +2909,40 @@ func UnmarshalListOfCallProblem(dataList []json.RawMessage) ([]CallProblem, erro return list, nil } +func UnmarshalFirebaseAuthenticationSettings(data json.RawMessage) (FirebaseAuthenticationSettings, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeFirebaseAuthenticationSettingsAndroid: + return UnmarshalFirebaseAuthenticationSettingsAndroid(data) + + case TypeFirebaseAuthenticationSettingsIos: + return UnmarshalFirebaseAuthenticationSettingsIos(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfFirebaseAuthenticationSettings(dataList []json.RawMessage) ([]FirebaseAuthenticationSettings, error) { + list := []FirebaseAuthenticationSettings{} + + for _, data := range dataList { + entity, err := UnmarshalFirebaseAuthenticationSettings(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalDiceStickers(data json.RawMessage) (DiceStickers, error) { var meta meta @@ -3359,6 +3485,9 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureAppIcons: return UnmarshalPremiumFeatureAppIcons(data) + case TypePremiumFeatureRealTimeChatTranslation: + return UnmarshalPremiumFeatureRealTimeChatTranslation(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3494,6 +3623,9 @@ func UnmarshalDeviceToken(data json.RawMessage) (DeviceToken, error) { case TypeDeviceTokenTizenPush: return UnmarshalDeviceTokenTizenPush(data) + case TypeDeviceTokenHuaweiPush: + return UnmarshalDeviceTokenHuaweiPush(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4675,6 +4807,46 @@ func UnmarshalListOfNetworkStatisticsEntry(dataList []json.RawMessage) ([]Networ return list, nil } +func UnmarshalAutosaveSettingsScope(data json.RawMessage) (AutosaveSettingsScope, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeAutosaveSettingsScopePrivateChats: + return UnmarshalAutosaveSettingsScopePrivateChats(data) + + case TypeAutosaveSettingsScopeGroupChats: + return UnmarshalAutosaveSettingsScopeGroupChats(data) + + case TypeAutosaveSettingsScopeChannelChats: + return UnmarshalAutosaveSettingsScopeChannelChats(data) + + case TypeAutosaveSettingsScopeChat: + return UnmarshalAutosaveSettingsScopeChat(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfAutosaveSettingsScope(dataList []json.RawMessage) ([]AutosaveSettingsScope, error) { + list := []AutosaveSettingsScope{} + + for _, data := range dataList { + entity, err := UnmarshalAutosaveSettingsScope(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalConnectionState(data json.RawMessage) (ConnectionState, error) { var meta meta @@ -4834,6 +5006,12 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionSetPassword: return UnmarshalSuggestedActionSetPassword(data) + case TypeSuggestedActionUpgradePremium: + return UnmarshalSuggestedActionUpgradePremium(data) + + case TypeSuggestedActionSubscribeToAnnualPremium: + return UnmarshalSuggestedActionSubscribeToAnnualPremium(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -5192,14 +5370,17 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatHasProtectedContent: return UnmarshalUpdateChatHasProtectedContent(data) - case TypeUpdateChatHasScheduledMessages: - return UnmarshalUpdateChatHasScheduledMessages(data) + case TypeUpdateChatIsTranslatable: + return UnmarshalUpdateChatIsTranslatable(data) + + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(data) case TypeUpdateChatIsBlocked: return UnmarshalUpdateChatIsBlocked(data) - case TypeUpdateChatIsMarkedAsUnread: - return UnmarshalUpdateChatIsMarkedAsUnread(data) + case TypeUpdateChatHasScheduledMessages: + return UnmarshalUpdateChatHasScheduledMessages(data) case TypeUpdateChatFilters: return UnmarshalUpdateChatFilters(data) @@ -5366,6 +5547,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(data) + case TypeUpdateAutosaveSettings: + return UnmarshalUpdateAutosaveSettings(data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(data) @@ -5522,6 +5706,22 @@ func UnmarshalAuthenticationCodeTypeFragment(data json.RawMessage) (*Authenticat return &resp, err } +func UnmarshalAuthenticationCodeTypeFirebaseAndroid(data json.RawMessage) (*AuthenticationCodeTypeFirebaseAndroid, error) { + var resp AuthenticationCodeTypeFirebaseAndroid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthenticationCodeTypeFirebaseIos(data json.RawMessage) (*AuthenticationCodeTypeFirebaseIos, error) { + var resp AuthenticationCodeTypeFirebaseIos + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAuthenticationCodeInfo(data json.RawMessage) (*AuthenticationCodeInfo, error) { var resp AuthenticationCodeInfo @@ -6186,6 +6386,30 @@ func UnmarshalChatLocation(data json.RawMessage) (*ChatLocation, error) { return &resp, err } +func UnmarshalChatPhotoStickerTypeRegularOrMask(data json.RawMessage) (*ChatPhotoStickerTypeRegularOrMask, error) { + var resp ChatPhotoStickerTypeRegularOrMask + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatPhotoStickerTypeCustomEmoji(data json.RawMessage) (*ChatPhotoStickerTypeCustomEmoji, error) { + var resp ChatPhotoStickerTypeCustomEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatPhotoSticker(data json.RawMessage) (*ChatPhotoSticker, error) { + var resp ChatPhotoSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAnimatedChatPhoto(data json.RawMessage) (*AnimatedChatPhoto, error) { var resp AnimatedChatPhoto @@ -6234,6 +6458,14 @@ func UnmarshalInputChatPhotoAnimation(data json.RawMessage) (*InputChatPhotoAnim return &resp, err } +func UnmarshalInputChatPhotoSticker(data json.RawMessage) (*InputChatPhotoSticker, error) { + var resp InputChatPhotoSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatPermissions(data json.RawMessage) (*ChatPermissions, error) { var resp ChatPermissions @@ -6258,6 +6490,14 @@ func UnmarshalPremiumPaymentOption(data json.RawMessage) (*PremiumPaymentOption, return &resp, err } +func UnmarshalPremiumStatePaymentOption(data json.RawMessage) (*PremiumStatePaymentOption, error) { + var resp PremiumStatePaymentOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiStatus(data json.RawMessage) (*EmojiStatus, error) { var resp EmojiStatus @@ -7242,6 +7482,22 @@ func UnmarshalKeyboardButtonTypeRequestPoll(data json.RawMessage) (*KeyboardButt return &resp, err } +func UnmarshalKeyboardButtonTypeRequestUser(data json.RawMessage) (*KeyboardButtonTypeRequestUser, error) { + var resp KeyboardButtonTypeRequestUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalKeyboardButtonTypeRequestChat(data json.RawMessage) (*KeyboardButtonTypeRequestChat, error) { + var resp KeyboardButtonTypeRequestChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalKeyboardButtonTypeWebApp(data json.RawMessage) (*KeyboardButtonTypeWebApp, error) { var resp KeyboardButtonTypeWebApp @@ -9122,6 +9378,22 @@ func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactReg return &resp, err } +func UnmarshalMessageUserShared(data json.RawMessage) (*MessageUserShared, error) { + var resp MessageUserShared + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatShared(data json.RawMessage) (*MessageChatShared, error) { + var resp MessageChatShared + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageWebsiteConnected(data json.RawMessage) (*MessageWebsiteConnected, error) { var resp MessageWebsiteConnected @@ -9874,6 +10146,46 @@ func UnmarshalTrendingStickerSets(data json.RawMessage) (*TrendingStickerSets, e return &resp, err } +func UnmarshalEmojiCategory(data json.RawMessage) (*EmojiCategory, error) { + var resp EmojiCategory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiCategories(data json.RawMessage) (*EmojiCategories, error) { + var resp EmojiCategories + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiCategoryTypeDefault(data json.RawMessage) (*EmojiCategoryTypeDefault, error) { + var resp EmojiCategoryTypeDefault + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiCategoryTypeEmojiStatus(data json.RawMessage) (*EmojiCategoryTypeEmojiStatus, error) { + var resp EmojiCategoryTypeEmojiStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiCategoryTypeChatPhoto(data json.RawMessage) (*EmojiCategoryTypeChatPhoto, error) { + var resp EmojiCategoryTypeChatPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallDiscardReasonEmpty(data json.RawMessage) (*CallDiscardReasonEmpty, error) { var resp CallDiscardReasonEmpty @@ -10178,6 +10490,22 @@ func UnmarshalCall(data json.RawMessage) (*Call, error) { return &resp, err } +func UnmarshalFirebaseAuthenticationSettingsAndroid(data json.RawMessage) (*FirebaseAuthenticationSettingsAndroid, error) { + var resp FirebaseAuthenticationSettingsAndroid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFirebaseAuthenticationSettingsIos(data json.RawMessage) (*FirebaseAuthenticationSettingsIos, error) { + var resp FirebaseAuthenticationSettingsIos + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPhoneNumberAuthenticationSettings(data json.RawMessage) (*PhoneNumberAuthenticationSettings, error) { var resp PhoneNumberAuthenticationSettings @@ -11202,6 +11530,14 @@ func UnmarshalPremiumFeatureAppIcons(data json.RawMessage) (*PremiumFeatureAppIc return &resp, err } +func UnmarshalPremiumFeatureRealTimeChatTranslation(data json.RawMessage) (*PremiumFeatureRealTimeChatTranslation, error) { + var resp PremiumFeatureRealTimeChatTranslation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumLimit(data json.RawMessage) (*PremiumLimit, error) { var resp PremiumLimit @@ -11282,6 +11618,14 @@ func UnmarshalStorePaymentPurposeGiftedPremium(data json.RawMessage) (*StorePaym return &resp, err } +func Unmarshal//-To(data json.RawMessage) (*//-To, error) { + var resp //-To + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeviceTokenFirebaseCloudMessaging(data json.RawMessage) (*DeviceTokenFirebaseCloudMessaging, error) { var resp DeviceTokenFirebaseCloudMessaging @@ -11370,6 +11714,14 @@ func UnmarshalDeviceTokenTizenPush(data json.RawMessage) (*DeviceTokenTizenPush, return &resp, err } +func UnmarshalDeviceTokenHuaweiPush(data json.RawMessage) (*DeviceTokenHuaweiPush, error) { + var resp DeviceTokenHuaweiPush + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushReceiverId(data json.RawMessage) (*PushReceiverId, error) { var resp PushReceiverId @@ -13058,6 +13410,62 @@ func UnmarshalAutoDownloadSettingsPresets(data json.RawMessage) (*AutoDownloadSe return &resp, err } +func UnmarshalAutosaveSettingsScopePrivateChats(data json.RawMessage) (*AutosaveSettingsScopePrivateChats, error) { + var resp AutosaveSettingsScopePrivateChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAutosaveSettingsScopeGroupChats(data json.RawMessage) (*AutosaveSettingsScopeGroupChats, error) { + var resp AutosaveSettingsScopeGroupChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAutosaveSettingsScopeChannelChats(data json.RawMessage) (*AutosaveSettingsScopeChannelChats, error) { + var resp AutosaveSettingsScopeChannelChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAutosaveSettingsScopeChat(data json.RawMessage) (*AutosaveSettingsScopeChat, error) { + var resp AutosaveSettingsScopeChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalScopeAutosaveSettings(data json.RawMessage) (*ScopeAutosaveSettings, error) { + var resp ScopeAutosaveSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAutosaveSettingsException(data json.RawMessage) (*AutosaveSettingsException, error) { + var resp AutosaveSettingsException + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAutosaveSettings(data json.RawMessage) (*AutosaveSettings, error) { + var resp AutosaveSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalConnectionStateWaitingForNetwork(data json.RawMessage) (*ConnectionStateWaitingForNetwork, error) { var resp ConnectionStateWaitingForNetwork @@ -13250,6 +13658,22 @@ func UnmarshalSuggestedActionSetPassword(data json.RawMessage) (*SuggestedAction return &resp, err } +func UnmarshalSuggestedActionUpgradePremium(data json.RawMessage) (*SuggestedActionUpgradePremium, error) { + var resp SuggestedActionUpgradePremium + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedActionSubscribeToAnnualPremium(data json.RawMessage) (*SuggestedActionSubscribeToAnnualPremium, error) { + var resp SuggestedActionSubscribeToAnnualPremium + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCount(data json.RawMessage) (*Count, error) { var resp Count @@ -13810,8 +14234,16 @@ func UnmarshalUpdateChatHasProtectedContent(data json.RawMessage) (*UpdateChatHa return &resp, err } -func UnmarshalUpdateChatHasScheduledMessages(data json.RawMessage) (*UpdateChatHasScheduledMessages, error) { - var resp UpdateChatHasScheduledMessages +func UnmarshalUpdateChatIsTranslatable(data json.RawMessage) (*UpdateChatIsTranslatable, error) { + var resp UpdateChatIsTranslatable + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatIsMarkedAsUnread(data json.RawMessage) (*UpdateChatIsMarkedAsUnread, error) { + var resp UpdateChatIsMarkedAsUnread err := json.Unmarshal(data, &resp) @@ -13826,8 +14258,8 @@ func UnmarshalUpdateChatIsBlocked(data json.RawMessage) (*UpdateChatIsBlocked, e return &resp, err } -func UnmarshalUpdateChatIsMarkedAsUnread(data json.RawMessage) (*UpdateChatIsMarkedAsUnread, error) { - var resp UpdateChatIsMarkedAsUnread +func UnmarshalUpdateChatHasScheduledMessages(data json.RawMessage) (*UpdateChatHasScheduledMessages, error) { + var resp UpdateChatHasScheduledMessages err := json.Unmarshal(data, &resp) @@ -14274,6 +14706,14 @@ func UnmarshalUpdateSuggestedActions(data json.RawMessage) (*UpdateSuggestedActi return &resp, err } +func UnmarshalUpdateAutosaveSettings(data json.RawMessage) (*UpdateAutosaveSettings, error) { + var resp UpdateAutosaveSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewInlineQuery(data json.RawMessage) (*UpdateNewInlineQuery, error) { var resp UpdateNewInlineQuery @@ -14515,6 +14955,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAuthenticationCodeTypeFragment: return UnmarshalAuthenticationCodeTypeFragment(data) + case TypeAuthenticationCodeTypeFirebaseAndroid: + return UnmarshalAuthenticationCodeTypeFirebaseAndroid(data) + + case TypeAuthenticationCodeTypeFirebaseIos: + return UnmarshalAuthenticationCodeTypeFirebaseIos(data) + case TypeAuthenticationCodeInfo: return UnmarshalAuthenticationCodeInfo(data) @@ -14764,6 +15210,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatLocation: return UnmarshalChatLocation(data) + case TypeChatPhotoStickerTypeRegularOrMask: + return UnmarshalChatPhotoStickerTypeRegularOrMask(data) + + case TypeChatPhotoStickerTypeCustomEmoji: + return UnmarshalChatPhotoStickerTypeCustomEmoji(data) + + case TypeChatPhotoSticker: + return UnmarshalChatPhotoSticker(data) + case TypeAnimatedChatPhoto: return UnmarshalAnimatedChatPhoto(data) @@ -14782,6 +15237,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputChatPhotoAnimation: return UnmarshalInputChatPhotoAnimation(data) + case TypeInputChatPhotoSticker: + return UnmarshalInputChatPhotoSticker(data) + case TypeChatPermissions: return UnmarshalChatPermissions(data) @@ -14791,6 +15249,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumPaymentOption: return UnmarshalPremiumPaymentOption(data) + case TypePremiumStatePaymentOption: + return UnmarshalPremiumStatePaymentOption(data) + case TypeEmojiStatus: return UnmarshalEmojiStatus(data) @@ -15160,6 +15621,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeKeyboardButtonTypeRequestPoll: return UnmarshalKeyboardButtonTypeRequestPoll(data) + case TypeKeyboardButtonTypeRequestUser: + return UnmarshalKeyboardButtonTypeRequestUser(data) + + case TypeKeyboardButtonTypeRequestChat: + return UnmarshalKeyboardButtonTypeRequestChat(data) + case TypeKeyboardButtonTypeWebApp: return UnmarshalKeyboardButtonTypeWebApp(data) @@ -15865,6 +16332,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) + case TypeMessageUserShared: + return UnmarshalMessageUserShared(data) + + case TypeMessageChatShared: + return UnmarshalMessageChatShared(data) + case TypeMessageWebsiteConnected: return UnmarshalMessageWebsiteConnected(data) @@ -16147,6 +16620,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTrendingStickerSets: return UnmarshalTrendingStickerSets(data) + case TypeEmojiCategory: + return UnmarshalEmojiCategory(data) + + case TypeEmojiCategories: + return UnmarshalEmojiCategories(data) + + case TypeEmojiCategoryTypeDefault: + return UnmarshalEmojiCategoryTypeDefault(data) + + case TypeEmojiCategoryTypeEmojiStatus: + return UnmarshalEmojiCategoryTypeEmojiStatus(data) + + case TypeEmojiCategoryTypeChatPhoto: + return UnmarshalEmojiCategoryTypeChatPhoto(data) + case TypeCallDiscardReasonEmpty: return UnmarshalCallDiscardReasonEmpty(data) @@ -16261,6 +16749,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCall: return UnmarshalCall(data) + case TypeFirebaseAuthenticationSettingsAndroid: + return UnmarshalFirebaseAuthenticationSettingsAndroid(data) + + case TypeFirebaseAuthenticationSettingsIos: + return UnmarshalFirebaseAuthenticationSettingsIos(data) + case TypePhoneNumberAuthenticationSettings: return UnmarshalPhoneNumberAuthenticationSettings(data) @@ -16645,6 +17139,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureAppIcons: return UnmarshalPremiumFeatureAppIcons(data) + case TypePremiumFeatureRealTimeChatTranslation: + return UnmarshalPremiumFeatureRealTimeChatTranslation(data) + case TypePremiumLimit: return UnmarshalPremiumLimit(data) @@ -16675,6 +17172,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposeGiftedPremium: return UnmarshalStorePaymentPurposeGiftedPremium(data) + case Type//-To: + return Unmarshal//-To(data) + case TypeDeviceTokenFirebaseCloudMessaging: return UnmarshalDeviceTokenFirebaseCloudMessaging(data) @@ -16708,6 +17208,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeDeviceTokenTizenPush: return UnmarshalDeviceTokenTizenPush(data) + case TypeDeviceTokenHuaweiPush: + return UnmarshalDeviceTokenHuaweiPush(data) + case TypePushReceiverId: return UnmarshalPushReceiverId(data) @@ -17341,6 +17844,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAutoDownloadSettingsPresets: return UnmarshalAutoDownloadSettingsPresets(data) + case TypeAutosaveSettingsScopePrivateChats: + return UnmarshalAutosaveSettingsScopePrivateChats(data) + + case TypeAutosaveSettingsScopeGroupChats: + return UnmarshalAutosaveSettingsScopeGroupChats(data) + + case TypeAutosaveSettingsScopeChannelChats: + return UnmarshalAutosaveSettingsScopeChannelChats(data) + + case TypeAutosaveSettingsScopeChat: + return UnmarshalAutosaveSettingsScopeChat(data) + + case TypeScopeAutosaveSettings: + return UnmarshalScopeAutosaveSettings(data) + + case TypeAutosaveSettingsException: + return UnmarshalAutosaveSettingsException(data) + + case TypeAutosaveSettings: + return UnmarshalAutosaveSettings(data) + case TypeConnectionStateWaitingForNetwork: return UnmarshalConnectionStateWaitingForNetwork(data) @@ -17413,6 +17937,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionSetPassword: return UnmarshalSuggestedActionSetPassword(data) + case TypeSuggestedActionUpgradePremium: + return UnmarshalSuggestedActionUpgradePremium(data) + + case TypeSuggestedActionSubscribeToAnnualPremium: + return UnmarshalSuggestedActionSubscribeToAnnualPremium(data) + case TypeCount: return UnmarshalCount(data) @@ -17623,14 +18153,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatHasProtectedContent: return UnmarshalUpdateChatHasProtectedContent(data) - case TypeUpdateChatHasScheduledMessages: - return UnmarshalUpdateChatHasScheduledMessages(data) + case TypeUpdateChatIsTranslatable: + return UnmarshalUpdateChatIsTranslatable(data) + + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(data) case TypeUpdateChatIsBlocked: return UnmarshalUpdateChatIsBlocked(data) - case TypeUpdateChatIsMarkedAsUnread: - return UnmarshalUpdateChatIsMarkedAsUnread(data) + case TypeUpdateChatHasScheduledMessages: + return UnmarshalUpdateChatHasScheduledMessages(data) case TypeUpdateChatFilters: return UnmarshalUpdateChatFilters(data) @@ -17797,6 +18330,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(data) + case TypeUpdateAutosaveSettings: + return UnmarshalUpdateAutosaveSettings(data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(data) diff --git a/data/td_api.tl b/data/td_api.tl index ce169f9..e842e85 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -50,6 +50,17 @@ authenticationCodeTypeMissedCall phone_number_prefix:string length:int32 = Authe //@length Length of the code authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType; +//@description An authentication code is delivered via Firebase Authentication to the official Android application +//@nonce Nonce to pass to the SafetyNet Attestation API +//@length Length of the code +authenticationCodeTypeFirebaseAndroid nonce:bytes length:int32 = AuthenticationCodeType; + +//@description An authentication code is delivered via Firebase Authentication to the official iOS application +//@receipt Receipt of successful applikation token validation to compare with receipt from push notification +//@push_timeout Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds +//@length Length of the code +authenticationCodeTypeFirebaseIos receipt:string push_timeout:int32 length:int32 = AuthenticationCodeType; + //@description Information about the authentication code that was sent //@phone_number A phone number that is being authenticated @@ -311,7 +322,8 @@ stickerFullTypeMask mask_position:maskPosition = StickerFullType; //@description The sticker is a custom emoji to be used inside message text and caption. Currently, only Telegram Premium users can use custom emoji //@custom_emoji_id Identifier of the custom emoji -//@needs_repainting True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, or another appropriate color in other places +//@needs_repainting True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, or another appropriate color in other places. +//-The sticker must not be repainted on chat photos stickerFullTypeCustomEmoji custom_emoji_id:int64 needs_repainting:Bool = StickerFullType; @@ -378,6 +390,7 @@ document file_name:string mime_type:string minithumbnail:minithumbnail thumbnail photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Photo; //@description Describes a sticker +//@id Unique sticker identifier within the set; 0 if none //@set_id The identifier of the sticker set to which the sticker belongs; 0 if none //@width Sticker width; as defined by the sender //@height Sticker height; as defined by the sender @@ -387,7 +400,7 @@ photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Ph //@outline Sticker's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner //@thumbnail Sticker thumbnail in WEBP or JPEG format; may be null //@sticker File containing the sticker -sticker set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat full_type:StickerFullType outline:vector thumbnail:thumbnail sticker:file = Sticker; +sticker id:int64 set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat full_type:StickerFullType outline:vector thumbnail:thumbnail sticker:file = Sticker; //@description Describes a video file //@duration Duration of the video, in seconds; as defined by the sender @@ -433,7 +446,7 @@ animatedEmoji sticker:sticker sticker_width:int32 sticker_height:int32 fitzpatri //@first_name First name of the user; 1-255 characters in length //@last_name Last name of the user //@vcard Additional data about the user in a form of vCard; 0-2048 bytes in length -//@user_id Identifier of the user, if known; otherwise 0 +//@user_id Identifier of the user, if known; 0 otherwise contact phone_number:string first_name:string last_name:string vcard:string user_id:int53 = Contact; //@description Describes a location on planet Earth @@ -528,6 +541,23 @@ botMenuButton text:string url:string = BotMenuButton; chatLocation location:location address:string = ChatLocation; +//@class ChatPhotoStickerType @description Describes type of a sticker, which was used to create a chat photo + +//@description Information about the sticker, which was used to create the chat photo +//@sticker_set_id Sticker set identifier +//@sticker_id Identifier of the sticker in the set +chatPhotoStickerTypeRegularOrMask sticker_set_id:int64 sticker_id:int64 = ChatPhotoStickerType; + +//@description Information about the custom emoji, which was used to create the chat photo +//@custom_emoji_id Identifier of the custom emoji +chatPhotoStickerTypeCustomEmoji custom_emoji_id:int64 = ChatPhotoStickerType; + + +//@description Information about the sticker, which was used to create the chat photo. The sticker is shown at the center of the photo and occupies at most 67% of it +//@type Type of the sticker +//@background_fill The fill to be used as background for the sticker; rotation angle in backgroundFillGradient isn't supported +chatPhotoSticker type:ChatPhotoStickerType background_fill:BackgroundFill = ChatPhotoSticker; + //@description Animated variant of a chat photo in MPEG4 format //@length Animation width and height //@file Information about the animation file @@ -540,9 +570,10 @@ animatedChatPhoto length:int32 file:file main_frame_timestamp:double = AnimatedC //@added_date Point in time (Unix timestamp) when the photo has been added //@minithumbnail Photo minithumbnail; may be null //@sizes Available variants of the photo in JPEG format, in different size -//@animation A big (640x640) animated variant of the photo in MPEG4 format; may be null +//@animation A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null //@small_animation A small (160x160) animated variant of the photo in MPEG4 format; may be null even the big animation is available -chatPhoto id:int64 added_date:int32 minithumbnail:minithumbnail sizes:vector animation:animatedChatPhoto small_animation:animatedChatPhoto = ChatPhoto; +//@sticker Sticker-based version of the chat photo; may be null +chatPhoto id:int64 added_date:int32 minithumbnail:minithumbnail sizes:vector animation:animatedChatPhoto small_animation:animatedChatPhoto sticker:chatPhotoSticker = ChatPhoto; //@description Contains a list of chat or user profile photos @total_count Total number of photos @photos List of photos chatPhotos total_count:int32 photos:vector = ChatPhotos; @@ -556,26 +587,34 @@ inputChatPhotoPrevious chat_photo_id:int64 = InputChatPhoto; //@description A static photo in JPEG format @photo Photo to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed inputChatPhotoStatic photo:InputFile = InputChatPhoto; -//@description An animation in MPEG4 format; must be square, at most 10 seconds long, have width between 160 and 800 and be at most 2MB in size +//@description An animation in MPEG4 format; must be square, at most 10 seconds long, have width between 160 and 1280 and be at most 2MB in size //@animation Animation to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed //@main_frame_timestamp Timestamp of the frame, which will be used as static chat photo inputChatPhotoAnimation animation:InputFile main_frame_timestamp:double = InputChatPhoto; +//@description A sticker on a custom background @sticker Information about the sticker +inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; + //@description Describes actions that a user is allowed to take in a chat -//@can_send_messages True, if the user can send text messages, contacts, locations, and venues -//@can_send_media_messages True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions -//@can_send_polls True, if the user can send polls. Implies can_send_messages permissions +//@can_send_messages True, if the user can send text messages, contacts, invoices, locations, and venues +//@can_send_audios True, if the user can send music files +//@can_send_documents True, if the user can send documents +//@can_send_photos True, if the user can send audio photos +//@can_send_videos True, if the user can send audio videos +//@can_send_video_notes True, if the user can send video notes +//@can_send_voice_notes True, if the user can send voice notes +//@can_send_polls True, if the user can send polls //@can_send_stickers True, if the user can send stickers. Implies can_send_messages permissions //@can_send_animations True, if the user can send animations. Implies can_send_messages permissions //@can_send_games True, if the user can send games. Implies can_send_messages permissions //@can_use_inline_bots True, if the user can use inline bots. Implies can_send_messages permissions -//@can_add_web_page_previews True, if the user may add a web page preview to their messages. Implies can_send_messages permissions +//@can_add_web_page_previews True, if the user may add a web page preview to their messages //@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_manage_topics True, if the user can manage topics -chatPermissions can_send_messages:Bool can_send_media_messages:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_manage_topics:Bool = ChatPermissions; +chatPermissions can_send_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_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_manage_topics:Bool = ChatPermissions; //@description Describes rights of the administrator //@can_manage_chat True, if the administrator can get chat event log, get chat statistics, get message statistics in channels, get channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only @@ -602,6 +641,13 @@ chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messa //@payment_link An internal link to be opened for buying Telegram Premium to the user if store payment isn't possible; may be null if direct payment isn't available premiumPaymentOption currency:string amount:int53 discount_percentage:int32 month_count:int32 store_product_id:string payment_link:InternalLinkType = PremiumPaymentOption; +//@description Describes an option for buying or upgrading Telegram Premium for self +//@payment_option Information about the payment option +//@is_current True, if this is the currently used Telegram Premium subscription option +//@is_upgrade True, if the payment option can be used to upgrade the existing Telegram Premium subscription +//@last_transaction_id Identifier of the last in-store transaction for the currently used option +premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is_upgrade:Bool last_transaction_id:string = PremiumStatePaymentOption; + //@description Describes a custom emoji to be shown instead of the Telegram Premium badge @custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format emojiStatus custom_emoji_id:int64 = EmojiStatus; @@ -654,9 +700,12 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use botInfo share_text:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights = BotInfo; //@description Contains full information about a user -//@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty, otherwise unknown. If non-null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos -//@photo User profile photo; may be null. If null and user.profile_photo is null, then the photo is empty, otherwise unknown. If non-null and personal_photo is null, then it is the same photo as in user.profile_photo and chat.photo -//@public_photo User profile photo visible if the main photo is hidden by privacy settings; may be null. If null and user.profile_photo is null, then the photo is empty, otherwise unknown. If non-null and both photo and personal_photo are null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos +//@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. +//-If non-null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos +//@photo User profile photo; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. +//-If non-null and personal_photo is null, then it is the same photo as in user.profile_photo and chat.photo +//@public_photo User profile photo visible if the main photo is hidden by privacy settings; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. +//-If non-null and both photo and personal_photo are null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos //@is_blocked True, if the user is blocked by the current user //@can_be_called True, if the user can be called //@supports_video_calls True, if a video call can be created with the user @@ -923,7 +972,7 @@ secretChatStateClosed = SecretChatState; //@id Secret chat identifier //@user_id Identifier of the chat partner //@state State of the secret chat -//@is_outbound True, if the chat was created by the current user; otherwise false +//@is_outbound True, if the chat was created by the current user; false otherwise //@key_hash Hash of the currently used key for comparison with the hash of the chat partner's key. This is a string of 36 little-endian bytes, which must be split into groups of 2 bits, each denoting a pixel of one of 4 colors FFFFFF, D5E6F3, 2D5775, and 2F99C9. //-The pixels must be used to make a 12x12 square image filled from left to right, top to bottom. Alternatively, the first 32 bytes of the hash can be converted to the hexadecimal format and printed as 32 2-digit hex numbers //@layer Secret chat layer; determines features supported by the chat partner's application. Nested text entities and underline and strikethrough entities are supported if the layer >= 101, @@ -1279,6 +1328,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@positions Positions of the chat in chat lists //@message_sender_id Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender //@has_protected_content True, if chat content can't be saved locally, forwarded, or copied +//@is_translatable True, if translation of all messages in the chat must be suggested to the user //@is_marked_as_unread True, if the chat is marked as unread //@is_blocked True, if the chat is blocked by the current user and private messages from the chat can't be received //@has_scheduled_messages True, if the chat has scheduled messages @@ -1301,7 +1351,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null //@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used -chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender has_protected_content:Bool is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats @total_count Approximate total number of chats found @chat_ids List of chat identifiers chats total_count:int32 chat_ids:vector = Chats; @@ -1368,6 +1418,27 @@ keyboardButtonTypeRequestLocation = KeyboardButtonType; //@description A button that allows the user to create and send a poll when pressed; available only in private chats @force_regular If true, only regular polls must be allowed to create @force_quiz If true, only polls in quiz mode must be allowed to create keyboardButtonTypeRequestPoll force_regular:Bool force_quiz:Bool = KeyboardButtonType; +//@description A button that requests a user to be shared by the current user; available only in private chats. Use the method shareUserWithBot to complete the request +//@id Unique button identifier +//@restrict_user_is_bot True, if the shared user must or must not be a bot +//@user_is_bot True, if the shared user must be a bot; otherwise, the shared user must no be a bot. Ignored if restrict_user_is_bot is false +//@restrict_user_is_premium True, if the shared user must or must not be a Telegram Premium user +//@user_is_premium True, if the shared user must be a Telegram Premium user; otherwise, the shared user must no be a Telegram Premium user. Ignored if restrict_user_is_premium is false +keyboardButtonTypeRequestUser id:int32 restrict_user_is_bot:Bool user_is_bot:Bool restrict_user_is_premium:Bool user_is_premium:Bool = KeyboardButtonType; + +//@description A button that requests a chat to be shared by the current user; available only in private chats. Use the method shareChatWithBot to complete the request +//@id Unique button identifier +//@chat_is_channel True, if the chat must be a channel; otherwise, a basic group or a supergroup chat is shared +//@restrict_chat_is_forum True, if the chat must or must not be a forum supergroup +//@chat_is_forum True, if the chat must be a forum supergroup; otherwise, the chat must not be a forum supergroup. Ignored if restrict_chat_is_forum is false +//@restrict_chat_has_username True, if the chat must or must not have a username +//@chat_has_username True, if the chat must have a username; otherwise, the chat must not have a username. Ignored if restrict_chat_has_username is false +//@chat_is_created True, if the chat must be created by the current user +//@user_administrator_rights Expected user administrator rights in the chat; may be null if they aren't restricted +//@bot_administrator_rights Expected bot administrator rights in the chat; may be null if they aren't restricted +//@bot_is_member True, if the bot must be a member of the chat; for basic group and supergroup chats only +keyboardButtonTypeRequestChat id:int32 chat_is_channel:Bool restrict_chat_is_forum:Bool chat_is_forum:Bool restrict_chat_has_username:Bool chat_has_username:Bool chat_is_created:Bool user_administrator_rights:chatAdministratorRights bot_administrator_rights:chatAdministratorRights bot_is_member:Bool = KeyboardButtonType; + //@description A button that opens a Web App by calling getWebAppUrl @url An HTTP URL to pass to getWebAppUrl keyboardButtonTypeWebApp url:string = KeyboardButtonType; @@ -1423,7 +1494,7 @@ replyMarkupForceReply is_personal:Bool input_field_placeholder:string = ReplyMar //@description Contains a custom keyboard layout to quickly reply to bots //@rows A list of rows of bot keyboard buttons -//@is_persistent True, if the keyboard is supposed to be always shown when the ordinary keyboard is hidden +//@is_persistent True, if the keyboard is supposed to always be shown when the ordinary keyboard is hidden //@resize_keyboard True, if the application needs to resize the keyboard vertically //@one_time True, if the application needs to hide the keyboard after use //@is_personal True, if the keyboard must automatically be shown to the current user. For outgoing messages, specify true to show the keyboard only for the mentioned users and for the target user of a reply @@ -1437,7 +1508,7 @@ replyMarkupInlineKeyboard rows:vector> = ReplyMarku //@class LoginUrlInfo @description Contains information about an inline button of type inlineKeyboardButtonTypeLoginUrl -//@description An HTTP url needs to be open @url The URL to open @skip_confirm True, if there is no need to show an ordinary open URL confirm +//@description An HTTP URL needs to be open @url The URL to open @skip_confirm True, if there is no need to show an ordinary open URL confirm loginUrlInfoOpen url:string skip_confirm:Bool = LoginUrlInfo; //@description An authorization confirmation dialog needs to be shown to the user @@ -1916,10 +1987,10 @@ paymentOption title:string url:string = PaymentOption; //@product_photo Product photo; may be null paymentForm id:int64 invoice:invoice seller_bot_user_id:int53 payment_provider_user_id:int53 payment_provider:PaymentProvider additional_payment_options:vector saved_order_info:orderInfo saved_credentials:vector can_save_credentials:Bool need_password:Bool product_title:string product_description:formattedText product_photo:photo = PaymentForm; -//@description Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options @order_info_id Temporary identifier of the order information @shipping_options Available shipping options +//@description Contains a temporary identifier of validated order information, which is stored for one hour, and the available shipping options @order_info_id Temporary identifier of the order information @shipping_options Available shipping options validatedOrderInfo order_info_id:string shipping_options:vector = ValidatedOrderInfo; -//@description Contains the result of a payment request @success True, if the payment request was successful; otherwise the verification_url will be non-empty @verification_url URL for additional payment credentials verification +//@description Contains the result of a payment request @success True, if the payment request was successful; otherwise, the verification_url will be non-empty @verification_url URL for additional payment credentials verification paymentResult success:Bool verification_url:string = PaymentResult; //@description Contains information about a successful payment @@ -2392,7 +2463,7 @@ messagePinMessage message_id:int53 = MessageContent; //@description A screenshot of a message in the chat has been taken messageScreenshotTaken = MessageContent; -//@description A theme in the chat has been changed @theme_name If non-empty, name of a new theme, set for the chat. Otherwise chat theme was reset to the default one +//@description A theme in the chat has been changed @theme_name If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset to the default one messageChatSetTheme theme_name:string = MessageContent; //@description The auto-delete or self-destruct timer for messages in the chat has been changed @message_auto_delete_time New value auto-delete or self-destruct time, in seconds; 0 if disabled @from_user_id If not 0, a user identifier, which default setting was automatically applied @@ -2407,10 +2478,10 @@ messageForumTopicCreated name:string icon:forumTopicIcon = MessageContent; //@icon_custom_emoji_id New unique identifier of the custom emoji shown on the topic icon; 0 if none. Must be ignored if edit_icon_custom_emoji_id is false messageForumTopicEdited name:string edit_icon_custom_emoji_id:Bool icon_custom_emoji_id:int64 = MessageContent; -//@description A forum topic has been closed or opened @is_closed True, if the topic was closed, otherwise the topic was reopened +//@description A forum topic has been closed or opened @is_closed True, if the topic was closed; otherwise, the topic was reopened messageForumTopicIsClosedToggled is_closed:Bool = MessageContent; -//@description A General forum topic has been hidden or unhidden @is_hidden True, if the topic was hidden, otherwise the topic was unhidden +//@description A General forum topic has been hidden or unhidden @is_hidden True, if the topic was hidden; otherwise, the topic was unhidden messageForumTopicIsHiddenToggled is_hidden:Bool = MessageContent; //@description A profile photo was suggested to a user in a private chat @photo The suggested chat photo. Use the method setProfilePhoto with inputChatPhotoPrevious to apply the photo @@ -2454,6 +2525,12 @@ messageGiftedPremium currency:string amount:int53 month_count:int32 sticker:stic //@description A contact has registered with Telegram messageContactRegistered = MessageContent; +//@description The current user shared a user, which was requested by the bot @user_id Identifier of the shared user @button_id Identifier of the keyboard button with the request +messageUserShared user_id:int53 button_id:int32 = MessageContent; + +//@description The current user shared a chat, which was requested by the bot @chat_id Identifier of the shared chat @button_id Identifier of the keyboard button with the request +messageChatShared chat_id:int53 button_id:int32 = MessageContent; + //@description The current user has connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website messageWebsiteConnected domain_name:string = MessageContent; @@ -2874,6 +2951,28 @@ stickerSets total_count:int32 sets:vector = StickerSets; trendingStickerSets total_count:int32 sets:vector is_premium:Bool = TrendingStickerSets; +//@description Contains a list of similar emoji to search for in getStickers and searchStickers +//@name Name of the category +//@icon_custom_emoji_id Unique identifier of the custom emoji, which represents icon of the category +//@emojis List of emojis in the category +emojiCategory name:string icon_custom_emoji_id:int64 emojis:vector = EmojiCategory; + +//@description Represents a list of emoji categories @categories List of categories +emojiCategories categories:vector = EmojiCategories; + + +//@class EmojiCategoryType @description Describes type of an emoji category + +//@description The category must be used by default +emojiCategoryTypeDefault = EmojiCategoryType; + +//@description The category must be used for emoji status selection +emojiCategoryTypeEmojiStatus = EmojiCategoryType; + +//@description The category must be used for chat photo emoji selection +emojiCategoryTypeChatPhoto = EmojiCategoryType; + + //@class CallDiscardReason @description Describes the reason why a call was discarded //@description The call wasn't discarded, or the reason is unknown @@ -2982,7 +3081,7 @@ groupCallStream channel_id:int32 scale:int32 time_offset:int53 = GroupCallStream //@description Represents a list of group call streams @streams A list of group call streams groupCallStreams streams:vector = GroupCallStreams; -//@description Represents an RTMP url @url The URL @stream_key Stream key +//@description Represents an RTMP URL @url The URL @stream_key Stream key rtmpUrl url:string stream_key:string = RtmpUrl; @@ -3083,13 +3182,23 @@ callProblemPixelatedVideo = CallProblem; call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState = Call; +//@class FirebaseAuthenticationSettings @description Contains settings for Firebase Authentication in the official applications + +//@description Settings for Firebase Authentication in the official Android application +firebaseAuthenticationSettingsAndroid = FirebaseAuthenticationSettings; + +//@description Settings for Firebase Authentication in the official iOS application @device_token Device token from Apple Push Notification service @is_app_sandbox True, if App Sandbox is enabled +firebaseAuthenticationSettingsIos device_token:string is_app_sandbox:Bool = FirebaseAuthenticationSettings; + + //@description Contains settings for the authentication of the user's phone number //@allow_flash_call Pass true if the authentication code may be sent via a flash call to the specified phone number //@allow_missed_call Pass true if the authentication code may be sent via a missed call to the specified phone number //@is_current_phone_number Pass true if the authenticated phone number is used on the current device //@allow_sms_retriever_api For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details +//@firebase_authentication_settings For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication //@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions -phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool authentication_tokens:vector = PhoneNumberAuthenticationSettings; +phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool firebase_authentication_settings:FirebaseAuthenticationSettings authentication_tokens:vector = PhoneNumberAuthenticationSettings; //@description Represents a reaction applied to a message @type Type of the reaction @sender_id Identifier of the chat member, applied the reaction @@ -3726,6 +3835,9 @@ premiumFeatureForumTopicIcon = PremiumFeature; //@description Allowed to set a premium appllication icons premiumFeatureAppIcons = PremiumFeature; +//@description Allowed to translate chat messages real-time +premiumFeatureRealTimeChatTranslation = PremiumFeature; + //@description Contains information about a limit, increased for Premium users @type The type of the limit @default_value Default value of the limit @premium_value Value of the limit for Premium users premiumLimit type:PremiumLimitType default_value:int32 premium_value:int32 = PremiumLimit; @@ -3759,19 +3871,20 @@ premiumFeaturePromotionAnimation feature:PremiumFeature animation:animation = Pr //@state Text description of the state of the current Premium subscription; may be empty if the current user has no Telegram Premium subscription //@payment_options The list of available options for buying Telegram Premium //@animations The list of available promotion animations for Premium features -premiumState state:formattedText payment_options:vector animations:vector = PremiumState; +premiumState state:formattedText payment_options:vector animations:vector = PremiumState; //@class StorePaymentPurpose @description Describes a purpose of an in-store payment -//@description The user subscribed to Telegram Premium @is_restore Pass true if this is a restore of a Telegram Premium purchase; only for App Store -storePaymentPurposePremiumSubscription is_restore:Bool = StorePaymentPurpose; +//@description The user subscribed to Telegram Premium @is_restore Pass true if this is a restore of a Telegram Premium purchase; only for App Store @is_upgrade Pass true if this is an upgrade from a monthly subscription to early subscription; only for App Store +storePaymentPurposePremiumSubscription is_restore:Bool is_upgrade:Bool = StorePaymentPurpose; //@description The user gifted Telegram Premium to another user @user_id Identifier of the user for which Premium was gifted @currency ISO 4217 currency code of the payment currency @amount Paid amount, in the smallest units of the currency storePaymentPurposeGiftedPremium user_id:int53 currency:string amount:int53 = StorePaymentPurpose; -//@class DeviceToken @description Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org +//@class DeviceToken @description Represents a data needed to subscribe for push notifications through registerDevice method. +//-To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org //@description A token for Firebase Cloud Messaging @token Device registration token; may be empty to deregister a device @encrypt True, if push notifications must be additionally encrypted deviceTokenFirebaseCloudMessaging token:string encrypt:Bool = DeviceToken; @@ -3809,6 +3922,9 @@ deviceTokenBlackBerryPush token:string = DeviceToken; //@description A token for Tizen Push Service @reg_id Push service registration identifier; may be empty to deregister a device deviceTokenTizenPush reg_id:string = DeviceToken; +//@description A token for HUAWEI Push Service @token Device registration token; may be empty to deregister a device @encrypt True, if push notifications must be additionally encrypted +deviceTokenHuaweiPush token:string encrypt:Bool = DeviceToken; + //@description Contains a globally unique push receiver identifier, which can be used to identify which account has received a push notification @id The globally unique identifier of push notification subscription pushReceiverId id:int64 = PushReceiverId; @@ -4047,7 +4163,7 @@ pushMessageContentChatChangePhoto = PushMessageContent; //@description A chat title was edited @title New chat title pushMessageContentChatChangeTitle title:string = PushMessageContent; -//@description A chat theme was edited @theme_name If non-empty, name of a new theme, set for the chat. Otherwise chat theme was reset to the default one +//@description A chat theme was edited @theme_name If non-empty, name of a new theme, set for the chat. Otherwise, the chat theme was reset to the default one pushMessageContentChatSetTheme theme_name:string = PushMessageContent; //@description A chat member was deleted @@ -4400,7 +4516,7 @@ targetChatInternalLink link:InternalLinkType = TargetChat; internalLinkTypeActiveSessions = InternalLinkType; //@description The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. -//-Then call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then use getAttachmentMenuBot to receive information about the bot. +//-Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. //-If the bot isn't added to attachment menu, then user needs to confirm adding the bot to attachment menu. If user confirms adding, then use toggleBotIsAddedToAttachmentMenu to add it. //-If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL //@target_chat Target chat to be opened @@ -4426,15 +4542,15 @@ internalLinkTypeBotStart bot_username:string start_parameter:string autostart:Bo //-If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, //-check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, //-and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. -//-Then if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat, otherwise just send /start message with bot's username added to the chat. +//-Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat. //@bot_username Username of the bot //@start_parameter The parameter to be passed to sendBotStartMessage //@administrator_rights Expected administrator rights for the bot; may be null internalLinkTypeBotStartInGroup bot_username:string start_parameter:string administrator_rights:chatAdministratorRights = InternalLinkType; //@description The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, -//-ask the current user to select a channel chat to add the bot to as an administrator. Then call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, -//-check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights +//-ask the current user to select a channel chat to add the bot to as an administrator. Then, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, +//-check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights //@bot_username Username of the bot //@administrator_rights Expected administrator rights for the bot internalLinkTypeBotAddToChannel bot_username:string administrator_rights:chatAdministratorRights = InternalLinkType; @@ -4479,12 +4595,13 @@ internalLinkTypeMessage url:string = InternalLinkType; //@contains_link True, if the first line of the text contains a link. If true, the input field needs to be focused and the text after the link must be selected internalLinkTypeMessageDraft text:formattedText contains_link:Bool = InternalLinkType; -//@description The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application, otherwise ignore it +//@description The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it //@bot_user_id User identifier of the service's bot //@scope Telegram Passport element types requested by the service //@public_key Service's public key //@nonce Unique request identifier provided by the service -//@callback_url An HTTP URL to open once the request is finished or canceled with the parameter tg_passport=success or tg_passport=cancel respectively. If empty, then the link tgbot{bot_user_id}://passport/success or tgbot{bot_user_id}://passport/cancel needs to be opened instead +//@callback_url An HTTP URL to open once the request is finished, canceled, or failed with the parameters tg_passport=success, tg_passport=cancel, or tg_passport=error&error=... respectively. +//-If empty, then onActivityResult method must be used to return response on Android, or the link tgbot{bot_user_id}://passport/success or tgbot{bot_user_id}://passport/cancel must be opened otherwise internalLinkTypePassportDataRequest bot_user_id:int53 scope:string public_key:string nonce:string callback_url:string = InternalLinkType; //@description The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberConfirmationCode with the given hash and phone number to process the link @@ -4706,6 +4823,40 @@ autoDownloadSettings is_auto_download_enabled:Bool max_photo_file_size:int32 max autoDownloadSettingsPresets low:autoDownloadSettings medium:autoDownloadSettings high:autoDownloadSettings = AutoDownloadSettingsPresets; +//@class AutosaveSettingsScope @description Describes scope of autosave settings + +//@description Autosave settings applied to all private chats without chat-specific settings +autosaveSettingsScopePrivateChats = AutosaveSettingsScope; + +//@description Autosave settings applied to all basic group and supergroup chats without chat-specific settings +autosaveSettingsScopeGroupChats = AutosaveSettingsScope; + +//@description Autosave settings applied to all channel chats without chat-specific settings +autosaveSettingsScopeChannelChats = AutosaveSettingsScope; + +//@description Autosave settings applied to a chat @chat_id Chat identifier +autosaveSettingsScopeChat chat_id:int53 = AutosaveSettingsScope; + + +//@description Contains autosave settings for an autosave settings scope +//@autosave_photos True, if photo autosave is enabled +//@autosave_videos True, if video autosave is enabled +//@max_video_file_size The maximum size of a video file to be autosaved, in bytes; 512 KB - 4000 MB +scopeAutosaveSettings autosave_photos:Bool autosave_videos:Bool max_video_file_size:int53 = ScopeAutosaveSettings; + +//@description Contains autosave settings for a chat, which overrides default settings for the corresponding scope +//@chat_id Chat identifier +//@settings Autosave settings for the chat +autosaveSettingsException chat_id:int53 settings:scopeAutosaveSettings = AutosaveSettingsException; + +//@description Describes autosave settings +//@private_chat_settings Default autosave settings for private chats +//@group_settings Default autosave settings for basic group and supergroup chats +//@channel_settings Default autosave settings for channel chats +//@exceptions Autosave settings for specific chats +autosaveSettings private_chat_settings:scopeAutosaveSettings group_settings:scopeAutosaveSettings channel_settings:scopeAutosaveSettings exceptions:vector = AutosaveSettings; + + //@class ConnectionState @description Describes the current state of the connection to Telegram servers //@description Currently waiting for the network to become available. Use setNetworkType to change the available network type @@ -4786,9 +4937,16 @@ suggestedActionViewChecksHint = SuggestedAction; //@description Suggests the user to convert specified supergroup to a broadcast group @supergroup_id Supergroup identifier suggestedActionConvertToBroadcastGroup supergroup_id:int53 = SuggestedAction; -//@description Suggests the user to set a 2-step verification password to be able to log in again @authorization_delay The number of days to pass between consecutive authorizations if the user declines to set password +//@description Suggests the user to set a 2-step verification password to be able to log in again +//@authorization_delay The number of days to pass between consecutive authorizations if the user declines to set password; if 0, then the user is advised to set the password for security reasons suggestedActionSetPassword authorization_delay:int32 = SuggestedAction; +//@description Suggests the user to upgrade the Premium subscription from monthly payments to annual payments +suggestedActionUpgradePremium = SuggestedAction; + +//@description Suggests the user to subscribe to the Premium subscription with annual payments +suggestedActionSubscribeToAnnualPremium = SuggestedAction; + //@description Contains a counter @count Count count count:int32 = Count; @@ -5053,7 +5211,7 @@ updateChatPermissions chat_id:int53 permissions:chatPermissions = Update; //@positions The new chat positions in the chat lists updateChatLastMessage chat_id:int53 last_message:message positions:vector = Update; -//@description The position of a chat in a chat list has changed. Instead of this update updateChatLastMessage or updateChatDraftMessage might be sent +//@description The position of a chat in a chat list has changed. An updateChatLastMessage or updateChatDraftMessage update might be sent instead of the update //@chat_id Chat identifier //@position New chat position. If new order is 0, then the chat needs to be removed from the list updateChatPosition chat_id:int53 position:chatPosition = Update; @@ -5111,14 +5269,17 @@ updateChatDefaultDisableNotification chat_id:int53 default_disable_notification: //@description A chat content was allowed or restricted for saving @chat_id Chat identifier @has_protected_content New value of has_protected_content updateChatHasProtectedContent chat_id:int53 has_protected_content:Bool = Update; -//@description A chat's has_scheduled_messages field has changed @chat_id Chat identifier @has_scheduled_messages New value of has_scheduled_messages -updateChatHasScheduledMessages chat_id:int53 has_scheduled_messages:Bool = Update; +//@description Translation of chat messages was enabled or disabled @chat_id Chat identifier @is_translatable New value of is_translatable +updateChatIsTranslatable chat_id:int53 is_translatable:Bool = Update; + +//@description A chat was marked as unread or was read @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread +updateChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Update; //@description A chat was blocked or unblocked @chat_id Chat identifier @is_blocked New value of is_blocked updateChatIsBlocked chat_id:int53 is_blocked:Bool = Update; -//@description A chat was marked as unread or was read @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread -updateChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Update; +//@description A chat's has_scheduled_messages field has changed @chat_id Chat identifier @has_scheduled_messages New value of has_scheduled_messages +updateChatHasScheduledMessages chat_id:int53 has_scheduled_messages:Bool = Update; //@description The list of chat filters or a chat filter has changed @chat_filters The new list of chat filters @main_chat_list_position Position of the main chat list among chat filters, 0-based updateChatFilters chat_filters:vector main_chat_list_position:int32 = Update; @@ -5276,7 +5437,7 @@ updateInstalledStickerSets sticker_type:StickerType sticker_set_ids:vector = Update; //@description The list of favorite stickers was updated @sticker_ids The new list of file identifiers of favorite stickers @@ -5333,6 +5494,9 @@ updateAnimationSearchParameters provider:string emojis:vector = Update; //@description The list of suggested to the user actions has changed @added_actions Added suggested actions @removed_actions Removed suggested actions updateSuggestedActions added_actions:vector removed_actions:vector = Update; +//@description Autosave settings for some type of chats were updated @scope Type of chats for which autosave settings were updated @settings The new autosave settings; may be null if the settings are reset to default +updateAutosaveSettings scope:AutosaveSettingsScope settings:scopeAutosaveSettings = Update; + //@description A new incoming inline query; for bots only //@id Unique query identifier //@sender_user_id Identifier of the user who sent the query @@ -5405,8 +5569,12 @@ updatePollAnswer poll_id:int64 user_id:int53 option_ids:vector = Update; //@new_chat_member New chat member updateChatMember chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink old_chat_member:chatMember new_chat_member:chatMember = Update; -//@description A user sent a join request to a chat; for bots only @chat_id Chat identifier @request Join request @invite_link The invite link, which was used to send join request; may be null -updateNewChatJoinRequest chat_id:int53 request:chatJoinRequest invite_link:chatInviteLink = Update; +//@description A user sent a join request to a chat; for bots only +//@chat_id Chat identifier +//@request Join request +//@user_chat_id Chat identifier of the private chat with the user +//@invite_link The invite link, which was used to send join request; may be null +updateNewChatJoinRequest chat_id:int53 request:chatJoinRequest user_chat_id:int53 invite_link:chatInviteLink = Update; //@description Contains a list of updates @updates List of updates @@ -5464,7 +5632,7 @@ getAuthorizationState = AuthorizationState; //@use_test_dc Pass true to use Telegram test environment instead of the production environment //@database_directory The path to the directory for the persistent database; if empty, the current working directory will be used //@files_directory The path to the directory for storing files; if empty, database_directory will be used -//@database_encryption_key Encryption key for the database +//@database_encryption_key Encryption key for the database. If the encryption key is invalid, then an error with code 401 will be returned //@use_file_database Pass true to keep information about downloaded and uploaded files between application restarts //@use_chat_info_database Pass true to keep cache of users, basic groups, supergroups, channels and secret chats between restarts. Implies use_file_database //@use_message_database Pass true to keep cache of chats and messages between restarts. Implies use_chat_info_database @@ -5480,7 +5648,7 @@ getAuthorizationState = AuthorizationState; setTdlibParameters use_test_dc:Bool database_directory:string files_directory:string database_encryption_key:bytes use_file_database:Bool use_chat_info_database:Bool use_message_database:Bool use_secret_chats:Bool api_id:int32 api_hash:string system_language_code:string device_model:string system_version:string application_version:string enable_storage_optimizer:Bool ignore_file_names:Bool = Ok; //@description Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, -//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword //@phone_number The phone number of the user, in international format //@settings Settings for the authentication of the user's phone number; pass null to use default settings setAuthenticationPhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = Ok; @@ -5499,7 +5667,7 @@ checkAuthenticationEmailCode code:EmailAddressAuthentication = Ok; checkAuthenticationCode code:string = Ok; //@description Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, -//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword //@other_user_ids List of user identifiers of other users currently using the application requestQrCodeAuthentication other_user_ids:vector = Ok; @@ -5523,6 +5691,10 @@ checkAuthenticationPasswordRecoveryCode recovery_code:string = Ok; //@new_hint New password hint; may be empty recoverAuthenticationPassword recovery_code:string new_password:string new_hint:string = Ok; +//@description Sends Firebase Authentication SMS to the phone number of the user. Works only when the current authorization state is authorizationStateWaitCode and the server returned code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos +//@token SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application +sendAuthenticationFirebaseSms token:string = Ok; + //@description Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in @token The bot token checkAuthenticationBotToken token:string = Ok; @@ -5644,7 +5816,7 @@ getMessage chat_id:int53 message_id:int53 = Message; //@description Returns information about a message, if it is available without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get getMessageLocally chat_id:int53 message_id:int53 = Message; -//@description Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, the invoice message, and the topic creation message for messages +//@description Returns information about a message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, and the topic creation message for messages //-of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, and topic messages without replied message respectively //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message @@ -5686,7 +5858,7 @@ loadChats chat_list:ChatList limit:int32 = Ok; //@limit The maximum number of chats to be returned getChats chat_list:ChatList limit:int32 = Chats; -//@description Searches a public chat by its username. Currently, only private chats, supergroups and channels can be public. Returns the chat if found; otherwise an error is returned @username Username to be resolved +//@description Searches a public chat by its username. Currently, only private chats, supergroups and channels can be public. Returns the chat if found; otherwise, an error is returned @username Username to be resolved searchPublicChat username:string = Chat; //@description Searches public chats by looking for specified query in their username and title. Currently, only private chats, supergroups and channels can be public. Returns a meaningful number of results. @@ -5775,7 +5947,9 @@ getMessageThreadHistory chat_id:int53 message_id:int53 from_message_id:int53 off //@revoke Pass true to delete chat history for all users deleteChatHistory chat_id:int53 remove_from_chat_list:Bool revoke:Bool = Ok; -//@description Deletes a chat along with all messages in the corresponding chat for all chat members. For group chats this will release the usernames and remove all members. Use the field chat.can_be_deleted_for_all_users to find whether the method can be applied to the chat @chat_id Chat identifier +//@description Deletes a chat along with all messages in the corresponding chat for all chat members. For group chats this will release the usernames and remove all members. +//-Use the field chat.can_be_deleted_for_all_users to find whether the method can be applied to the chat +//@chat_id Chat identifier deleteChat chat_id:int53 = Ok; //@description Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query @@ -5900,11 +6074,24 @@ getMessageEmbeddingCode chat_id:int53 message_id:int53 for_album:Bool = Text; getMessageLinkInfo url:string = MessageLinkInfo; -//@description Translates a text to the given language. Returns a 404 error if the translation can't be performed +//@description Translates a text to the given language. If the current user is a Telegram Premium user, then text formatting is preserved //@text Text to translate -//@from_language_code A two-letter ISO 639-1 language code of the language from which the message is translated. If empty, the language will be detected automatically -//@to_language_code A two-letter ISO 639-1 language code of the language to which the message is translated -translateText text:string from_language_code:string to_language_code:string = Text; +//@to_language_code ISO language code of the language to which the message is translated. Must be one of +//-"af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", +//-"fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", +//-"ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", +//-"st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu" +translateText text:formattedText to_language_code:string = FormattedText; + +//@description Extracts text or caption of the given message and translates it to the given language. If the current user is a Telegram Premium user, then text formatting is preserved +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +//@to_language_code ISO language code of the language to which the message is translated. Must be one of +//-"af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", +//-"fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", +//-"ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", +//-"st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu" +translateMessageText chat_id:int53 message_id:int53 to_language_code:string = FormattedText; //@description Recognizes speech in a video note or a voice note message. The message must be successfully sent and must not be scheduled. May return an error with a message "MSG_VOICE_TOO_LONG" if media duration is too big to be recognized //@chat_id Identifier of the chat to which the message belongs @@ -6256,6 +6443,25 @@ getLoginUrlInfo chat_id:int53 message_id:int53 button_id:int53 = LoginUrlInfo; getLoginUrl chat_id:int53 message_id:int53 button_id:int53 allow_write_access:Bool = HttpUrl; +//@description Shares a user after pressing a keyboardButtonTypeRequestUser button with the bot +//@chat_id Identifier of the chat with the bot +//@message_id Identifier of the message with the button +//@button_id Identifier of the button +//@shared_user_id Identifier of the shared user +//@only_check Pass true to check that the user can be shared by the button instead of actually sharing them +shareUserWithBot chat_id:int53 message_id:int53 button_id:int32 shared_user_id:int53 only_check:Bool = Ok; + +//@description Shares a chat after pressing a keyboardButtonTypeRequestChat button with the bot +//@chat_id Identifier of the chat with the bot +//@message_id Identifier of the message with the button +//@button_id Identifier of the button +//@shared_chat_id Identifier of the shared chat +//@only_check Pass true to check that the chat can be shared by the button instead of actually sharing it. Doesn't check bot_is_member and bot_administrator_rights restrictions. +//-If the bot must be a member, then all chats from getGroupsInCommon and all chats, where the user can add the bot, are suitable. In the latter case the bot will be automatically added to the chat. +//-If the bot must be an administrator, then all chats, where the bot already has requested rights or can be added to administrators by the user, are suitable. In the latter case the bot will be automatically granted requested rights +shareChatWithBot chat_id:int53 message_id:int53 button_id:int32 shared_chat_id:int53 only_check:Bool = Ok; + + //@description Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires //@bot_user_id The identifier of the target bot //@chat_id Identifier of the chat where the query was sent @@ -6432,12 +6638,13 @@ createNewBasicGroupChat user_ids:vector title:string message_auto_delete_ //@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat //@title Title of the new chat; 1-128 characters -//@is_channel Pass true to create a channel chat +//@is_forum Pass true to create a forum supergroup chat +//@is_channel Pass true to create a channel chat; ignored if a forum is created //@param_description Chat description; 0-255 characters //@location Chat location if a location-based supergroup is being created; pass null to create an ordinary supergroup chat //@message_auto_delete_time Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically //@for_import Pass true to create a supergroup for importing messages using importMessage -createNewSupergroupChat title:string is_channel:Bool description:string location:chatLocation message_auto_delete_time:int32 for_import:Bool = Chat; +createNewSupergroupChat title:string is_forum:Bool is_channel:Bool description:string location:chatLocation message_auto_delete_time:int32 for_import:Bool = Chat; //@description Creates a new secret chat. Returns the newly created chat @user_id Identifier of the target user createNewSecretChat user_id:int53 = Chat; @@ -6513,6 +6720,9 @@ setChatNotificationSettings chat_id:int53 notification_settings:chatNotification //@has_protected_content New value of has_protected_content toggleChatHasProtectedContent chat_id:int53 has_protected_content:Bool = Ok; +//@description Changes the tranlatable state of a chat; for Telegram Premium users only @chat_id Chat identifier @is_translatable New value of is_translatable +toggleChatIsTranslatable chat_id:int53 is_translatable:Bool = Ok; + //@description Changes the marked as unread state of a chat @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread toggleChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Ok; @@ -7090,15 +7300,18 @@ sharePhoneNumber user_id:int53 = Ok; getUserProfilePhotos user_id:int53 offset:int32 limit:int32 = ChatPhotos; -//@description Returns stickers from the installed sticker sets that correspond to a given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned +//@description Returns stickers from the installed sticker sets that correspond to any of the given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned //@sticker_type Type of the stickers to return -//@query Search query; an emoji or a keyword prefix. If empty, returns all known installed stickers +//@query Search query; a space-separated list of emoji or a keyword prefix. If empty, returns all known installed stickers //@limit The maximum number of stickers to be returned //@chat_id Chat identifier for which to return stickers. Available custom emoji stickers may be different for different chats getStickers sticker_type:StickerType query:string limit:int32 chat_id:int53 = Stickers; -//@description Searches for stickers from public sticker sets that correspond to a given emoji @emoji String representation of emoji; must be non-empty @limit The maximum number of stickers to be returned; 0-100 -searchStickers emoji:string limit:int32 = Stickers; +//@description Searches for stickers from public sticker sets that correspond to any of the given emoji +//@sticker_type Type of the stickers to return +//@emojis Space-separated list of emoji to search for; must be non-empty +//@limit The maximum number of stickers to be returned; 0-100 +searchStickers sticker_type:StickerType emojis:string limit:int32 = Stickers; //@description Returns premium stickers from regular sticker sets @limit The maximum number of stickers to be returned; 0-100 getPremiumStickers limit:int32 = Stickers; @@ -7174,6 +7387,9 @@ getStickerEmojis sticker:InputFile = Emojis; //@input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown searchEmojis text:string exact_match:Bool input_language_codes:vector = Emojis; +//@description Returns available emojis categories @type Type of emoji categories to return; pass null to get default emoji categories +getEmojiCategories type:EmojiCategoryType = EmojiCategories; + //@description Returns an animated emoji corresponding to a given emoji. Returns a 404 error if the emoji has no animated emoji @emoji The emoji getAnimatedEmoji emoji:string = AnimatedEmoji; @@ -7183,6 +7399,12 @@ getEmojiSuggestionsUrl language_code:string = HttpUrl; //@description Returns list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned @custom_emoji_ids Identifiers of custom emoji stickers. At most 200 custom emoji stickers can be received simultaneously getCustomEmojiStickers custom_emoji_ids:vector = Stickers; +//@description Returns default list of custom emoji stickers for placing on a chat photo +getDefaultChatPhotoCustomEmojiStickers = Stickers; + +//@description Returns default list of custom emoji stickers for placing on a profile photo +getDefaultProfilePhotoCustomEmojiStickers = Stickers; + //@description Returns saved animations getSavedAnimations = Animations; @@ -7213,7 +7435,9 @@ getWebPagePreview text:formattedText = WebPage; getWebPageInstantView url:string force_full:Bool = WebPageInstantView; -//@description Changes a profile photo for the current user @photo Profile photo to set @is_public Pass true to set a public photo, which will be visible even the main photo is hidden by privacy settings +//@description Changes a profile photo for the current user +//@photo Profile photo to set +//@is_public Pass true to set a public photo, which will be visible even the main photo is hidden by privacy settings setProfilePhoto photo:InputChatPhoto is_public:Bool = Ok; //@description Deletes a profile photo @profile_photo_id Identifier of the profile photo to delete @@ -7275,7 +7499,7 @@ setCommands scope:BotCommandScope language_code:string commands:vector