diff --git a/client/function.go b/client/function.go index 94f57d8..1f79ee4 100755 --- a/client/function.go +++ b/client/function.go @@ -1440,7 +1440,7 @@ type GetMessageViewersRequest struct { } // Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if message.can_get_viewers == true -func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*Users, error) { +func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*MessageViewers, error) { result, err := client.Send(Request{ meta: meta{ Type: "getMessageViewers", @@ -1458,7 +1458,7 @@ func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*Users, return nil, buildResponseError(result.Data) } - return UnmarshalUsers(result.Data) + return UnmarshalMessageViewers(result.Data) } type GetFileRequest struct { @@ -2842,7 +2842,7 @@ func (client *Client) GetMessageLinkInfo(req *GetMessageLinkInfoRequest) (*Messa type TranslateTextRequest struct { // Text to translate 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" + // 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"` } @@ -2873,7 +2873,7 @@ type TranslateMessageTextRequest struct { 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" + // 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"` } @@ -5104,16 +5104,14 @@ type AnswerInlineQueryRequest struct { InlineQueryId JsonInt64 `json:"inline_query_id"` // Pass true if results may be cached and returned only for the user that sent the query. By default, results may be returned to any user who sends the same query IsPersonal bool `json:"is_personal"` + // Button to be shown above inline query results; pass null if none + Button *InlineQueryResultsButton `json:"button"` // The results of the query Results []InputInlineQueryResult `json:"results"` // Allowed time to cache the results of the query, in seconds CacheTime int32 `json:"cache_time"` // Offset for the next inline query; pass an empty string if there are no more results NextOffset string `json:"next_offset"` - // If non-empty, this text must be shown on the button that opens a private chat with the bot and sends a start message to the bot with the parameter switch_pm_parameter - SwitchPmText string `json:"switch_pm_text"` - // The parameter for the bot start message - SwitchPmParameter string `json:"switch_pm_parameter"` } // Sets the result of an inline query; for bots only @@ -5123,13 +5121,12 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err Type: "answerInlineQuery", }, Data: map[string]interface{}{ - "inline_query_id": req.InlineQueryId, - "is_personal": req.IsPersonal, - "results": req.Results, - "cache_time": req.CacheTime, - "next_offset": req.NextOffset, - "switch_pm_text": req.SwitchPmText, - "switch_pm_parameter": req.SwitchPmParameter, + "inline_query_id": req.InlineQueryId, + "is_personal": req.IsPersonal, + "button": req.Button, + "results": req.Results, + "cache_time": req.CacheTime, + "next_offset": req.NextOffset, }, }) if err != nil { @@ -5143,10 +5140,83 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err return UnmarshalOk(result.Data) } +type SearchWebAppRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // Short name of the Web App + WebAppShortName string `json:"web_app_short_name"` +} + +// Returns information about a Web App by its short name. Returns a 404 error if the Web App is not found +func (client *Client) SearchWebApp(req *SearchWebAppRequest) (*FoundWebApp, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchWebApp", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "web_app_short_name": req.WebAppShortName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundWebApp(result.Data) +} + +type GetWebAppLinkUrlRequest struct { + // Identifier of the chat in which the link was clicked; pass 0 if none + ChatId int64 `json:"chat_id"` + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // Short name of the Web App + WebAppShortName string `json:"web_app_short_name"` + // Start parameter from internalLinkTypeWebApp + StartParameter string `json:"start_parameter"` + // Preferred Web App theme; pass null to use the default theme + Theme *ThemeParameters `json:"theme"` + // Short name of the application; 0-64 English letters, digits, and underscores + ApplicationName string `json:"application_name"` + // Pass true if the current user allowed the bot to send them messages + AllowWriteAccess bool `json:"allow_write_access"` +} + +// Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked +func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getWebAppLinkUrl", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + "web_app_short_name": req.WebAppShortName, + "start_parameter": req.StartParameter, + "theme": req.Theme, + "application_name": req.ApplicationName, + "allow_write_access": req.AllowWriteAccess, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetWebAppUrlRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` - // The URL from the keyboardButtonTypeWebApp button + // The URL from the keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button Url string `json:"url"` // Preferred Web App theme; pass null to use the default theme Theme *ThemeParameters `json:"theme"` @@ -5154,7 +5224,7 @@ type GetWebAppUrlRequest struct { ApplicationName string `json:"application_name"` } -// Returns an HTTPS URL of a Web App to open after keyboardButtonTypeWebApp button is pressed +// Returns an HTTPS URL of a Web App to open after keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button is pressed func (client *Client) GetWebAppUrl(req *GetWebAppUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -5696,11 +5766,11 @@ func (client *Client) CloseChat(req *CloseChatRequest) (*Ok, error) { type ViewMessagesRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the messages are being viewed - MessageThreadId int64 `json:"message_thread_id"` // The identifiers of the messages being viewed MessageIds []int64 `json:"message_ids"` - // Pass true to mark as read the specified messages even the chat is closed + // Source of the message view + Source MessageSource `json:"source"` + // Pass true to mark as read the specified messages even the chat is closed; pass null to guess the source based on chat open state ForceRead bool `json:"force_read"` } @@ -5711,10 +5781,10 @@ func (client *Client) ViewMessages(req *ViewMessagesRequest) (*Ok, error) { Type: "viewMessages", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, - "message_ids": req.MessageIds, - "force_read": req.ForceRead, + "chat_id": req.ChatId, + "message_ids": req.MessageIds, + "source": req.Source, + "force_read": req.ForceRead, }, }) if err != nil { @@ -5786,6 +5856,35 @@ func (client *Client) ClickAnimatedEmojiMessage(req *ClickAnimatedEmojiMessageRe return UnmarshalSticker(result.Data) } +type GetInternalLinkRequest struct { + // Expected type of the link + Type InternalLinkType `json:"type"` + // Pass true to create an HTTPS link (only available for some link types); pass false to create a tg: link + IsHttp bool `json:"is_http"` +} + +// Returns an HTTPS or a tg: link with the given type. Can be called before authorization +func (client *Client) GetInternalLink(req *GetInternalLinkRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getInternalLink", + }, + Data: map[string]interface{}{ + "type": req.Type, + "is_http": req.IsHttp, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetInternalLinkTypeRequest struct { // The link Link string `json:"link"` @@ -5822,15 +5921,15 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeBackground: return UnmarshalInternalLinkTypeBackground(result.Data) + case TypeInternalLinkTypeBotAddToChannel: + return UnmarshalInternalLinkTypeBotAddToChannel(result.Data) + case TypeInternalLinkTypeBotStart: return UnmarshalInternalLinkTypeBotStart(result.Data) case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(result.Data) - case TypeInternalLinkTypeBotAddToChannel: - return UnmarshalInternalLinkTypeBotAddToChannel(result.Data) - case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(result.Data) @@ -5918,6 +6017,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeVideoChat: return UnmarshalInternalLinkTypeVideoChat(result.Data) + case TypeInternalLinkTypeWebApp: + return UnmarshalInternalLinkTypeWebApp(result.Data) + default: return nil, errors.New("invalid type") } @@ -6211,7 +6313,7 @@ func (client *Client) CreateSecretChat(req *CreateSecretChatRequest) (*Chat, err } type CreateNewBasicGroupChatRequest struct { - // Identifiers of users to be added to the basic group + // Identifiers of users to be added to the basic group; may be empty to create a basic group without other members UserIds []int64 `json:"user_ids"` // Title of the new basic group; 1-128 characters Title string `json:"title"` @@ -12134,6 +12236,116 @@ func (client *Client) SetDefaultChannelAdministratorRights(req *SetDefaultChanne return UnmarshalOk(result.Data) } +type SetBotInfoDescriptionRequest struct { + // A two-letter ISO 639-1 language code. If empty, the description will be shown to all users, for which language there are no dedicated description + LanguageCode string `json:"language_code"` + // New bot's description on the specified language + Description string `json:"description"` +} + +// Sets the text shown in the chat with the bot if the chat is empty; bots only +func (client *Client) SetBotInfoDescription(req *SetBotInfoDescriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBotInfoDescription", + }, + Data: map[string]interface{}{ + "language_code": req.LanguageCode, + "description": req.Description, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBotInfoDescriptionRequest struct { + // A two-letter ISO 639-1 language code or an empty string + LanguageCode string `json:"language_code"` +} + +// Returns the text shown in the chat with the bot if the chat is empty in the given language; bots only +func (client *Client) GetBotInfoDescription(req *GetBotInfoDescriptionRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotInfoDescription", + }, + Data: map[string]interface{}{ + "language_code": req.LanguageCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type SetBotInfoShortDescriptionRequest struct { + // A two-letter ISO 639-1 language code. If empty, the short description will be shown to all users, for which language there are no dedicated description + LanguageCode string `json:"language_code"` + // New bot's short description on the specified language + ShortDescription string `json:"short_description"` +} + +// Sets the text shown on the bot's profile page and sent together with the link when users share the bot; bots only +func (client *Client) SetBotInfoShortDescription(req *SetBotInfoShortDescriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBotInfoShortDescription", + }, + Data: map[string]interface{}{ + "language_code": req.LanguageCode, + "short_description": req.ShortDescription, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBotInfoShortDescriptionRequest struct { + // A two-letter ISO 639-1 language code or an empty string + LanguageCode string `json:"language_code"` +} + +// Returns the text shown on the bot's profile page and sent together with the link when users share the bot in the given language; bots only +func (client *Client) GetBotInfoShortDescription(req *GetBotInfoShortDescriptionRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotInfoShortDescription", + }, + Data: map[string]interface{}{ + "language_code": req.LanguageCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + // Returns all active sessions of the current user func (client *Client) GetActiveSessions() (*Sessions, error) { result, err := client.Send(Request{ @@ -13379,7 +13591,7 @@ func (client *Client) SynchronizeLanguagePack(req *SynchronizeLanguagePackReques } type AddCustomServerLanguagePackRequest struct { - // Identifier of a language pack to be added; may be different from a name that is used in an "https://t.me/setlanguage/" link + // Identifier of a language pack to be added LanguagePackId string `json:"language_pack_id"` } @@ -14404,7 +14616,7 @@ type SetAutosaveSettingsRequest struct { Settings *ScopeAutosaveSettings `json:"settings"` } -// Sets autosave settings for the given scope +// Sets autosave settings for the given scope. The method is guaranteed to work only after at least one call to getAutosaveSettings func (client *Client) SetAutosaveSettings(req *SetAutosaveSettingsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14426,7 +14638,7 @@ func (client *Client) SetAutosaveSettings(req *SetAutosaveSettingsRequest) (*Ok, return UnmarshalOk(result.Data) } -// Clears the list of all autosave settings exceptions +// Clears the list of all autosave settings exceptions. The method is guaranteed to work only after at least one call to getAutosaveSettings func (client *Client) ClearAutosaveSettingsExceptions() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -15067,8 +15279,10 @@ func (client *Client) SetBotUpdatesStatus(req *SetBotUpdatesStatusRequest) (*Ok, type UploadStickerFileRequest struct { // Sticker file owner; ignored for regular users UserId int64 `json:"user_id"` - // Sticker file to upload - Sticker *InputSticker `json:"sticker"` + // Sticker format + StickerFormat StickerFormat `json:"sticker_format"` + // File file to upload; must fit in a 512x512 square. For WEBP stickers the file must be in WEBP or PNG format, which will be converted to WEBP server-side. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements + Sticker InputFile `json:"sticker"` } // Uploads a file with a sticker; returns the uploaded file @@ -15078,8 +15292,9 @@ func (client *Client) UploadStickerFile(req *UploadStickerFileRequest) (*File, e Type: "uploadStickerFile", }, Data: map[string]interface{}{ - "user_id": req.UserId, - "sticker": req.Sticker, + "user_id": req.UserId, + "sticker_format": req.StickerFormat, + "sticker": req.Sticker, }, }) if err != nil { @@ -15164,8 +15379,12 @@ type CreateNewStickerSetRequest struct { Title string `json:"title"` // Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive) for bots; 1-64 characters Name string `json:"name"` + // Format of the stickers in the set + StickerFormat StickerFormat `json:"sticker_format"` // Type of the stickers in the set StickerType StickerType `json:"sticker_type"` + // Pass true if stickers in the sticker set must be repainted; for custom emoji sticker sets only + NeedsRepainting bool `json:"needs_repainting"` // List of stickers to be added to the set; must be non-empty. All stickers must have the same format. For TGS stickers, uploadStickerFile must be used before the sticker is shown Stickers []*InputSticker `json:"stickers"` // Source of the sticker set; may be empty if unknown @@ -15179,12 +15398,14 @@ func (client *Client) CreateNewStickerSet(req *CreateNewStickerSetRequest) (*Sti Type: "createNewStickerSet", }, Data: map[string]interface{}{ - "user_id": req.UserId, - "title": req.Title, - "name": req.Name, - "sticker_type": req.StickerType, - "stickers": req.Stickers, - "source": req.Source, + "user_id": req.UserId, + "title": req.Title, + "name": req.Name, + "sticker_format": req.StickerFormat, + "sticker_type": req.StickerType, + "needs_repainting": req.NeedsRepainting, + "stickers": req.Stickers, + "source": req.Source, }, }) if err != nil { @@ -15207,8 +15428,8 @@ type AddStickerToSetRequest struct { Sticker *InputSticker `json:"sticker"` } -// Adds a new sticker to a set; for bots only. Returns the sticker set -func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*StickerSet, error) { +// Adds a new sticker to a set; for bots only +func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "addStickerToSet", @@ -15227,7 +15448,7 @@ func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*StickerSet, return nil, buildResponseError(result.Data) } - return UnmarshalStickerSet(result.Data) + return UnmarshalOk(result.Data) } type SetStickerSetThumbnailRequest struct { @@ -15239,8 +15460,8 @@ type SetStickerSetThumbnailRequest struct { Thumbnail InputFile `json:"thumbnail"` } -// Sets a sticker set thumbnail; for bots only. Returns the sticker set -func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) (*StickerSet, error) { +// Sets a sticker set thumbnail; for bots only +func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "setStickerSetThumbnail", @@ -15259,7 +15480,91 @@ func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) return nil, buildResponseError(result.Data) } - return UnmarshalStickerSet(result.Data) + return UnmarshalOk(result.Data) +} + +type SetCustomEmojiStickerSetThumbnailRequest struct { + // Sticker set name + Name string `json:"name"` + // Identifier of the custom emoji from the sticker set, which will be set as sticker set thumbnail; pass 0 to remove the sticker set thumbnail + CustomEmojiId JsonInt64 `json:"custom_emoji_id"` +} + +// Sets a custom emoji sticker set thumbnail; for bots only +func (client *Client) SetCustomEmojiStickerSetThumbnail(req *SetCustomEmojiStickerSetThumbnailRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setCustomEmojiStickerSetThumbnail", + }, + Data: map[string]interface{}{ + "name": req.Name, + "custom_emoji_id": req.CustomEmojiId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStickerSetTitleRequest struct { + // Sticker set name + Name string `json:"name"` + // New sticker set title + Title string `json:"title"` +} + +// Sets a sticker set title; for bots only +func (client *Client) SetStickerSetTitle(req *SetStickerSetTitleRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStickerSetTitle", + }, + Data: map[string]interface{}{ + "name": req.Name, + "title": req.Title, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteStickerSetRequest struct { + // Sticker set name + Name string `json:"name"` +} + +// Deleted a sticker set; for bots only +func (client *Client) DeleteStickerSet(req *DeleteStickerSetRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteStickerSet", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) } type SetStickerPositionInSetRequest struct { @@ -15317,6 +15622,93 @@ func (client *Client) RemoveStickerFromSet(req *RemoveStickerFromSetRequest) (*O return UnmarshalOk(result.Data) } +type SetStickerEmojisRequest struct { + // Sticker + Sticker InputFile `json:"sticker"` + // New string with 1-20 emoji corresponding to the sticker + Emojis string `json:"emojis"` +} + +// Changes the list of emoji corresponding to a sticker; for bots only. The sticker must belong to a regular or custom emoji sticker set created by the bot +func (client *Client) SetStickerEmojis(req *SetStickerEmojisRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStickerEmojis", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + "emojis": req.Emojis, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStickerKeywordsRequest struct { + // Sticker + Sticker InputFile `json:"sticker"` + // List of up to 20 keywords with total length up to 64 characters, which can be used to find the sticker + Keywords []string `json:"keywords"` +} + +// Changes the list of keywords of a sticker; for bots only. The sticker must belong to a regular or custom emoji sticker set created by the bot +func (client *Client) SetStickerKeywords(req *SetStickerKeywordsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStickerKeywords", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + "keywords": req.Keywords, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStickerMaskPositionRequest struct { + // Sticker + Sticker InputFile `json:"sticker"` + // Position where the mask is placed; pass null to remove mask position + MaskPosition *MaskPosition `json:"mask_position"` +} + +// Changes the mask position of a mask sticker; for bots only. The sticker must belong to a mask sticker set created by the bot +func (client *Client) SetStickerMaskPosition(req *SetStickerMaskPositionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStickerMaskPosition", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + "mask_position": req.MaskPosition, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetMapThumbnailFileRequest struct { // Location of the map center Location *Location `json:"location"` @@ -15792,25 +16184,6 @@ func (client *Client) GetPhoneNumberInfoSync(req *GetPhoneNumberInfoSyncRequest) return GetPhoneNumberInfoSync(req) } -// Returns the link for downloading official Telegram application to be used when the current user invites friends to Telegram -func (client *Client) GetApplicationDownloadLink() (*HttpUrl, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getApplicationDownloadLink", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalHttpUrl(result.Data) -} - type GetDeepLinkInfoRequest struct { // The link Link string `json:"link"` @@ -15877,6 +16250,32 @@ func (client *Client) GetApplicationConfig() (JsonValue, error) { } } +type AddApplicationChangelogRequest struct { + // The previous application version + PreviousApplicationVersion string `json:"previous_application_version"` +} + +// Adds server-provided application changelog as messages to the chat 777000 (Telegram); for official applications only +func (client *Client) AddApplicationChangelog(req *AddApplicationChangelogRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addApplicationChangelog", + }, + Data: map[string]interface{}{ + "previous_application_version": req.PreviousApplicationVersion, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SaveApplicationLogEventRequest struct { // Event type Type string `json:"type"` @@ -15909,6 +16308,25 @@ func (client *Client) SaveApplicationLogEvent(req *SaveApplicationLogEventReques return UnmarshalOk(result.Data) } +// Returns the link for downloading official Telegram application to be used when the current user invites friends to Telegram +func (client *Client) GetApplicationDownloadLink() (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getApplicationDownloadLink", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type AddProxyRequest struct { // Proxy server IP address Server string `json:"server"` @@ -17008,6 +17426,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(result.Data) + case TypeUpdateAddChatMembersPrivacyForbidden: + return UnmarshalUpdateAddChatMembersPrivacyForbidden(result.Data) + case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(result.Data) diff --git a/client/type.go b/client/type.go index 9d6b8c9..ac34a26 100755 --- a/client/type.go +++ b/client/type.go @@ -28,6 +28,7 @@ const ( ClassMessageForwardOrigin = "MessageForwardOrigin" ClassReactionType = "ReactionType" ClassMessageSendingState = "MessageSendingState" + ClassMessageSource = "MessageSource" ClassNotificationSettingsScope = "NotificationSettingsScope" ClassChatType = "ChatType" ClassChatList = "ChatList" @@ -70,6 +71,7 @@ const ( ClassSpeechRecognitionResult = "SpeechRecognitionResult" ClassInputInlineQueryResult = "InputInlineQueryResult" ClassInlineQueryResult = "InlineQueryResult" + ClassInlineQueryResultsButtonType = "InlineQueryResultsButtonType" ClassCallbackQueryPayload = "CallbackQueryPayload" ClassChatEventAction = "ChatEventAction" ClassLanguagePackStringValue = "LanguagePackStringValue" @@ -146,6 +148,7 @@ const ( ClassLocation = "Location" ClassVenue = "Venue" ClassGame = "Game" + ClassWebApp = "WebApp" ClassPoll = "Poll" ClassProfilePhoto = "ProfilePhoto" ClassChatPhotoInfo = "ChatPhotoInfo" @@ -190,6 +193,8 @@ const ( ClassMessageSenders = "MessageSenders" ClassChatMessageSender = "ChatMessageSender" ClassChatMessageSenders = "ChatMessageSenders" + ClassMessageViewer = "MessageViewer" + ClassMessageViewers = "MessageViewers" ClassMessageForwardInfo = "MessageForwardInfo" ClassMessageReplyInfo = "MessageReplyInfo" ClassMessageReaction = "MessageReaction" @@ -224,6 +229,7 @@ const ( ClassChatsNearby = "ChatsNearby" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" + ClassFoundWebApp = "FoundWebApp" ClassWebAppInfo = "WebAppInfo" ClassMessageThreadInfo = "MessageThreadInfo" ClassForumTopicIcon = "ForumTopicIcon" @@ -306,6 +312,7 @@ const ( ClassSentWebAppMessage = "SentWebAppMessage" ClassHttpUrl = "HttpUrl" ClassUserLink = "UserLink" + ClassInlineQueryResultsButton = "InlineQueryResultsButton" ClassInlineQueryResults = "InlineQueryResults" ClassCallbackQueryAnswer = "CallbackQueryAnswer" ClassCustomRequestResult = "CustomRequestResult" @@ -468,6 +475,7 @@ const ( TypeLocation = "location" TypeVenue = "venue" TypeGame = "game" + TypeWebApp = "webApp" TypePoll = "poll" TypeProfilePhoto = "profilePhoto" TypeChatPhotoInfo = "chatPhotoInfo" @@ -548,6 +556,8 @@ const ( TypeMessageSenders = "messageSenders" TypeChatMessageSender = "chatMessageSender" TypeChatMessageSenders = "chatMessageSenders" + TypeMessageViewer = "messageViewer" + TypeMessageViewers = "messageViewers" TypeMessageForwardOriginUser = "messageForwardOriginUser" TypeMessageForwardOriginChat = "messageForwardOriginChat" TypeMessageForwardOriginHiddenUser = "messageForwardOriginHiddenUser" @@ -570,6 +580,15 @@ const ( TypeMessagePositions = "messagePositions" TypeMessageCalendarDay = "messageCalendarDay" TypeMessageCalendar = "messageCalendar" + TypeMessageSourceChatHistory = "messageSourceChatHistory" + TypeMessageSourceMessageThreadHistory = "messageSourceMessageThreadHistory" + TypeMessageSourceForumTopicHistory = "messageSourceForumTopicHistory" + TypeMessageSourceHistoryPreview = "messageSourceHistoryPreview" + TypeMessageSourceChatList = "messageSourceChatList" + TypeMessageSourceSearch = "messageSourceSearch" + TypeMessageSourceChatEventLog = "messageSourceChatEventLog" + TypeMessageSourceNotification = "messageSourceNotification" + TypeMessageSourceOther = "messageSourceOther" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" TypeFileDownload = "fileDownload" @@ -636,6 +655,7 @@ const ( TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard" TypeLoginUrlInfoOpen = "loginUrlInfoOpen" TypeLoginUrlInfoRequestConfirmation = "loginUrlInfoRequestConfirmation" + TypeFoundWebApp = "foundWebApp" TypeWebAppInfo = "webAppInfo" TypeMessageThreadInfo = "messageThreadInfo" TypeForumTopicIcon = "forumTopicIcon" @@ -1036,6 +1056,9 @@ const ( TypeInlineQueryResultSticker = "inlineQueryResultSticker" TypeInlineQueryResultVideo = "inlineQueryResultVideo" TypeInlineQueryResultVoiceNote = "inlineQueryResultVoiceNote" + TypeInlineQueryResultsButtonTypeStartBot = "inlineQueryResultsButtonTypeStartBot" + TypeInlineQueryResultsButtonTypeWebApp = "inlineQueryResultsButtonTypeWebApp" + TypeInlineQueryResultsButton = "inlineQueryResultsButton" TypeInlineQueryResults = "inlineQueryResults" TypeCallbackQueryPayloadData = "callbackQueryPayloadData" TypeCallbackQueryPayloadDataWithPassword = "callbackQueryPayloadDataWithPassword" @@ -1289,9 +1312,9 @@ const ( TypeInternalLinkTypeAttachmentMenuBot = "internalLinkTypeAttachmentMenuBot" TypeInternalLinkTypeAuthenticationCode = "internalLinkTypeAuthenticationCode" TypeInternalLinkTypeBackground = "internalLinkTypeBackground" + TypeInternalLinkTypeBotAddToChannel = "internalLinkTypeBotAddToChannel" TypeInternalLinkTypeBotStart = "internalLinkTypeBotStart" TypeInternalLinkTypeBotStartInGroup = "internalLinkTypeBotStartInGroup" - TypeInternalLinkTypeBotAddToChannel = "internalLinkTypeBotAddToChannel" TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" TypeInternalLinkTypeChatInvite = "internalLinkTypeChatInvite" TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings = "internalLinkTypeDefaultMessageAutoDeleteTimerSettings" @@ -1321,6 +1344,7 @@ const ( TypeInternalLinkTypeUserPhoneNumber = "internalLinkTypeUserPhoneNumber" TypeInternalLinkTypeUserToken = "internalLinkTypeUserToken" TypeInternalLinkTypeVideoChat = "internalLinkTypeVideoChat" + TypeInternalLinkTypeWebApp = "internalLinkTypeWebApp" TypeMessageLink = "messageLink" TypeMessageLinkInfo = "messageLinkInfo" TypeFilePart = "filePart" @@ -1518,6 +1542,7 @@ const ( TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" TypeUpdateAnimationSearchParameters = "updateAnimationSearchParameters" TypeUpdateSuggestedActions = "updateSuggestedActions" + TypeUpdateAddChatMembersPrivacyForbidden = "updateAddChatMembersPrivacyForbidden" TypeUpdateAutosaveSettings = "updateAutosaveSettings" TypeUpdateNewInlineQuery = "updateNewInlineQuery" TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" @@ -1652,6 +1677,11 @@ type MessageSendingState interface { MessageSendingStateType() string } +// Describes source of a message +type MessageSource interface { + MessageSourceType() string +} + // Describes the types of chats to which notification settings are relevant type NotificationSettingsScope interface { NotificationSettingsScopeType() string @@ -1862,6 +1892,11 @@ type InlineQueryResult interface { InlineQueryResultType() string } +// Represents a type of a button in results of inline query +type InlineQueryResultsButtonType interface { + InlineQueryResultsButtonTypeType() string +} + // Represents a payload of a callback query type CallbackQueryPayload interface { CallbackQueryPayloadType() string @@ -2832,6 +2867,8 @@ type AuthorizationStateWaitPassword struct { PasswordHint string `json:"password_hint"` // True, if a recovery email address has been set up HasRecoveryEmailAddress bool `json:"has_recovery_email_address"` + // True, if some Telegram Passport elements were saved + HasPassportData bool `json:"has_passport_data"` // Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent RecoveryEmailAddressPattern string `json:"recovery_email_address_pattern"` } @@ -3898,7 +3935,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. The sticker must not be repainted on chat photos + // True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places NeedsRepainting bool `json:"needs_repainting"` } @@ -4545,12 +4582,12 @@ func (*Venue) GetType() string { return TypeVenue } -// Describes a game +// Describes a game. Use getInternalLink with internalLinkTypeGame to share the game type Game struct { meta // Unique game identifier Id JsonInt64 `json:"id"` - // Game short name. To share a game use the URL https://t.me/{bot_username}?game={game_short_name} + // Game short name ShortName string `json:"short_name"` // Game title Title string `json:"title"` @@ -4580,6 +4617,37 @@ func (*Game) GetType() string { return TypeGame } +// Describes a Web App. Use getInternalLink with internalLinkTypeWebApp to share the Web App +type WebApp struct { + meta + // Web App short name + ShortName string `json:"short_name"` + // Web App title + Title string `json:"title"` + // Web App description + Description string `json:"description"` + // Web App photo + Photo *Photo `json:"photo"` + // Web App animation; may be null + Animation *Animation `json:"animation"` +} + +func (entity *WebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebApp + + return json.Marshal((*stub)(entity)) +} + +func (*WebApp) GetClass() string { + return ClassWebApp +} + +func (*WebApp) GetType() string { + return TypeWebApp +} + // Describes a poll type Poll struct { meta @@ -5269,7 +5337,7 @@ func (*InputChatPhotoSticker) InputChatPhotoType() string { type ChatPermissions struct { meta // True, if the user can send text messages, contacts, invoices, locations, and venues - CanSendMessages bool `json:"can_send_messages"` + CanSendBasicMessages bool `json:"can_send_basic_messages"` // True, if the user can send music files CanSendAudios bool `json:"can_send_audios"` // True, if the user can send documents @@ -5653,7 +5721,7 @@ func (user *User) UnmarshalJSON(data []byte) error { type BotInfo struct { meta // The text that is shown on the bot's profile page and is sent together with the link when users share the bot - ShareText string `json:"share_text"` + ShortDescription string `json:"short_description"` // The text shown in the chat with the bot if the chat is empty Description string `json:"description"` // Photo shown in the chat with the bot if the chat is empty; may be null @@ -7353,6 +7421,54 @@ func (*ChatMessageSenders) GetType() string { return TypeChatMessageSenders } +// Represents a viewer of a message +type MessageViewer struct { + meta + // User identifier of the viewer + UserId int64 `json:"user_id"` + // Approximate point in time (Unix timestamp) when the message was viewed + ViewDate int32 `json:"view_date"` +} + +func (entity *MessageViewer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageViewer + + return json.Marshal((*stub)(entity)) +} + +func (*MessageViewer) GetClass() string { + return ClassMessageViewer +} + +func (*MessageViewer) GetType() string { + return TypeMessageViewer +} + +// Represents a list of message viewers +type MessageViewers struct { + meta + // List of message viewers + Viewers []*MessageViewer `json:"viewers"` +} + +func (entity *MessageViewers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageViewers + + return json.Marshal((*stub)(entity)) +} + +func (*MessageViewers) GetClass() string { + return ClassMessageViewers +} + +func (*MessageViewers) GetType() string { + return TypeMessageViewers +} + // The message was originally sent by a known user type MessageForwardOriginUser struct { meta @@ -7796,6 +7912,8 @@ func (unreadReaction *UnreadReaction) UnmarshalJSON(data []byte) error { // The message is being sent now, but has not yet been delivered to the server type MessageSendingStatePending struct { meta + // Non-persistent message sending identifier, specified by the application + SendingId int32 `json:"sending_id"` } func (entity *MessageSendingStatePending) MarshalJSON() ([]byte, error) { @@ -8234,6 +8352,231 @@ func (*MessageCalendar) GetType() string { return TypeMessageCalendar } +// The message is from a chat history +type MessageSourceChatHistory struct { + meta +} + +func (entity *MessageSourceChatHistory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceChatHistory + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceChatHistory) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceChatHistory) GetType() string { + return TypeMessageSourceChatHistory +} + +func (*MessageSourceChatHistory) MessageSourceType() string { + return TypeMessageSourceChatHistory +} + +// The message is from a message thread history +type MessageSourceMessageThreadHistory struct { + meta +} + +func (entity *MessageSourceMessageThreadHistory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceMessageThreadHistory + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceMessageThreadHistory) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceMessageThreadHistory) GetType() string { + return TypeMessageSourceMessageThreadHistory +} + +func (*MessageSourceMessageThreadHistory) MessageSourceType() string { + return TypeMessageSourceMessageThreadHistory +} + +// The message is from a forum topic history +type MessageSourceForumTopicHistory struct { + meta +} + +func (entity *MessageSourceForumTopicHistory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceForumTopicHistory + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceForumTopicHistory) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceForumTopicHistory) GetType() string { + return TypeMessageSourceForumTopicHistory +} + +func (*MessageSourceForumTopicHistory) MessageSourceType() string { + return TypeMessageSourceForumTopicHistory +} + +// The message is from chat, message thread or forum topic history preview +type MessageSourceHistoryPreview struct { + meta +} + +func (entity *MessageSourceHistoryPreview) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceHistoryPreview + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceHistoryPreview) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceHistoryPreview) GetType() string { + return TypeMessageSourceHistoryPreview +} + +func (*MessageSourceHistoryPreview) MessageSourceType() string { + return TypeMessageSourceHistoryPreview +} + +// The message is from a chat list or a forum topic list +type MessageSourceChatList struct { + meta +} + +func (entity *MessageSourceChatList) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceChatList + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceChatList) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceChatList) GetType() string { + return TypeMessageSourceChatList +} + +func (*MessageSourceChatList) MessageSourceType() string { + return TypeMessageSourceChatList +} + +// The message is from search results, including file downloads, local file list, outgoing document messages, calendar +type MessageSourceSearch struct { + meta +} + +func (entity *MessageSourceSearch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceSearch + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceSearch) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceSearch) GetType() string { + return TypeMessageSourceSearch +} + +func (*MessageSourceSearch) MessageSourceType() string { + return TypeMessageSourceSearch +} + +// The message is from a chat event log +type MessageSourceChatEventLog struct { + meta +} + +func (entity *MessageSourceChatEventLog) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceChatEventLog + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceChatEventLog) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceChatEventLog) GetType() string { + return TypeMessageSourceChatEventLog +} + +func (*MessageSourceChatEventLog) MessageSourceType() string { + return TypeMessageSourceChatEventLog +} + +// The message is from a notification +type MessageSourceNotification struct { + meta +} + +func (entity *MessageSourceNotification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceNotification + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceNotification) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceNotification) GetType() string { + return TypeMessageSourceNotification +} + +func (*MessageSourceNotification) MessageSourceType() string { + return TypeMessageSourceNotification +} + +// The message is from some other source +type MessageSourceOther struct { + meta +} + +func (entity *MessageSourceOther) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceOther + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceOther) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceOther) GetType() string { + return TypeMessageSourceOther +} + +func (*MessageSourceOther) MessageSourceType() string { + return TypeMessageSourceOther +} + // Describes a sponsored message type SponsoredMessage struct { meta @@ -8251,6 +8594,10 @@ type SponsoredMessage struct { Link InternalLinkType `json:"link"` // Content of the message. Currently, can be only of the type messageText Content MessageContent `json:"content"` + // If non-empty, information about the sponsor to be shown along with the message + SponsorInfo string `json:"sponsor_info"` + // If non-empty, additional information about the sponsored message to be shown along with the message + AdditionalInfo string `json:"additional_info"` } func (entity *SponsoredMessage) MarshalJSON() ([]byte, error) { @@ -8278,6 +8625,8 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { ShowChatPhoto bool `json:"show_chat_photo"` Link json.RawMessage `json:"link"` Content json.RawMessage `json:"content"` + SponsorInfo string `json:"sponsor_info"` + AdditionalInfo string `json:"additional_info"` } err := json.Unmarshal(data, &tmp) @@ -8290,6 +8639,8 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { sponsoredMessage.SponsorChatId = tmp.SponsorChatId sponsoredMessage.SponsorChatInfo = tmp.SponsorChatInfo sponsoredMessage.ShowChatPhoto = tmp.ShowChatPhoto + sponsoredMessage.SponsorInfo = tmp.SponsorInfo + sponsoredMessage.AdditionalInfo = tmp.AdditionalInfo fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) sponsoredMessage.Link = fieldLink @@ -10330,8 +10681,8 @@ type LoginUrlInfoOpen struct { meta // The URL to open Url string `json:"url"` - // True, if there is no need to show an ordinary open URL confirm - SkipConfirm bool `json:"skip_confirm"` + // True, if there is no need to show an ordinary open URL confirmation + SkipConfirmation bool `json:"skip_confirmation"` } func (entity *LoginUrlInfoOpen) MarshalJSON() ([]byte, error) { @@ -10363,7 +10714,7 @@ type LoginUrlInfoRequestConfirmation struct { Domain string `json:"domain"` // User identifier of a bot linked with the website BotUserId int64 `json:"bot_user_id"` - // True, if the user needs to be requested to give the permission to the bot to send them messages + // True, if the user must be asked for the permission to the bot to send them messages RequestWriteAccess bool `json:"request_write_access"` } @@ -10387,6 +10738,33 @@ func (*LoginUrlInfoRequestConfirmation) LoginUrlInfoType() string { return TypeLoginUrlInfoRequestConfirmation } +// Contains information about a Web App found by its short name +type FoundWebApp struct { + meta + // The Web App + WebApp *WebApp `json:"web_app"` + // True, if the user must be asked for the permission to the bot to send them messages + RequestWriteAccess bool `json:"request_write_access"` + // True, if there is no need to show an ordinary open URL confirmation before opening the Web App. The field must be ignored and confirmation must be shown anyway if the Web App link was hidden + SkipConfirmation bool `json:"skip_confirmation"` +} + +func (entity *FoundWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*FoundWebApp) GetClass() string { + return ClassFoundWebApp +} + +func (*FoundWebApp) GetType() string { + return TypeFoundWebApp +} + // Contains information about a Web App type WebAppInfo struct { meta @@ -16637,7 +17015,7 @@ func (*MessagePoll) MessageContentType() string { return TypeMessagePoll } -// A message with an invoice from a bot +// A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice type MessageInvoice struct { meta // Product title @@ -16650,7 +17028,7 @@ type MessageInvoice struct { Currency string `json:"currency"` // Product total price in the smallest units of the currency TotalAmount int64 `json:"total_amount"` - // Unique invoice bot start_parameter. To share an invoice use the URL https://t.me/{bot_username}?start={start_parameter} + // Unique invoice bot start_parameter to be passed to getInternalLink StartParameter string `json:"start_parameter"` // True, if the invoice is a test invoice IsTest bool `json:"is_test"` @@ -17711,6 +18089,8 @@ func (*MessageWebsiteConnected) MessageContentType() string { // The user allowed the bot to send messages type MessageBotWriteAccessAllowed struct { meta + // Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu + WebApp *WebApp `json:"web_app"` } func (entity *MessageBotWriteAccessAllowed) MarshalJSON() ([]byte, error) { @@ -18563,6 +18943,8 @@ type MessageSendOptions struct { UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled SchedulingState MessageSchedulingState `json:"scheduling_state"` + // Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates + SendingId int32 `json:"sending_id"` } func (entity *MessageSendOptions) MarshalJSON() ([]byte, error) { @@ -18588,6 +18970,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { ProtectContent bool `json:"protect_content"` UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` SchedulingState json.RawMessage `json:"scheduling_state"` + SendingId int32 `json:"sending_id"` } err := json.Unmarshal(data, &tmp) @@ -18599,6 +18982,7 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent messageSendOptions.UpdateOrderOfInstalledStickerSets = tmp.UpdateOrderOfInstalledStickerSets + messageSendOptions.SendingId = tmp.SendingId fieldSchedulingState, _ := UnmarshalMessageSchedulingState(tmp.SchedulingState) messageSendOptions.SchedulingState = fieldSchedulingState @@ -20763,8 +21147,8 @@ 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"` + // Custom emoji sticker, which represents icon of the category + Icon *Sticker `json:"icon"` // List of emojis in the category Emojis []string `json:"emojis"` } @@ -22221,6 +22605,8 @@ type AddedReaction struct { Type ReactionType `json:"type"` // Identifier of the chat member, applied the reaction SenderId MessageSender `json:"sender_id"` + // Point in time (Unix timestamp) when the reaction was added + Date int32 `json:"date"` } func (entity *AddedReaction) MarshalJSON() ([]byte, error) { @@ -22243,6 +22629,7 @@ func (addedReaction *AddedReaction) UnmarshalJSON(data []byte) error { var tmp struct { Type json.RawMessage `json:"type"` SenderId json.RawMessage `json:"sender_id"` + Date int32 `json:"date"` } err := json.Unmarshal(data, &tmp) @@ -22250,6 +22637,8 @@ func (addedReaction *AddedReaction) UnmarshalJSON(data []byte) error { return err } + addedReaction.Date = tmp.Date + fieldType, _ := UnmarshalReactionType(tmp.Type) addedReaction.Type = fieldType @@ -22633,7 +23022,7 @@ type AttachmentMenuBot struct { SupportsChannelChats bool `json:"supports_channel_chats"` // True, if the bot supports "settings_button_pressed" event SupportsSettings bool `json:"supports_settings"` - // True, if the user needs to be requested to give the permission to the bot to send them messages + // True, if the user must be asked for the permission to the bot to send them messages RequestWriteAccess bool `json:"request_write_access"` // Name for the bot in attachment menu Name string `json:"name"` @@ -24012,19 +24401,115 @@ func (*InlineQueryResultVoiceNote) InlineQueryResultType() string { return TypeInlineQueryResultVoiceNote } +// Describes the button that opens a private chat with the bot and sends a start message to the bot with the given parameter +type InlineQueryResultsButtonTypeStartBot struct { + meta + // The parameter for the bot start message + Parameter string `json:"parameter"` +} + +func (entity *InlineQueryResultsButtonTypeStartBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultsButtonTypeStartBot + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultsButtonTypeStartBot) GetClass() string { + return ClassInlineQueryResultsButtonType +} + +func (*InlineQueryResultsButtonTypeStartBot) GetType() string { + return TypeInlineQueryResultsButtonTypeStartBot +} + +func (*InlineQueryResultsButtonTypeStartBot) InlineQueryResultsButtonTypeType() string { + return TypeInlineQueryResultsButtonTypeStartBot +} + +// Describes the button that opens a Web App by calling getWebAppUrl +type InlineQueryResultsButtonTypeWebApp struct { + meta + // An HTTP URL to pass to getWebAppUrl + Url string `json:"url"` +} + +func (entity *InlineQueryResultsButtonTypeWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultsButtonTypeWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultsButtonTypeWebApp) GetClass() string { + return ClassInlineQueryResultsButtonType +} + +func (*InlineQueryResultsButtonTypeWebApp) GetType() string { + return TypeInlineQueryResultsButtonTypeWebApp +} + +func (*InlineQueryResultsButtonTypeWebApp) InlineQueryResultsButtonTypeType() string { + return TypeInlineQueryResultsButtonTypeWebApp +} + +// Represents a button to be shown above inline query results +type InlineQueryResultsButton struct { + meta + // The text of the button + Text string `json:"text"` + // Type of the button + Type InlineQueryResultsButtonType `json:"type"` +} + +func (entity *InlineQueryResultsButton) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultsButton + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultsButton) GetClass() string { + return ClassInlineQueryResultsButton +} + +func (*InlineQueryResultsButton) GetType() string { + return TypeInlineQueryResultsButton +} + +func (inlineQueryResultsButton *InlineQueryResultsButton) UnmarshalJSON(data []byte) error { + var tmp struct { + Text string `json:"text"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inlineQueryResultsButton.Text = tmp.Text + + fieldType, _ := UnmarshalInlineQueryResultsButtonType(tmp.Type) + inlineQueryResultsButton.Type = fieldType + + return nil +} + // Represents the results of the inline query. Use sendInlineQueryResultMessage to send the result of the query type InlineQueryResults struct { meta // Unique identifier of the inline query InlineQueryId JsonInt64 `json:"inline_query_id"` - // The offset for the next request. If empty, there are no more results - NextOffset string `json:"next_offset"` + // Button to be shown above inline query results; may be null + Button *InlineQueryResultsButton `json:"button"` // Results of the query Results []InlineQueryResult `json:"results"` - // If non-empty, this text must be shown on the button, which opens a private chat with the bot and sends the bot a start message with the switch_pm_parameter - SwitchPmText string `json:"switch_pm_text"` - // Parameter for the bot start message - SwitchPmParameter string `json:"switch_pm_parameter"` + // The offset for the next request. If empty, there are no more results + NextOffset string `json:"next_offset"` } func (entity *InlineQueryResults) MarshalJSON() ([]byte, error) { @@ -24045,11 +24530,10 @@ func (*InlineQueryResults) GetType() string { func (inlineQueryResults *InlineQueryResults) UnmarshalJSON(data []byte) error { var tmp struct { - InlineQueryId JsonInt64 `json:"inline_query_id"` - NextOffset string `json:"next_offset"` - Results []json.RawMessage `json:"results"` - SwitchPmText string `json:"switch_pm_text"` - SwitchPmParameter string `json:"switch_pm_parameter"` + InlineQueryId JsonInt64 `json:"inline_query_id"` + Button *InlineQueryResultsButton `json:"button"` + Results []json.RawMessage `json:"results"` + NextOffset string `json:"next_offset"` } err := json.Unmarshal(data, &tmp) @@ -24058,9 +24542,8 @@ func (inlineQueryResults *InlineQueryResults) UnmarshalJSON(data []byte) error { } inlineQueryResults.InlineQueryId = tmp.InlineQueryId + inlineQueryResults.Button = tmp.Button inlineQueryResults.NextOffset = tmp.NextOffset - inlineQueryResults.SwitchPmText = tmp.SwitchPmText - inlineQueryResults.SwitchPmParameter = tmp.SwitchPmParameter fieldResults, _ := UnmarshalListOfInlineQueryResult(tmp.Results) inlineQueryResults.Results = fieldResults @@ -31482,6 +31965,35 @@ func (*InternalLinkTypeBackground) InternalLinkTypeType() string { return TypeInternalLinkTypeBackground } +// 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 + BotUsername string `json:"bot_username"` + // Expected administrator rights for the bot + AdministratorRights *ChatAdministratorRights `json:"administrator_rights"` +} + +func (entity *InternalLinkTypeBotAddToChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeBotAddToChannel + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeBotAddToChannel) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeBotAddToChannel) GetType() string { + return TypeInternalLinkTypeBotAddToChannel +} + +func (*InternalLinkTypeBotAddToChannel) InternalLinkTypeType() string { + return TypeInternalLinkTypeBotAddToChannel +} + // The link is a link to a chat with a Telegram bot. Call searchPublicChat with the given bot username, check that the user is a bot, show START button in the chat with the bot, and then call sendBotStartMessage with the given start parameter after the button is pressed type InternalLinkTypeBotStart struct { meta @@ -31544,35 +32056,6 @@ 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 -type InternalLinkTypeBotAddToChannel struct { - meta - // Username of the bot - BotUsername string `json:"bot_username"` - // Expected administrator rights for the bot - AdministratorRights *ChatAdministratorRights `json:"administrator_rights"` -} - -func (entity *InternalLinkTypeBotAddToChannel) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InternalLinkTypeBotAddToChannel - - return json.Marshal((*stub)(entity)) -} - -func (*InternalLinkTypeBotAddToChannel) GetClass() string { - return ClassInternalLinkType -} - -func (*InternalLinkTypeBotAddToChannel) GetType() string { - return TypeInternalLinkTypeBotAddToChannel -} - -func (*InternalLinkTypeBotAddToChannel) InternalLinkTypeType() string { - return TypeInternalLinkTypeBotAddToChannel -} - // The link is a link to the change phone number section of the app type InternalLinkTypeChangePhoneNumber struct { meta @@ -31957,7 +32440,7 @@ func (*InternalLinkTypePhoneNumberConfirmation) InternalLinkTypeType() string { return TypeInternalLinkTypePhoneNumberConfirmation } -// The link is a link to the Premium features screen of the applcation from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link +// The link is a link to the Premium features screen of the application from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link type InternalLinkTypePremiumFeatures struct { meta // Referrer specified in the link @@ -32381,6 +32864,37 @@ func (*InternalLinkTypeVideoChat) InternalLinkTypeType() string { return TypeInternalLinkTypeVideoChat } +// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed, then calling getWebAppLinkUrl and opening the returned URL +type InternalLinkTypeWebApp struct { + meta + // Username of the bot that owns the Web App + BotUsername string `json:"bot_username"` + // Short name of the Web App + WebAppShortName string `json:"web_app_short_name"` + // Start parameter to be passed to getWebAppLinkUrl + StartParameter string `json:"start_parameter"` +} + +func (entity *InternalLinkTypeWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeWebApp) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeWebApp) GetType() string { + return TypeInternalLinkTypeWebApp +} + +func (*InternalLinkTypeWebApp) InternalLinkTypeType() string { + return TypeInternalLinkTypeWebApp +} + // Contains an HTTPS link to a message in a supergroup or channel, or a forum topic type MessageLink struct { meta @@ -34596,14 +35110,14 @@ func (*Proxies) GetType() string { // A sticker to be added to a sticker set type InputSticker struct { meta - // File with the sticker; must fit in a 512x512 square. For WEBP stickers and masks the file must be in PNG format, which will be converted to WEBP server-side. Otherwise, the file must be local or uploaded within a week. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements + // File with the sticker; must fit in a 512x512 square. For WEBP stickers the file must be in WEBP or PNG format, which will be converted to WEBP server-side. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements Sticker InputFile `json:"sticker"` - // Emojis corresponding to the sticker + // String with 1-20 emoji corresponding to the sticker Emojis string `json:"emojis"` - // Sticker format - Format StickerFormat `json:"format"` // Position where the mask is placed; pass null if not specified MaskPosition *MaskPosition `json:"mask_position"` + // List of up to 20 keywords with total length up to 64 characters, which can be used to find the sticker + Keywords []string `json:"keywords"` } func (entity *InputSticker) MarshalJSON() ([]byte, error) { @@ -34626,8 +35140,8 @@ func (inputSticker *InputSticker) UnmarshalJSON(data []byte) error { var tmp struct { Sticker json.RawMessage `json:"sticker"` Emojis string `json:"emojis"` - Format json.RawMessage `json:"format"` MaskPosition *MaskPosition `json:"mask_position"` + Keywords []string `json:"keywords"` } err := json.Unmarshal(data, &tmp) @@ -34637,13 +35151,11 @@ func (inputSticker *InputSticker) UnmarshalJSON(data []byte) error { inputSticker.Emojis = tmp.Emojis inputSticker.MaskPosition = tmp.MaskPosition + inputSticker.Keywords = tmp.Keywords fieldSticker, _ := UnmarshalInputFile(tmp.Sticker) inputSticker.Sticker = fieldSticker - fieldFormat, _ := UnmarshalStickerFormat(tmp.Format) - inputSticker.Format = fieldFormat - return nil } @@ -38583,6 +39095,35 @@ func (updateSuggestedActions *UpdateSuggestedActions) UnmarshalJSON(data []byte) return nil } +// Adding users to a chat has failed because of their privacy settings. An invite link can be shared with the users if appropriate +type UpdateAddChatMembersPrivacyForbidden struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifiers of users, which weren't added because of their privacy settings + UserIds []int64 `json:"user_ids"` +} + +func (entity *UpdateAddChatMembersPrivacyForbidden) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAddChatMembersPrivacyForbidden + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAddChatMembersPrivacyForbidden) GetClass() string { + return ClassUpdate +} + +func (*UpdateAddChatMembersPrivacyForbidden) GetType() string { + return TypeUpdateAddChatMembersPrivacyForbidden +} + +func (*UpdateAddChatMembersPrivacyForbidden) UpdateType() string { + return TypeUpdateAddChatMembersPrivacyForbidden +} + // Autosave settings for some type of chats were updated type UpdateAutosaveSettings struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index af29479..f8d624b 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -877,6 +877,61 @@ func UnmarshalListOfMessageSendingState(dataList []json.RawMessage) ([]MessageSe return list, nil } +func UnmarshalMessageSource(data json.RawMessage) (MessageSource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageSourceChatHistory: + return UnmarshalMessageSourceChatHistory(data) + + case TypeMessageSourceMessageThreadHistory: + return UnmarshalMessageSourceMessageThreadHistory(data) + + case TypeMessageSourceForumTopicHistory: + return UnmarshalMessageSourceForumTopicHistory(data) + + case TypeMessageSourceHistoryPreview: + return UnmarshalMessageSourceHistoryPreview(data) + + case TypeMessageSourceChatList: + return UnmarshalMessageSourceChatList(data) + + case TypeMessageSourceSearch: + return UnmarshalMessageSourceSearch(data) + + case TypeMessageSourceChatEventLog: + return UnmarshalMessageSourceChatEventLog(data) + + case TypeMessageSourceNotification: + return UnmarshalMessageSourceNotification(data) + + case TypeMessageSourceOther: + return UnmarshalMessageSourceOther(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageSource(dataList []json.RawMessage) ([]MessageSource, error) { + list := []MessageSource{} + + for _, data := range dataList { + entity, err := UnmarshalMessageSource(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalNotificationSettingsScope(data json.RawMessage) (NotificationSettingsScope, error) { var meta meta @@ -3142,6 +3197,40 @@ func UnmarshalListOfInlineQueryResult(dataList []json.RawMessage) ([]InlineQuery return list, nil } +func UnmarshalInlineQueryResultsButtonType(data json.RawMessage) (InlineQueryResultsButtonType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInlineQueryResultsButtonTypeStartBot: + return UnmarshalInlineQueryResultsButtonTypeStartBot(data) + + case TypeInlineQueryResultsButtonTypeWebApp: + return UnmarshalInlineQueryResultsButtonTypeWebApp(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInlineQueryResultsButtonType(dataList []json.RawMessage) ([]InlineQueryResultsButtonType, error) { + list := []InlineQueryResultsButtonType{} + + for _, data := range dataList { + entity, err := UnmarshalInlineQueryResultsButtonType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCallbackQueryPayload(data json.RawMessage) (CallbackQueryPayload, error) { var meta meta @@ -4536,15 +4625,15 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeBackground: return UnmarshalInternalLinkTypeBackground(data) + case TypeInternalLinkTypeBotAddToChannel: + return UnmarshalInternalLinkTypeBotAddToChannel(data) + case TypeInternalLinkTypeBotStart: return UnmarshalInternalLinkTypeBotStart(data) case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(data) - case TypeInternalLinkTypeBotAddToChannel: - return UnmarshalInternalLinkTypeBotAddToChannel(data) - case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) @@ -4632,6 +4721,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeVideoChat: return UnmarshalInternalLinkTypeVideoChat(data) + case TypeInternalLinkTypeWebApp: + return UnmarshalInternalLinkTypeWebApp(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -5547,6 +5639,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(data) + case TypeUpdateAddChatMembersPrivacyForbidden: + return UnmarshalUpdateAddChatMembersPrivacyForbidden(data) + case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(data) @@ -6298,6 +6393,14 @@ func UnmarshalGame(data json.RawMessage) (*Game, error) { return &resp, err } +func UnmarshalWebApp(data json.RawMessage) (*WebApp, error) { + var resp WebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPoll(data json.RawMessage) (*Poll, error) { var resp Poll @@ -6938,6 +7041,22 @@ func UnmarshalChatMessageSenders(data json.RawMessage) (*ChatMessageSenders, err return &resp, err } +func UnmarshalMessageViewer(data json.RawMessage) (*MessageViewer, error) { + var resp MessageViewer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageViewers(data json.RawMessage) (*MessageViewers, error) { + var resp MessageViewers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageForwardOriginUser(data json.RawMessage) (*MessageForwardOriginUser, error) { var resp MessageForwardOriginUser @@ -7114,6 +7233,78 @@ func UnmarshalMessageCalendar(data json.RawMessage) (*MessageCalendar, error) { return &resp, err } +func UnmarshalMessageSourceChatHistory(data json.RawMessage) (*MessageSourceChatHistory, error) { + var resp MessageSourceChatHistory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSourceMessageThreadHistory(data json.RawMessage) (*MessageSourceMessageThreadHistory, error) { + var resp MessageSourceMessageThreadHistory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSourceForumTopicHistory(data json.RawMessage) (*MessageSourceForumTopicHistory, error) { + var resp MessageSourceForumTopicHistory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSourceHistoryPreview(data json.RawMessage) (*MessageSourceHistoryPreview, error) { + var resp MessageSourceHistoryPreview + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSourceChatList(data json.RawMessage) (*MessageSourceChatList, error) { + var resp MessageSourceChatList + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSourceSearch(data json.RawMessage) (*MessageSourceSearch, error) { + var resp MessageSourceSearch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSourceChatEventLog(data json.RawMessage) (*MessageSourceChatEventLog, error) { + var resp MessageSourceChatEventLog + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSourceNotification(data json.RawMessage) (*MessageSourceNotification, error) { + var resp MessageSourceNotification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSourceOther(data json.RawMessage) (*MessageSourceOther, error) { + var resp MessageSourceOther + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSponsoredMessage(data json.RawMessage) (*SponsoredMessage, error) { var resp SponsoredMessage @@ -7642,6 +7833,14 @@ func UnmarshalLoginUrlInfoRequestConfirmation(data json.RawMessage) (*LoginUrlIn return &resp, err } +func UnmarshalFoundWebApp(data json.RawMessage) (*FoundWebApp, error) { + var resp FoundWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalWebAppInfo(data json.RawMessage) (*WebAppInfo, error) { var resp WebAppInfo @@ -10842,6 +11041,30 @@ func UnmarshalInlineQueryResultVoiceNote(data json.RawMessage) (*InlineQueryResu return &resp, err } +func UnmarshalInlineQueryResultsButtonTypeStartBot(data json.RawMessage) (*InlineQueryResultsButtonTypeStartBot, error) { + var resp InlineQueryResultsButtonTypeStartBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultsButtonTypeWebApp(data json.RawMessage) (*InlineQueryResultsButtonTypeWebApp, error) { + var resp InlineQueryResultsButtonTypeWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultsButton(data json.RawMessage) (*InlineQueryResultsButton, error) { + var resp InlineQueryResultsButton + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInlineQueryResults(data json.RawMessage) (*InlineQueryResults, error) { var resp InlineQueryResults @@ -12866,6 +13089,14 @@ func UnmarshalInternalLinkTypeBackground(data json.RawMessage) (*InternalLinkTyp return &resp, err } +func UnmarshalInternalLinkTypeBotAddToChannel(data json.RawMessage) (*InternalLinkTypeBotAddToChannel, error) { + var resp InternalLinkTypeBotAddToChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeBotStart(data json.RawMessage) (*InternalLinkTypeBotStart, error) { var resp InternalLinkTypeBotStart @@ -12882,14 +13113,6 @@ func UnmarshalInternalLinkTypeBotStartInGroup(data json.RawMessage) (*InternalLi return &resp, err } -func UnmarshalInternalLinkTypeBotAddToChannel(data json.RawMessage) (*InternalLinkTypeBotAddToChannel, error) { - var resp InternalLinkTypeBotAddToChannel - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalInternalLinkTypeChangePhoneNumber(data json.RawMessage) (*InternalLinkTypeChangePhoneNumber, error) { var resp InternalLinkTypeChangePhoneNumber @@ -13122,6 +13345,14 @@ func UnmarshalInternalLinkTypeVideoChat(data json.RawMessage) (*InternalLinkType return &resp, err } +func UnmarshalInternalLinkTypeWebApp(data json.RawMessage) (*InternalLinkTypeWebApp, error) { + var resp InternalLinkTypeWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageLink(data json.RawMessage) (*MessageLink, error) { var resp MessageLink @@ -14698,6 +14929,14 @@ func UnmarshalUpdateSuggestedActions(data json.RawMessage) (*UpdateSuggestedActi return &resp, err } +func UnmarshalUpdateAddChatMembersPrivacyForbidden(data json.RawMessage) (*UpdateAddChatMembersPrivacyForbidden, error) { + var resp UpdateAddChatMembersPrivacyForbidden + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateAutosaveSettings(data json.RawMessage) (*UpdateAutosaveSettings, error) { var resp UpdateAutosaveSettings @@ -15169,6 +15408,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGame: return UnmarshalGame(data) + case TypeWebApp: + return UnmarshalWebApp(data) + case TypePoll: return UnmarshalPoll(data) @@ -15409,6 +15651,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatMessageSenders: return UnmarshalChatMessageSenders(data) + case TypeMessageViewer: + return UnmarshalMessageViewer(data) + + case TypeMessageViewers: + return UnmarshalMessageViewers(data) + case TypeMessageForwardOriginUser: return UnmarshalMessageForwardOriginUser(data) @@ -15475,6 +15723,33 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageCalendar: return UnmarshalMessageCalendar(data) + case TypeMessageSourceChatHistory: + return UnmarshalMessageSourceChatHistory(data) + + case TypeMessageSourceMessageThreadHistory: + return UnmarshalMessageSourceMessageThreadHistory(data) + + case TypeMessageSourceForumTopicHistory: + return UnmarshalMessageSourceForumTopicHistory(data) + + case TypeMessageSourceHistoryPreview: + return UnmarshalMessageSourceHistoryPreview(data) + + case TypeMessageSourceChatList: + return UnmarshalMessageSourceChatList(data) + + case TypeMessageSourceSearch: + return UnmarshalMessageSourceSearch(data) + + case TypeMessageSourceChatEventLog: + return UnmarshalMessageSourceChatEventLog(data) + + case TypeMessageSourceNotification: + return UnmarshalMessageSourceNotification(data) + + case TypeMessageSourceOther: + return UnmarshalMessageSourceOther(data) + case TypeSponsoredMessage: return UnmarshalSponsoredMessage(data) @@ -15673,6 +15948,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLoginUrlInfoRequestConfirmation: return UnmarshalLoginUrlInfoRequestConfirmation(data) + case TypeFoundWebApp: + return UnmarshalFoundWebApp(data) + case TypeWebAppInfo: return UnmarshalWebAppInfo(data) @@ -16873,6 +17151,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInlineQueryResultVoiceNote: return UnmarshalInlineQueryResultVoiceNote(data) + case TypeInlineQueryResultsButtonTypeStartBot: + return UnmarshalInlineQueryResultsButtonTypeStartBot(data) + + case TypeInlineQueryResultsButtonTypeWebApp: + return UnmarshalInlineQueryResultsButtonTypeWebApp(data) + + case TypeInlineQueryResultsButton: + return UnmarshalInlineQueryResultsButton(data) + case TypeInlineQueryResults: return UnmarshalInlineQueryResults(data) @@ -17632,15 +17919,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeBackground: return UnmarshalInternalLinkTypeBackground(data) + case TypeInternalLinkTypeBotAddToChannel: + return UnmarshalInternalLinkTypeBotAddToChannel(data) + case TypeInternalLinkTypeBotStart: return UnmarshalInternalLinkTypeBotStart(data) case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(data) - case TypeInternalLinkTypeBotAddToChannel: - return UnmarshalInternalLinkTypeBotAddToChannel(data) - case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) @@ -17728,6 +18015,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeVideoChat: return UnmarshalInternalLinkTypeVideoChat(data) + case TypeInternalLinkTypeWebApp: + return UnmarshalInternalLinkTypeWebApp(data) + case TypeMessageLink: return UnmarshalMessageLink(data) @@ -18319,6 +18609,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(data) + case TypeUpdateAddChatMembersPrivacyForbidden: + return UnmarshalUpdateAddChatMembersPrivacyForbidden(data) + case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(data) diff --git a/data/td_api.tl b/data/td_api.tl index eaf4903..f637859 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -135,8 +135,9 @@ authorizationStateWaitRegistration terms_of_service:termsOfService = Authorizati //-Call checkAuthenticationPassword to provide the password, or requestAuthenticationPasswordRecovery to recover the password, or deleteAccount to delete the account after a week //@password_hint Hint for the password; may be empty //@has_recovery_email_address True, if a recovery email address has been set up +//@has_passport_data True, if some Telegram Passport elements were saved //@recovery_email_address_pattern Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent -authorizationStateWaitPassword password_hint:string has_recovery_email_address:Bool recovery_email_address_pattern:string = AuthorizationState; +authorizationStateWaitPassword password_hint:string has_recovery_email_address:Bool has_passport_data:Bool recovery_email_address_pattern:string = AuthorizationState; //@description The user has been successfully authorized. TDLib is now ready to answer general requests authorizationStateReady = AuthorizationState; @@ -322,8 +323,7 @@ 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. -//-The sticker must not be repainted on chat photos +//@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, white color on chat photos, or another appropriate color in other places stickerFullTypeCustomEmoji custom_emoji_id:int64 needs_repainting:Bool = StickerFullType; @@ -464,9 +464,9 @@ location latitude:double longitude:double horizontal_accuracy:double = Location; //@type Type of the venue in the provider database; as defined by the sender venue location:location title:string address:string provider:string id:string type:string = Venue; -//@description Describes a game +//@description Describes a game. Use getInternalLink with internalLinkTypeGame to share the game //@id Unique game identifier -//@short_name Game short name. To share a game use the URL https://t.me/{bot_username}?game={game_short_name} +//@short_name Game short name //@title Game title //@text Game text, usually containing scoreboards for a game //@param_description Game description @@ -474,6 +474,14 @@ venue location:location title:string address:string provider:string id:string ty //@animation Game animation; may be null game id:int64 short_name:string title:string text:formattedText description:string photo:photo animation:animation = Game; +//@description Describes a Web App. Use getInternalLink with internalLinkTypeWebApp to share the Web App +//@short_name Web App short name +//@title Web App title +//@param_description Web App description +//@photo Web App photo +//@animation Web App animation; may be null +webApp short_name:string title:string description:string photo:photo animation:animation = WebApp; + //@description Describes a poll //@id Unique poll identifier //@question Poll question; 1-300 characters @@ -597,7 +605,7 @@ 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, invoices, locations, and venues +//@can_send_basic_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 @@ -614,7 +622,7 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; //@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_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; +chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_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 @@ -689,7 +697,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@description Contains information about a bot -//@share_text The text that is shown on the bot's profile page and is sent together with the link when users share the bot +//@short_description The text that is shown on the bot's profile page and is sent together with the link when users share the bot //@param_description The text shown in the chat with the bot if the chat is empty //@photo Photo shown in the chat with the bot if the chat is empty; may be null //@animation Animation shown in the chat with the bot if the chat is empty; may be null @@ -697,7 +705,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string usernames:use //@commands List of the bot commands //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null -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; +botInfo short_description: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, it is unknown. @@ -1000,6 +1008,13 @@ chatMessageSender sender:MessageSender needs_premium:Bool = ChatMessageSender; chatMessageSenders senders:vector = ChatMessageSenders; +//@description Represents a viewer of a message @user_id User identifier of the viewer @view_date Approximate point in time (Unix timestamp) when the message was viewed +messageViewer user_id:int53 view_date:int32 = MessageViewer; + +//@description Represents a list of message viewers @viewers List of message viewers +messageViewers viewers:vector = MessageViewers; + + //@class MessageForwardOrigin @description Contains information about the origin of a forwarded message //@description The message was originally sent by a known user @sender_user_id Identifier of the user that originally sent the message @@ -1071,8 +1086,8 @@ unreadReaction type:ReactionType sender_id:MessageSender is_big:Bool = UnreadRea //@class MessageSendingState @description Contains information about the sending state of the message -//@description The message is being sent now, but has not yet been delivered to the server -messageSendingStatePending = MessageSendingState; +//@description The message is being sent now, but has not yet been delivered to the server @sending_id Non-persistent message sending identifier, specified by the application +messageSendingStatePending sending_id:int32 = MessageSendingState; //@description The message failed to be sent //@error_code An error code; 0 if unknown @@ -1147,6 +1162,36 @@ messageCalendarDay total_count:int32 message:message = MessageCalendarDay; messageCalendar total_count:int32 days:vector = MessageCalendar; +//@class MessageSource @description Describes source of a message + +//@description The message is from a chat history +messageSourceChatHistory = MessageSource; + +//@description The message is from a message thread history +messageSourceMessageThreadHistory = MessageSource; + +//@description The message is from a forum topic history +messageSourceForumTopicHistory = MessageSource; + +//@description The message is from chat, message thread or forum topic history preview +messageSourceHistoryPreview = MessageSource; + +//@description The message is from a chat list or a forum topic list +messageSourceChatList = MessageSource; + +//@description The message is from search results, including file downloads, local file list, outgoing document messages, calendar +messageSourceSearch = MessageSource; + +//@description The message is from a chat event log +messageSourceChatEventLog = MessageSource; + +//@description The message is from a notification +messageSourceNotification = MessageSource; + +//@description The message is from some other source +messageSourceOther = MessageSource; + + //@description Describes a sponsored message //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages //@is_recommended True, if the message needs to be labeled as "recommended" instead of "sponsored" @@ -1155,7 +1200,9 @@ messageCalendar total_count:int32 days:vector = MessageCalen //@show_chat_photo True, if the sponsor's chat photo must be shown //@link An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead //@content Content of the message. Currently, can be only of the type messageText -sponsoredMessage message_id:int53 is_recommended:Bool sponsor_chat_id:int53 sponsor_chat_info:chatInviteLinkInfo show_chat_photo:Bool link:InternalLinkType content:MessageContent = SponsoredMessage; +//@sponsor_info If non-empty, information about the sponsor to be shown along with the message +//@additional_info If non-empty, additional information about the sponsored message to be shown along with the message +sponsoredMessage message_id:int53 is_recommended:Bool sponsor_chat_id:int53 sponsor_chat_info:chatInviteLinkInfo show_chat_photo:Bool link:InternalLinkType content:MessageContent sponsor_info:string additional_info:string = SponsoredMessage; //@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; @@ -1508,17 +1555,23 @@ 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 -loginUrlInfoOpen url:string skip_confirm:Bool = LoginUrlInfo; +//@description An HTTP URL needs to be open @url The URL to open @skip_confirmation True, if there is no need to show an ordinary open URL confirmation +loginUrlInfoOpen url:string skip_confirmation:Bool = LoginUrlInfo; //@description An authorization confirmation dialog needs to be shown to the user //@url An HTTP URL to be opened //@domain A domain of the URL //@bot_user_id User identifier of a bot linked with the website -//@request_write_access True, if the user needs to be requested to give the permission to the bot to send them messages +//@request_write_access True, if the user must be asked for the permission to the bot to send them messages loginUrlInfoRequestConfirmation url:string domain:string bot_user_id:int53 request_write_access:Bool = LoginUrlInfo; +//@description Contains information about a Web App found by its short name +//@web_app The Web App +//@request_write_access True, if the user must be asked for the permission to the bot to send them messages +//@skip_confirmation True, if there is no need to show an ordinary open URL confirmation before opening the Web App. The field must be ignored and confirmation must be shown anyway if the Web App link was hidden +foundWebApp web_app:webApp request_write_access:Bool skip_confirmation:Bool = FoundWebApp; + //@description Contains information about a Web App @launch_id Unique identifier for the Web App launch @url A Web App URL to open in a web view webAppInfo launch_id:int64 url:string = WebAppInfo; @@ -2396,13 +2449,13 @@ messageGame game:game = MessageContent; //@description A message with a poll @poll The poll description messagePoll poll:poll = MessageContent; -//@description A message with an invoice from a bot +//@description A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice //@title Product title //@param_description Product description //@photo Product photo; may be null //@currency Currency for the product price //@total_amount Product total price in the smallest units of the currency -//@start_parameter Unique invoice bot start_parameter. To share an invoice use the URL https://t.me/{bot_username}?start={start_parameter} +//@start_parameter Unique invoice bot start_parameter to be passed to getInternalLink //@is_test True, if the invoice is a test invoice //@need_shipping_address True, if the shipping address must be specified //@receipt_message_id The identifier of the message with the receipt, after the product has been purchased @@ -2534,8 +2587,8 @@ 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; -//@description The user allowed the bot to send messages -messageBotWriteAccessAllowed = MessageContent; +//@description The user allowed the bot to send messages @web_app Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu +messageBotWriteAccessAllowed web_app:webApp = MessageContent; //@description Data from a Web App has been sent to a bot @button_text Text of the keyboardButtonTypeWebApp button, which opened the Web App messageWebAppDataSent button_text:string = MessageContent; @@ -2641,7 +2694,8 @@ messageSchedulingStateSendWhenOnline = MessageSchedulingState; //@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum //@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState = MessageSendOptions; +//@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates +messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState sending_id:int32 = MessageSendOptions; //@description Options to be used when a message content is copied without reference to the original sender. Service messages and messageInvoice can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local @@ -2953,9 +3007,9 @@ trendingStickerSets total_count:int32 sets:vector is_premium:Boo //@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 +//@icon Custom emoji sticker, which represents icon of the category //@emojis List of emojis in the category -emojiCategory name:string icon_custom_emoji_id:int64 emojis:vector = EmojiCategory; +emojiCategory name:string icon:sticker emojis:vector = EmojiCategory; //@description Represents a list of emoji categories @categories List of categories emojiCategories categories:vector = EmojiCategories; @@ -3201,8 +3255,8 @@ firebaseAuthenticationSettingsIos device_token:string is_app_sandbox:Bool = Fire 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 -addedReaction type:ReactionType sender_id:MessageSender = AddedReaction; +//@description Represents a reaction applied to a message @type Type of the reaction @sender_id Identifier of the chat member, applied the reaction @date Point in time (Unix timestamp) when the reaction was added +addedReaction type:ReactionType sender_id:MessageSender date:int32 = AddedReaction; //@description Represents a list of reactions added to a message @total_count The total number of found reactions @reactions The list of added reactions @next_offset The offset for the next request. If empty, there are no more results addedReactions total_count:int32 reactions:vector next_offset:string = AddedReactions; @@ -3278,7 +3332,7 @@ attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotCol //@supports_group_chats True, if the bot supports opening from attachment menu in basic group and supergroup chats //@supports_channel_chats True, if the bot supports opening from attachment menu in channel chats //@supports_settings True, if the bot supports "settings_button_pressed" event -//@request_write_access True, if the user needs to be requested to give the permission to the bot to send them messages +//@request_write_access True, if the user must be asked for the permission to the bot to send them messages //@name Name for the bot in attachment menu //@name_color Color to highlight selected name of the bot if appropriate; may be null //@default_icon Default attachment menu icon for the bot in SVG format; may be null @@ -3517,13 +3571,25 @@ inlineQueryResultVideo id:string video:video title:string description:string = I inlineQueryResultVoiceNote id:string voice_note:voiceNote title:string = InlineQueryResult; +//@class InlineQueryResultsButtonType @description Represents a type of a button in results of inline query + +//@description Describes the button that opens a private chat with the bot and sends a start message to the bot with the given parameter @parameter The parameter for the bot start message +inlineQueryResultsButtonTypeStartBot parameter:string = InlineQueryResultsButtonType; + +//@description Describes the button that opens a Web App by calling getWebAppUrl @url An HTTP URL to pass to getWebAppUrl +inlineQueryResultsButtonTypeWebApp url:string = InlineQueryResultsButtonType; + + +//@description Represents a button to be shown above inline query results @text The text of the button @type Type of the button +inlineQueryResultsButton text:string type:InlineQueryResultsButtonType = InlineQueryResultsButton; + + //@description Represents the results of the inline query. Use sendInlineQueryResultMessage to send the result of the query //@inline_query_id Unique identifier of the inline query -//@next_offset The offset for the next request. If empty, there are no more results +//@button Button to be shown above inline query results; may be null //@results Results of the query -//@switch_pm_text If non-empty, this text must be shown on the button, which opens a private chat with the bot and sends the bot a start message with the switch_pm_parameter -//@switch_pm_parameter Parameter for the bot start message -inlineQueryResults inline_query_id:int64 next_offset:string results:vector switch_pm_text:string switch_pm_parameter:string = InlineQueryResults; +//@next_offset The offset for the next request. If empty, there are no more results +inlineQueryResults inline_query_id:int64 button:inlineQueryResultsButton results:vector next_offset:string = InlineQueryResults; //@class CallbackQueryPayload @description Represents a payload of a callback query @@ -4529,6 +4595,13 @@ internalLinkTypeAuthenticationCode code:string = InternalLinkType; //@description The link is a link to a background. Call searchBackground with the given background name to process the link @background_name Name of the background internalLinkTypeBackground background_name:string = 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 +//@bot_username Username of the bot +//@administrator_rights Expected administrator rights for the bot +internalLinkTypeBotAddToChannel bot_username:string administrator_rights:chatAdministratorRights = InternalLinkType; + //@description The link is a link to a chat with a Telegram bot. Call searchPublicChat with the given bot username, check that the user is a bot, show START button in the chat with the bot, //-and then call sendBotStartMessage with the given start parameter after the button is pressed //@bot_username Username of the bot @@ -4547,13 +4620,6 @@ internalLinkTypeBotStart bot_username:string start_parameter:string autostart:Bo //@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 -//@bot_username Username of the bot -//@administrator_rights Expected administrator rights for the bot -internalLinkTypeBotAddToChannel bot_username:string administrator_rights:chatAdministratorRights = InternalLinkType; - //@description The link is a link to the change phone number section of the app internalLinkTypeChangePhoneNumber = InternalLinkType; @@ -4608,7 +4674,7 @@ internalLinkTypePassportDataRequest bot_user_id:int53 scope:string public_key:st //@phone_number Phone number value from the link internalLinkTypePhoneNumberConfirmation hash:string phone_number:string = InternalLinkType; -//@description The link is a link to the Premium features screen of the applcation from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link @referrer Referrer specified in the link +//@description The link is a link to the Premium features screen of the application from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link @referrer Referrer specified in the link internalLinkTypePremiumFeatures referrer:string = InternalLinkType; //@description The link is a link to the privacy and security section of the app settings @@ -4662,6 +4728,13 @@ internalLinkTypeUserToken token:string = InternalLinkType; //@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group internalLinkTypeVideoChat chat_username:string invite_hash:string is_live_stream:Bool = InternalLinkType; +//@description The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. +//-Process received foundWebApp by showing a confirmation dialog if needed, then calling getWebAppLinkUrl and opening the returned URL +//@bot_username Username of the bot that owns the Web App +//@web_app_short_name Short name of the Web App +//@start_parameter Start parameter to be passed to getWebAppLinkUrl +internalLinkTypeWebApp bot_username:string web_app_short_name:string start_parameter:string = InternalLinkType; + //@description Contains an HTTPS link to a message in a supergroup or channel, or a forum topic @link The link @is_public True, if the link will work for non-members of the chat messageLink link:string is_public:Bool = MessageLink; @@ -5000,12 +5073,12 @@ proxies proxies:vector = Proxies; //@description A sticker to be added to a sticker set -//@sticker File with the sticker; must fit in a 512x512 square. For WEBP stickers and masks the file must be in PNG format, which will be converted to WEBP server-side. -//-Otherwise, the file must be local or uploaded within a week. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements -//@emojis Emojis corresponding to the sticker -//@format Sticker format +//@sticker File with the sticker; must fit in a 512x512 square. For WEBP stickers the file must be in WEBP or PNG format, which will be converted to WEBP server-side. +//-See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements +//@emojis String with 1-20 emoji corresponding to the sticker //@mask_position Position where the mask is placed; pass null if not specified -inputSticker sticker:InputFile emojis:string format:StickerFormat mask_position:maskPosition = InputSticker; +//@keywords List of up to 20 keywords with total length up to 64 characters, which can be used to find the sticker +inputSticker sticker:InputFile emojis:string mask_position:maskPosition keywords:vector = InputSticker; //@description Represents a date range @start_date Point in time (Unix timestamp) at which the date range begins @end_date Point in time (Unix timestamp) at which the date range ends @@ -5493,6 +5566,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 Adding users to a chat has failed because of their privacy settings. An invite link can be shared with the users if appropriate @chat_id Chat identifier @user_ids Identifiers of users, which weren't added because of their privacy settings +updateAddChatMembersPrivacyForbidden chat_id:int53 user_ids: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; @@ -5836,7 +5912,7 @@ getMessageThread chat_id:int53 message_id:int53 = MessageThreadInfo; //@description Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if message.can_get_viewers == true //@chat_id Chat identifier //@message_id Identifier of the message -getMessageViewers chat_id:int53 message_id:int53 = Users; +getMessageViewers chat_id:int53 message_id:int53 = MessageViewers; //@description Returns information about a file; this is an offline request @file_id Identifier of the file to get getFile file_id:int32 = File; @@ -6075,7 +6151,7 @@ getMessageLinkInfo url:string = MessageLinkInfo; //@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 -//@to_language_code ISO language code of the language to which the message is translated. Must be one of +//@to_language_code 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", @@ -6085,7 +6161,7 @@ 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 +//@to_language_code 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", @@ -6472,17 +6548,31 @@ getInlineQueryResults bot_user_id:int53 chat_id:int53 user_location:location que //@description Sets the result of an inline query; for bots only //@inline_query_id Identifier of the inline query //@is_personal Pass true if results may be cached and returned only for the user that sent the query. By default, results may be returned to any user who sends the same query +//@button Button to be shown above inline query results; pass null if none //@results The results of the query //@cache_time Allowed time to cache the results of the query, in seconds //@next_offset Offset for the next inline query; pass an empty string if there are no more results -//@switch_pm_text If non-empty, this text must be shown on the button that opens a private chat with the bot and sends a start message to the bot with the parameter switch_pm_parameter -//@switch_pm_parameter The parameter for the bot start message -answerInlineQuery inline_query_id:int64 is_personal:Bool results:vector cache_time:int32 next_offset:string switch_pm_text:string switch_pm_parameter:string = Ok; +answerInlineQuery inline_query_id:int64 is_personal:Bool button:inlineQueryResultsButton results:vector cache_time:int32 next_offset:string = Ok; -//@description Returns an HTTPS URL of a Web App to open after keyboardButtonTypeWebApp button is pressed +//@description Returns information about a Web App by its short name. Returns a 404 error if the Web App is not found //@bot_user_id Identifier of the target bot -//@url The URL from the keyboardButtonTypeWebApp button +//@web_app_short_name Short name of the Web App +searchWebApp bot_user_id:int53 web_app_short_name:string = FoundWebApp; + +//@description Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked +//@chat_id Identifier of the chat in which the link was clicked; pass 0 if none +//@bot_user_id Identifier of the target bot +//@web_app_short_name Short name of the Web App +//@start_parameter Start parameter from internalLinkTypeWebApp +//@theme Preferred Web App theme; pass null to use the default theme +//@application_name Short name of the application; 0-64 English letters, digits, and underscores +//@allow_write_access Pass true if the current user allowed the bot to send them messages +getWebAppLinkUrl chat_id:int53 bot_user_id:int53 web_app_short_name:string start_parameter:string theme:themeParameters application_name:string allow_write_access:Bool = HttpUrl; + +//@description Returns an HTTPS URL of a Web App to open after keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button is pressed +//@bot_user_id Identifier of the target bot +//@url The URL from the keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button //@theme Preferred Web App theme; pass null to use the default theme //@application_name Short name of the application; 0-64 English letters, digits, and underscores getWebAppUrl bot_user_id:int53 url:string theme:themeParameters application_name:string = HttpUrl; @@ -6578,10 +6668,10 @@ closeChat chat_id:int53 = Ok; //@description Informs TDLib that messages are being viewed by the user. Sponsored messages must be marked as viewed only when the entire text of the message is shown on the screen (excluding the button). //-Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels) //@chat_id Chat identifier -//@message_thread_id If not 0, a message thread identifier in which the messages are being viewed //@message_ids The identifiers of the messages being viewed -//@force_read Pass true to mark as read the specified messages even the chat is closed -viewMessages chat_id:int53 message_thread_id:int53 message_ids:vector force_read:Bool = Ok; +//@source Source of the message view +//@force_read Pass true to mark as read the specified messages even the chat is closed; pass null to guess the source based on chat open state +viewMessages chat_id:int53 message_ids:vector source:MessageSource force_read:Bool = Ok; //@description Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). //-An updateMessageContentOpened update will be generated if something has changed @@ -6592,6 +6682,9 @@ openMessageContent chat_id:int53 message_id:int53 = Ok; //@description Informs TDLib that a message with an animated emoji was clicked by the user. Returns a big animated sticker to be played or a 404 error if usual animation needs to be played @chat_id Chat identifier of the message @message_id Identifier of the clicked message clickAnimatedEmojiMessage chat_id:int53 message_id:int53 = Sticker; +//@description Returns an HTTPS or a tg: link with the given type. Can be called before authorization @type Expected type of the link @is_http Pass true to create an HTTPS link (only available for some link types); pass false to create a tg: link +getInternalLink type:InternalLinkType is_http:Bool = HttpUrl; + //@description Returns information about the type of an internal link. Returns a 404 error if the link is not internal. Can be called before authorization @link The link getInternalLinkType link:string = InternalLinkType; @@ -6630,7 +6723,7 @@ createSupergroupChat supergroup_id:int53 force:Bool = Chat; createSecretChat secret_chat_id:int32 = Chat; //@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat -//@user_ids Identifiers of users to be added to the basic group +//@user_ids Identifiers of users to be added to the basic group; may be empty to create a basic group without other members //@title Title of the new basic group; 1-128 characters //@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 createNewBasicGroupChat user_ids:vector title:string message_auto_delete_time:int32 = Chat; @@ -7518,6 +7611,25 @@ setDefaultGroupAdministratorRights default_group_administrator_rights:chatAdmini setDefaultChannelAdministratorRights default_channel_administrator_rights:chatAdministratorRights = Ok; +//@description Sets the text shown in the chat with the bot if the chat is empty; bots only +//@language_code A two-letter ISO 639-1 language code. If empty, the description will be shown to all users, for which language there are no dedicated description +//@param_description New bot's description on the specified language +setBotInfoDescription language_code:string description:string = Ok; + +//@description Returns the text shown in the chat with the bot if the chat is empty in the given language; bots only +//@language_code A two-letter ISO 639-1 language code or an empty string +getBotInfoDescription language_code:string = Text; + +//@description Sets the text shown on the bot's profile page and sent together with the link when users share the bot; bots only +//@language_code A two-letter ISO 639-1 language code. If empty, the short description will be shown to all users, for which language there are no dedicated description +//@short_description New bot's short description on the specified language +setBotInfoShortDescription language_code:string short_description:string = Ok; + +//@description Returns the text shown on the bot's profile page and sent together with the link when users share the bot in the given language; bots only +//@language_code A two-letter ISO 639-1 language code or an empty string +getBotInfoShortDescription language_code:string = Text; + + //@description Returns all active sessions of the current user getActiveSessions = Sessions; @@ -7703,7 +7815,7 @@ getLanguagePackStrings language_pack_id:string keys:vector = LanguagePac //@description Fetches the latest versions of all strings from a language pack in the current localization target from the server. This method doesn't need to be called explicitly for the current used/base language packs. Can be called before authorization @language_pack_id Language pack identifier synchronizeLanguagePack language_pack_id:string = Ok; -//@description Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization @language_pack_id Identifier of a language pack to be added; may be different from a name that is used in an "https://t.me/setlanguage/" link +//@description Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization @language_pack_id Identifier of a language pack to be added addCustomServerLanguagePack language_pack_id:string = Ok; //@description Adds or changes a custom local language pack to the current localization target @@ -7855,10 +7967,10 @@ setAutoDownloadSettings settings:autoDownloadSettings type:NetworkType = Ok; //@description Returns autosave settings for the current user getAutosaveSettings = AutosaveSettings; -//@description Sets autosave settings for the given scope @scope Autosave settings scope @settings New autosave settings for the scope; pass null to set autosave settings to default +//@description Sets autosave settings for the given scope. The method is guaranteed to work only after at least one call to getAutosaveSettings @scope Autosave settings scope @settings New autosave settings for the scope; pass null to set autosave settings to default setAutosaveSettings scope:AutosaveSettingsScope settings:scopeAutosaveSettings = Ok; -//@description Clears the list of all autosave settings exceptions +//@description Clears the list of all autosave settings exceptions. The method is guaranteed to work only after at least one call to getAutosaveSettings clearAutosaveSettingsExceptions = Ok; @@ -7945,8 +8057,12 @@ checkPhoneNumberConfirmationCode code:string = Ok; setBotUpdatesStatus pending_update_count:int32 error_message:string = Ok; -//@description Uploads a file with a sticker; returns the uploaded file @user_id Sticker file owner; ignored for regular users @sticker Sticker file to upload -uploadStickerFile user_id:int53 sticker:inputSticker = File; +//@description Uploads a file with a sticker; returns the uploaded file +//@user_id Sticker file owner; ignored for regular users +//@sticker_format Sticker format +//@sticker File file to upload; must fit in a 512x512 square. For WEBP stickers the file must be in WEBP or PNG format, which will be converted to WEBP server-side. +//-See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements +uploadStickerFile user_id:int53 sticker_format:StickerFormat sticker:InputFile = File; //@description Returns a suggested name for a new sticker set with a given title @title Sticker set title; 1-64 characters getSuggestedStickerSetName title:string = Text; @@ -7958,22 +8074,36 @@ checkStickerSetName name:string = CheckStickerSetNameResult; //@user_id Sticker set owner; ignored for regular users //@title Sticker set title; 1-64 characters //@name Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive) for bots; 1-64 characters +//@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set +//@needs_repainting Pass true if stickers in the sticker set must be repainted; for custom emoji sticker sets only //@stickers List of stickers to be added to the set; must be non-empty. All stickers must have the same format. For TGS stickers, uploadStickerFile must be used before the sticker is shown //@source Source of the sticker set; may be empty if unknown -createNewStickerSet user_id:int53 title:string name:string sticker_type:StickerType stickers:vector source:string = StickerSet; +createNewStickerSet user_id:int53 title:string name:string sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool stickers:vector source:string = StickerSet; -//@description Adds a new sticker to a set; for bots only. Returns the sticker set + +//@description Adds a new sticker to a set; for bots only //@user_id Sticker set owner //@name Sticker set name //@sticker Sticker to add to the set -addStickerToSet user_id:int53 name:string sticker:inputSticker = StickerSet; +addStickerToSet user_id:int53 name:string sticker:inputSticker = Ok; -//@description Sets a sticker set thumbnail; for bots only. Returns the sticker set +//@description Sets a sticker set thumbnail; for bots only //@user_id Sticker set owner //@name Sticker set name //@thumbnail Thumbnail to set in PNG, TGS, or WEBM format; pass null to remove the sticker set thumbnail. Thumbnail format must match the format of stickers in the set -setStickerSetThumbnail user_id:int53 name:string thumbnail:InputFile = StickerSet; +setStickerSetThumbnail user_id:int53 name:string thumbnail:InputFile = Ok; + +//@description Sets a custom emoji sticker set thumbnail; for bots only +//@name Sticker set name +//@custom_emoji_id Identifier of the custom emoji from the sticker set, which will be set as sticker set thumbnail; pass 0 to remove the sticker set thumbnail +setCustomEmojiStickerSetThumbnail name:string custom_emoji_id:int64 = Ok; + +//@description Sets a sticker set title; for bots only @name Sticker set name @title New sticker set title +setStickerSetTitle name:string title:string = Ok; + +//@description Deleted a sticker set; for bots only @name Sticker set name +deleteStickerSet name:string = Ok; //@description Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot //@sticker Sticker @@ -7983,6 +8113,21 @@ setStickerPositionInSet sticker:InputFile position:int32 = Ok; //@description Removes a sticker from the set to which it belongs; for bots only. The sticker set must have been created by the bot @sticker Sticker removeStickerFromSet sticker:InputFile = Ok; +//@description Changes the list of emoji corresponding to a sticker; for bots only. The sticker must belong to a regular or custom emoji sticker set created by the bot +//@sticker Sticker +//@emojis New string with 1-20 emoji corresponding to the sticker +setStickerEmojis sticker:InputFile emojis:string = Ok; + +//@description Changes the list of keywords of a sticker; for bots only. The sticker must belong to a regular or custom emoji sticker set created by the bot +//@sticker Sticker +//@keywords List of up to 20 keywords with total length up to 64 characters, which can be used to find the sticker +setStickerKeywords sticker:InputFile keywords:vector = Ok; + +//@description Changes the mask position of a mask sticker; for bots only. The sticker must belong to a mask sticker set created by the bot +//@sticker Sticker +//@mask_position Position where the mask is placed; pass null to remove mask position +setStickerMaskPosition sticker:InputFile mask_position:maskPosition = Ok; + //@description Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded //@location Location of the map center @@ -8055,8 +8200,6 @@ getPhoneNumberInfo phone_number_prefix:string = PhoneNumberInfo; //@phone_number_prefix The phone number prefix getPhoneNumberInfoSync language_code:string phone_number_prefix:string = PhoneNumberInfo; -//@description Returns the link for downloading official Telegram application to be used when the current user invites friends to Telegram -getApplicationDownloadLink = HttpUrl; //@description Returns information about a tg:// deep link. Use "tg://need_update_for_some_feature" or "tg:some_unsupported_feature" for testing. Returns a 404 error for unknown links. Can be called before authorization @link The link getDeepLinkInfo link:string = DeepLinkInfo; @@ -8065,9 +8208,15 @@ getDeepLinkInfo link:string = DeepLinkInfo; //@description Returns application config, provided by the server. Can be called before authorization getApplicationConfig = JsonValue; +//@description Adds server-provided application changelog as messages to the chat 777000 (Telegram); for official applications only @previous_application_version The previous application version +addApplicationChangelog previous_application_version:string = Ok; + //@description Saves application log event on the server. Can be called before authorization @type Event type @chat_id Optional chat identifier, associated with the event @data The log event data saveApplicationLogEvent type:string chat_id:int53 data:JsonValue = Ok; +//@description Returns the link for downloading official Telegram application to be used when the current user invites friends to Telegram +getApplicationDownloadLink = HttpUrl; + //@description Adds a proxy server for network requests. Can be called before authorization //@server Proxy server IP address