From af2b93f686a66f9c538752e6df359177d620f162 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Sat, 16 Sep 2023 15:09:40 +0800 Subject: [PATCH] Update to TDLib 1.8.18 --- client/function.go | 215 ++++++++++++++++++++-- client/type.go | 414 ++++++++++++++++++++++++++++++++++++------ client/unmarshaler.go | 188 ++++++++++++++++++- data/td_api.tl | 200 ++++++++++++++------ 4 files changed, 888 insertions(+), 129 deletions(-) diff --git a/client/function.go b/client/function.go index ff812ee..883efd3 100755 --- a/client/function.go +++ b/client/function.go @@ -1513,7 +1513,7 @@ type GetRemoteFileRequest struct { FileType FileType `json:"file_type"` } -// Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +// Returns information about a file by its remote identifier; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application func (client *Client) GetRemoteFile(req *GetRemoteFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -1914,7 +1914,7 @@ func (client *Client) GetRecentlyOpenedChats(req *GetRecentlyOpenedChatsRequest) } type CheckChatUsernameRequest struct { - // Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if the chat is being created + // Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or 0 if the chat is being created ChatId int64 `json:"chat_id"` // Username to be checked Username string `json:"username"` @@ -5282,7 +5282,7 @@ func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, type GetWebAppUrlRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` - // The URL from the keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button + // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, an internalLinkTypeSideMenuBot link, or an empty when the bot is opened from the side menu Url string `json:"url"` // Preferred Web App theme; pass null to use the default theme Theme *ThemeParameters `json:"theme"` @@ -5290,7 +5290,7 @@ type GetWebAppUrlRequest struct { ApplicationName string `json:"application_name"` } -// Returns an HTTPS URL of a Web App to open after keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button is pressed +// Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, an inlineQueryResultsButtonTypeWebApp button, or an internalLinkTypeSideMenuBot link func (client *Client) GetWebAppUrl(req *GetWebAppUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -5351,7 +5351,7 @@ type OpenWebAppRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the bot, providing the Web App BotUserId int64 `json:"bot_user_id"` - // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, or an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise + // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise Url string `json:"url"` // Preferred Web App theme; pass null to use the default theme Theme *ThemeParameters `json:"theme"` @@ -5363,7 +5363,7 @@ type OpenWebAppRequest struct { ReplyTo MessageReplyTo `json:"reply_to"` } -// Informs TDLib that a Web App is being opened from attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. For each bot, a confirmation alert about data sent to the bot must be shown once +// Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. For each bot, a confirmation alert about data sent to the bot must be shown once func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -6062,6 +6062,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(result.Data) + case TypeInternalLinkTypeSideMenuBot: + return UnmarshalInternalLinkTypeSideMenuBot(result.Data) + case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(result.Data) @@ -9022,7 +9025,7 @@ type GetAttachmentMenuBotRequest struct { BotUserId int64 `json:"bot_user_id"` } -// Returns information about a bot that can be added to attachment menu +// Returns information about a bot that can be added to attachment or side menu func (client *Client) GetAttachmentMenuBot(req *GetAttachmentMenuBotRequest) (*AttachmentMenuBot, error) { result, err := client.Send(Request{ meta: meta{ @@ -9052,7 +9055,7 @@ type ToggleBotIsAddedToAttachmentMenuRequest struct { AllowWriteAccess bool `json:"allow_write_access"` } -// Adds or removes a bot to attachment menu. Bot can be added to attachment menu, only if userTypeBot.can_be_added_to_attachment_menu == true +// Adds or removes a bot to attachment and side menu. Bot can be added to the menu, only if userTypeBot.can_be_added_to_attachment_menu == true func (client *Client) ToggleBotIsAddedToAttachmentMenu(req *ToggleBotIsAddedToAttachmentMenuRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11867,6 +11870,41 @@ func (client *Client) GetStickers(req *GetStickersRequest) (*Stickers, error) { return UnmarshalStickers(result.Data) } +type GetAllStickerEmojisRequest struct { + // Type of the stickers to search for + StickerType StickerType `json:"sticker_type"` + // Search query + Query string `json:"query"` + // Chat identifier for which to find stickers + ChatId int64 `json:"chat_id"` + // Pass true if only main emoji for each found sticker must be included in the result + ReturnOnlyMainEmoji bool `json:"return_only_main_emoji"` +} + +// Returns unique emoji that correspond to stickers to be found by the getStickers(sticker_type, query, 1000000, chat_id) +func (client *Client) GetAllStickerEmojis(req *GetAllStickerEmojisRequest) (*Emojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAllStickerEmojis", + }, + Data: map[string]interface{}{ + "sticker_type": req.StickerType, + "query": req.Query, + "chat_id": req.ChatId, + "return_only_main_emoji": req.ReturnOnlyMainEmoji, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojis(result.Data) +} + type SearchStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` @@ -13378,6 +13416,90 @@ func (client *Client) SetDefaultChannelAdministratorRights(req *SetDefaultChanne return UnmarshalOk(result.Data) } +type CanBotSendMessagesRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Checks whether the specified bot can send messages to the user. Returns a 404 error if can't and the access can be granted by call to allowBotToSendMessages +func (client *Client) CanBotSendMessages(req *CanBotSendMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canBotSendMessages", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AllowBotToSendMessagesRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Allows the specified bot to send messages to the user +func (client *Client) AllowBotToSendMessages(req *AllowBotToSendMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "allowBotToSendMessages", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendWebAppCustomRequestRequest struct { + // Identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // The method name + Method string `json:"method"` + // JSON-serialized method parameters + Parameters string `json:"parameters"` +} + +// Sends a custom request from a Web App +func (client *Client) SendWebAppCustomRequest(req *SendWebAppCustomRequestRequest) (*CustomRequestResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendWebAppCustomRequest", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "method": req.Method, + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCustomRequestResult(result.Data) +} + type SetBotNameRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` @@ -13715,6 +13837,32 @@ func (client *Client) TerminateAllOtherSessions() (*Ok, error) { return UnmarshalOk(result.Data) } +type ConfirmSessionRequest struct { + // Session identifier + SessionId JsonInt64 `json:"session_id"` +} + +// Confirms an unconfirmed session of the current user from another device +func (client *Client) ConfirmSession(req *ConfirmSessionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "confirmSession", + }, + Data: map[string]interface{}{ + "session_id": req.SessionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSessionCanAcceptCallsRequest struct { // Session identifier SessionId JsonInt64 `json:"session_id"` @@ -14922,7 +15070,7 @@ func (client *Client) AddCustomServerLanguagePack(req *AddCustomServerLanguagePa } type SetCustomLanguagePackRequest struct { - // Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization + // Information about the language pack. Language pack identifier must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization Info *LanguagePackInfo `json:"info"` // Strings of the new language pack Strings []*LanguagePackString `json:"strings"` @@ -17304,6 +17452,46 @@ func (client *Client) AcceptTermsOfService(req *AcceptTermsOfServiceRequest) (*O return UnmarshalOk(result.Data) } +type SearchStringsByPrefixRequest struct { + // The strings to search in for the query + Strings []string `json:"strings"` + // Query to search for + Query string `json:"query"` + // The maximum number of objects to return + Limit int32 `json:"limit"` + // Pass true to receive no results for an empty query + ReturnNoneForEmptyQuery bool `json:"return_none_for_empty_query"` +} + +// Searches specified query by word prefixes in the provided strings. Returns 0-based positions of strings that matched. Can be called synchronously +func SearchStringsByPrefix(req *SearchStringsByPrefixRequest) (*FoundPositions, error) { + result, err := Execute(Request{ + meta: meta{ + Type: "searchStringsByPrefix", + }, + Data: map[string]interface{}{ + "strings": req.Strings, + "query": req.Query, + "limit": req.Limit, + "return_none_for_empty_query": req.ReturnNoneForEmptyQuery, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundPositions(result.Data) +} + +// deprecated +// Searches specified query by word prefixes in the provided strings. Returns 0-based positions of strings that matched. Can be called synchronously +func (client *Client) SearchStringsByPrefix(req *SearchStringsByPrefixRequest) (*FoundPositions, error) { + return SearchStringsByPrefix(req)} + type SendCustomRequestRequest struct { // The method name Method string `json:"method"` @@ -17630,7 +17818,7 @@ func (client *Client) GetApplicationDownloadLink() (*HttpUrl, error) { } type AddProxyRequest struct { - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -17667,7 +17855,7 @@ func (client *Client) AddProxy(req *AddProxyRequest) (*Proxy, error) { type EditProxyRequest struct { // Proxy identifier ProxyId int32 `json:"proxy_id"` - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -18384,7 +18572,7 @@ func (client *Client) TestNetwork() (*Ok, error) { } type TestProxyRequest struct { - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -18739,6 +18927,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateUsersNearby: return UnmarshalUpdateUsersNearby(result.Data) + case TypeUpdateUnconfirmedSession: + return UnmarshalUpdateUnconfirmedSession(result.Data) + case TypeUpdateAttachmentMenuBots: return UnmarshalUpdateAttachmentMenuBots(result.Data) diff --git a/client/type.go b/client/type.go index 3b74865..eba7be1 100755 --- a/client/type.go +++ b/client/type.go @@ -24,6 +24,7 @@ const ( ClassChatMemberStatus = "ChatMemberStatus" ClassChatMembersFilter = "ChatMembersFilter" ClassSupergroupMembersFilter = "SupergroupMembersFilter" + ClassInviteLinkChatType = "InviteLinkChatType" ClassSecretChatState = "SecretChatState" ClassMessageSender = "MessageSender" ClassMessageForwardOrigin = "MessageForwardOrigin" @@ -59,6 +60,7 @@ const ( ClassMessageContent = "MessageContent" ClassTextEntityType = "TextEntityType" ClassMessageSchedulingState = "MessageSchedulingState" + ClassMessageSelfDestructType = "MessageSelfDestructType" ClassInputMessageContent = "InputMessageContent" ClassSearchMessagesFilter = "SearchMessagesFilter" ClassChatAction = "ChatAction" @@ -376,6 +378,7 @@ const ( ClassMessageAutoDeleteTime = "MessageAutoDeleteTime" ClassSession = "Session" ClassSessions = "Sessions" + ClassUnconfirmedSession = "UnconfirmedSession" ClassConnectedWebsite = "ConnectedWebsite" ClassConnectedWebsites = "ConnectedWebsites" ClassMessageLink = "MessageLink" @@ -392,6 +395,7 @@ const ( ClassScopeAutosaveSettings = "ScopeAutosaveSettings" ClassAutosaveSettingsException = "AutosaveSettingsException" ClassAutosaveSettings = "AutosaveSettings" + ClassFoundPositions = "FoundPositions" ClassTMeUrl = "TMeUrl" ClassTMeUrls = "TMeUrls" ClassCount = "Count" @@ -575,6 +579,9 @@ const ( TypeChatInviteLinkCounts = "chatInviteLinkCounts" TypeChatInviteLinkMember = "chatInviteLinkMember" TypeChatInviteLinkMembers = "chatInviteLinkMembers" + TypeInviteLinkChatTypeBasicGroup = "inviteLinkChatTypeBasicGroup" + TypeInviteLinkChatTypeSupergroup = "inviteLinkChatTypeSupergroup" + TypeInviteLinkChatTypeChannel = "inviteLinkChatTypeChannel" TypeChatInviteLinkInfo = "chatInviteLinkInfo" TypeChatJoinRequest = "chatJoinRequest" TypeChatJoinRequests = "chatJoinRequests" @@ -957,6 +964,8 @@ const ( TypeInputThumbnail = "inputThumbnail" TypeMessageSchedulingStateSendAtDate = "messageSchedulingStateSendAtDate" TypeMessageSchedulingStateSendWhenOnline = "messageSchedulingStateSendWhenOnline" + TypeMessageSelfDestructTypeTimer = "messageSelfDestructTypeTimer" + TypeMessageSelfDestructTypeImmediately = "messageSelfDestructTypeImmediately" TypeMessageSendOptions = "messageSendOptions" TypeMessageCopyOptions = "messageCopyOptions" TypeInputMessageText = "inputMessageText" @@ -1353,7 +1362,7 @@ const ( TypeStoryPrivacySettingsEveryone = "storyPrivacySettingsEveryone" TypeStoryPrivacySettingsContacts = "storyPrivacySettingsContacts" TypeStoryPrivacySettingsCloseFriends = "storyPrivacySettingsCloseFriends" - TypeStoryPrivacySettingsSelectedContacts = "storyPrivacySettingsSelectedContacts" + TypeStoryPrivacySettingsSelectedUsers = "storyPrivacySettingsSelectedUsers" TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" @@ -1394,6 +1403,7 @@ const ( TypeSessionTypeXbox = "sessionTypeXbox" TypeSession = "session" TypeSessions = "sessions" + TypeUnconfirmedSession = "unconfirmedSession" TypeConnectedWebsite = "connectedWebsite" TypeConnectedWebsites = "connectedWebsites" TypeReportReasonSpam = "reportReasonSpam" @@ -1438,6 +1448,7 @@ const ( TypeInternalLinkTypeQrCodeAuthentication = "internalLinkTypeQrCodeAuthentication" TypeInternalLinkTypeRestorePurchases = "internalLinkTypeRestorePurchases" TypeInternalLinkTypeSettings = "internalLinkTypeSettings" + TypeInternalLinkTypeSideMenuBot = "internalLinkTypeSideMenuBot" TypeInternalLinkTypeStickerSet = "internalLinkTypeStickerSet" TypeInternalLinkTypeStory = "internalLinkTypeStory" TypeInternalLinkTypeTheme = "internalLinkTypeTheme" @@ -1506,6 +1517,7 @@ const ( TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" TypeTopChatCategoryCalls = "topChatCategoryCalls" TypeTopChatCategoryForwardChats = "topChatCategoryForwardChats" + TypeFoundPositions = "foundPositions" TypeTMeUrlTypeUser = "tMeUrlTypeUser" TypeTMeUrlTypeSupergroup = "tMeUrlTypeSupergroup" TypeTMeUrlTypeChatInvite = "tMeUrlTypeChatInvite" @@ -1650,6 +1662,7 @@ const ( TypeUpdateConnectionState = "updateConnectionState" TypeUpdateTermsOfService = "updateTermsOfService" TypeUpdateUsersNearby = "updateUsersNearby" + TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" @@ -1773,6 +1786,11 @@ type SupergroupMembersFilter interface { SupergroupMembersFilterType() string } +// Describes the type of a chat to which points an invite link +type InviteLinkChatType interface { + InviteLinkChatTypeType() string +} + // Describes the current secret chat state type SecretChatState interface { SecretChatStateType() string @@ -1948,6 +1966,11 @@ type MessageSchedulingState interface { MessageSchedulingStateType() string } +// Describes when a message will be self-destructed +type MessageSelfDestructType interface { + MessageSelfDestructTypeType() string +} + // The content of a message to send type InputMessageContent interface { InputMessageContentType() string @@ -3369,7 +3392,7 @@ func (*LocalFile) GetType() string { // Represents a remote file type RemoteFile struct { meta - // Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. If downloadFile/addFileToDownloads is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the application with the HTTP URL in the original_path and "#url#" as the conversion string. Application must generate the file by downloading it to the specified location + // Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. If the identifier starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. If downloadFile/addFileToDownloads is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the application with the HTTP URL in the original_path and "#url#" as the conversion string. Application must generate the file by downloading it to the specified location Id string `json:"id"` // Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time UniqueId string `json:"unique_id"` @@ -3430,7 +3453,7 @@ func (*File) GetType() string { return TypeFile } -// A file defined by its unique ID +// A file defined by its unique identifier type InputFileId struct { meta // Unique file identifier @@ -3457,7 +3480,7 @@ func (*InputFileId) InputFileType() string { return TypeInputFileId } -// A file defined by its remote ID. The remote ID is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +// A file defined by its remote identifier. The remote identifier is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application type InputFileRemote struct { meta // Remote file identifier @@ -5216,7 +5239,7 @@ type UserTypeBot struct { InlineQueryPlaceholder string `json:"inline_query_placeholder"` // True, if the location of the user is expected to be sent with every inline query to this bot NeedLocation bool `json:"need_location"` - // True, if the bot can be added to attachment menu + // True, if the bot can be added to attachment or side menu CanBeAddedToAttachmentMenu bool `json:"can_be_added_to_attachment_menu"` } @@ -7169,6 +7192,81 @@ func (*ChatInviteLinkMembers) GetType() string { return TypeChatInviteLinkMembers } +// The link is an invite link for a basic group +type InviteLinkChatTypeBasicGroup struct{ + meta +} + +func (entity *InviteLinkChatTypeBasicGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteLinkChatTypeBasicGroup + + return json.Marshal((*stub)(entity)) +} + +func (*InviteLinkChatTypeBasicGroup) GetClass() string { + return ClassInviteLinkChatType +} + +func (*InviteLinkChatTypeBasicGroup) GetType() string { + return TypeInviteLinkChatTypeBasicGroup +} + +func (*InviteLinkChatTypeBasicGroup) InviteLinkChatTypeType() string { + return TypeInviteLinkChatTypeBasicGroup +} + +// The link is an invite link for a supergroup +type InviteLinkChatTypeSupergroup struct{ + meta +} + +func (entity *InviteLinkChatTypeSupergroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteLinkChatTypeSupergroup + + return json.Marshal((*stub)(entity)) +} + +func (*InviteLinkChatTypeSupergroup) GetClass() string { + return ClassInviteLinkChatType +} + +func (*InviteLinkChatTypeSupergroup) GetType() string { + return TypeInviteLinkChatTypeSupergroup +} + +func (*InviteLinkChatTypeSupergroup) InviteLinkChatTypeType() string { + return TypeInviteLinkChatTypeSupergroup +} + +// The link is an invite link for a channel +type InviteLinkChatTypeChannel struct{ + meta +} + +func (entity *InviteLinkChatTypeChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteLinkChatTypeChannel + + return json.Marshal((*stub)(entity)) +} + +func (*InviteLinkChatTypeChannel) GetClass() string { + return ClassInviteLinkChatType +} + +func (*InviteLinkChatTypeChannel) GetType() string { + return TypeInviteLinkChatTypeChannel +} + +func (*InviteLinkChatTypeChannel) InviteLinkChatTypeType() string { + return TypeInviteLinkChatTypeChannel +} + // Contains information about a chat invite link type ChatInviteLinkInfo struct { meta @@ -7177,7 +7275,7 @@ type ChatInviteLinkInfo struct { // If non-zero, the amount of time for which read access to the chat will remain available, in seconds AccessibleFor int32 `json:"accessible_for"` // Type of the chat - Type ChatType `json:"type"` + Type InviteLinkChatType `json:"type"` // Title of the chat Title string `json:"title"` // Chat photo; may be null @@ -7192,6 +7290,12 @@ type ChatInviteLinkInfo struct { CreatesJoinRequest bool `json:"creates_join_request"` // True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup IsPublic bool `json:"is_public"` + // True, if the chat is verified + IsVerified bool `json:"is_verified"` + // True, if many users reported this chat as a scam + IsScam bool `json:"is_scam"` + // True, if many users reported this chat as a fake account + IsFake bool `json:"is_fake"` } func (entity *ChatInviteLinkInfo) MarshalJSON() ([]byte, error) { @@ -7222,6 +7326,9 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { MemberUserIds []int64 `json:"member_user_ids"` CreatesJoinRequest bool `json:"creates_join_request"` IsPublic bool `json:"is_public"` + IsVerified bool `json:"is_verified"` + IsScam bool `json:"is_scam"` + IsFake bool `json:"is_fake"` } err := json.Unmarshal(data, &tmp) @@ -7238,8 +7345,11 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { chatInviteLinkInfo.MemberUserIds = tmp.MemberUserIds chatInviteLinkInfo.CreatesJoinRequest = tmp.CreatesJoinRequest chatInviteLinkInfo.IsPublic = tmp.IsPublic + chatInviteLinkInfo.IsVerified = tmp.IsVerified + chatInviteLinkInfo.IsScam = tmp.IsScam + chatInviteLinkInfo.IsFake = tmp.IsFake - fieldType, _ := UnmarshalChatType(tmp.Type) + fieldType, _ := UnmarshalInviteLinkChatType(tmp.Type) chatInviteLinkInfo.Type = fieldType return nil @@ -8569,11 +8679,11 @@ type Message struct { ReplyTo MessageReplyTo `json:"reply_to"` // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs MessageThreadId int64 `json:"message_thread_id"` - // The message's self-destruct time, in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the time expires - SelfDestructTime int32 `json:"self_destruct_time"` - // Time left before the message self-destruct timer expires, in seconds. If the self-destruct timer isn't started yet, equals to the value of the self_destruct_time field + // The message's self-destruct type; may be null if none + SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` + // Time left before the message self-destruct timer expires, in seconds; 0 if self-desctruction isn't scheduled yet SelfDestructIn float64 `json:"self_destruct_in"` - // Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never. TDLib will send updateDeleteMessages or updateMessageContent once the time expires + // Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never AutoDeleteIn float64 `json:"auto_delete_in"` // If non-zero, the user identifier of the bot through which this message was sent ViaBotUserId int64 `json:"via_bot_user_id"` @@ -8636,7 +8746,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { UnreadReactions []*UnreadReaction `json:"unread_reactions"` ReplyTo json.RawMessage `json:"reply_to"` MessageThreadId int64 `json:"message_thread_id"` - SelfDestructTime int32 `json:"self_destruct_time"` + SelfDestructType json.RawMessage `json:"self_destruct_type"` SelfDestructIn float64 `json:"self_destruct_in"` AutoDeleteIn float64 `json:"auto_delete_in"` ViaBotUserId int64 `json:"via_bot_user_id"` @@ -8677,7 +8787,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.InteractionInfo = tmp.InteractionInfo message.UnreadReactions = tmp.UnreadReactions message.MessageThreadId = tmp.MessageThreadId - message.SelfDestructTime = tmp.SelfDestructTime message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn message.ViaBotUserId = tmp.ViaBotUserId @@ -8697,6 +8806,9 @@ func (message *Message) UnmarshalJSON(data []byte) error { fieldReplyTo, _ := UnmarshalMessageReplyTo(tmp.ReplyTo) message.ReplyTo = fieldReplyTo + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) + message.SelfDestructType = fieldSelfDestructType + fieldContent, _ := UnmarshalMessageContent(tmp.Content) message.Content = fieldContent @@ -11665,6 +11777,8 @@ type FoundWebApp struct { meta // The Web App WebApp *WebApp `json:"web_app"` + // True, if the app supports "settings_button_pressed" event + SupportsSettings bool `json:"supports_settings"` // 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 @@ -19083,6 +19197,8 @@ 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"` + // True, if user allowed the bot to send messages by an explicit call to allowBotToSendMessages + ByRequest bool `json:"by_request"` } func (entity *MessageBotWriteAccessAllowed) MarshalJSON() ([]byte, error) { @@ -19922,6 +20038,58 @@ func (*MessageSchedulingStateSendWhenOnline) MessageSchedulingStateType() string return TypeMessageSchedulingStateSendWhenOnline } +// The message will be self-destructed in the specified time after its content was opened +type MessageSelfDestructTypeTimer struct { + meta + // The message's self-destruct time, in seconds; must be between 0 and 60 in private chats + SelfDestructTime int32 `json:"self_destruct_time"` +} + +func (entity *MessageSelfDestructTypeTimer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSelfDestructTypeTimer + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSelfDestructTypeTimer) GetClass() string { + return ClassMessageSelfDestructType +} + +func (*MessageSelfDestructTypeTimer) GetType() string { + return TypeMessageSelfDestructTypeTimer +} + +func (*MessageSelfDestructTypeTimer) MessageSelfDestructTypeType() string { + return TypeMessageSelfDestructTypeTimer +} + +// The message can be opened only once and will be self-destructed once closed +type MessageSelfDestructTypeImmediately struct{ + meta +} + +func (entity *MessageSelfDestructTypeImmediately) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSelfDestructTypeImmediately + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSelfDestructTypeImmediately) GetClass() string { + return ClassMessageSelfDestructType +} + +func (*MessageSelfDestructTypeImmediately) GetType() string { + return TypeMessageSelfDestructTypeImmediately +} + +func (*MessageSelfDestructTypeImmediately) MessageSelfDestructTypeType() string { + return TypeMessageSelfDestructTypeImmediately +} + // Options to be used when a message is sent type MessageSendOptions struct { meta @@ -20247,8 +20415,8 @@ type InputMessagePhoto struct { Height int32 `json:"height"` // Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Photo self-destruct time, in seconds (0-60). A non-zero self-destruct time can be specified only in private chats - SelfDestructTime int32 `json:"self_destruct_time"` + // Photo self-destruct type; pass null if none; private chats only + SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // True, if the photo preview must be covered by a spoiler animation; not supported in secret chats HasSpoiler bool `json:"has_spoiler"` } @@ -20281,7 +20449,7 @@ func (inputMessagePhoto *InputMessagePhoto) UnmarshalJSON(data []byte) error { Width int32 `json:"width"` Height int32 `json:"height"` Caption *FormattedText `json:"caption"` - SelfDestructTime int32 `json:"self_destruct_time"` + SelfDestructType json.RawMessage `json:"self_destruct_type"` HasSpoiler bool `json:"has_spoiler"` } @@ -20295,12 +20463,14 @@ func (inputMessagePhoto *InputMessagePhoto) UnmarshalJSON(data []byte) error { inputMessagePhoto.Width = tmp.Width inputMessagePhoto.Height = tmp.Height inputMessagePhoto.Caption = tmp.Caption - inputMessagePhoto.SelfDestructTime = tmp.SelfDestructTime inputMessagePhoto.HasSpoiler = tmp.HasSpoiler fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) inputMessagePhoto.Photo = fieldPhoto + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) + inputMessagePhoto.SelfDestructType = fieldSelfDestructType + return nil } @@ -20383,8 +20553,8 @@ type InputMessageVideo struct { SupportsStreaming bool `json:"supports_streaming"` // Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Video self-destruct time, in seconds (0-60). A non-zero self-destruct time can be specified only in private chats - SelfDestructTime int32 `json:"self_destruct_time"` + // Video self-destruct type; pass null if none; private chats only + SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // True, if the video preview must be covered by a spoiler animation; not supported in secret chats HasSpoiler bool `json:"has_spoiler"` } @@ -20419,7 +20589,7 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { Height int32 `json:"height"` SupportsStreaming bool `json:"supports_streaming"` Caption *FormattedText `json:"caption"` - SelfDestructTime int32 `json:"self_destruct_time"` + SelfDestructType json.RawMessage `json:"self_destruct_type"` HasSpoiler bool `json:"has_spoiler"` } @@ -20435,12 +20605,14 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { inputMessageVideo.Height = tmp.Height inputMessageVideo.SupportsStreaming = tmp.SupportsStreaming inputMessageVideo.Caption = tmp.Caption - inputMessageVideo.SelfDestructTime = tmp.SelfDestructTime inputMessageVideo.HasSpoiler = tmp.HasSpoiler fieldVideo, _ := UnmarshalInputFile(tmp.Video) inputMessageVideo.Video = fieldVideo + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) + inputMessageVideo.SelfDestructType = fieldSelfDestructType + return nil } @@ -22347,6 +22519,8 @@ type StoryViewers struct { meta // Approximate total number of story viewers found TotalCount int32 `json:"total_count"` + // Approximate total number of reactions set by found story viewers + TotalReactionCount int32 `json:"total_reaction_count"` // List of story viewers Viewers []*StoryViewer `json:"viewers"` // The offset for the next request. If empty, there are no more results @@ -24909,10 +25083,10 @@ func (*AttachmentMenuBotColor) GetType() string { return TypeAttachmentMenuBotColor } -// Represents a bot, which can be added to attachment menu +// Represents a bot, which can be added to attachment or side menu type AttachmentMenuBot struct { meta - // User identifier of the bot added to attachment menu + // User identifier of the bot BotUserId int64 `json:"bot_user_id"` // True, if the bot supports opening from attachment menu in the chat with the bot SupportsSelfChat bool `json:"supports_self_chat"` @@ -24926,22 +25100,36 @@ 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 must be asked for the permission to the bot to send them messages + // True, if the user must be asked for the permission to send messages to the bot RequestWriteAccess bool `json:"request_write_access"` + // True, if the bot was explicitly added by the user. If the bot isn't added, then on the first bot launch toggleBotIsAddedToAttachmentMenu must be called and the bot must be added or removed + IsAdded bool `json:"is_added"` + // True, if the bot must be shown in the attachment menu + ShowInAttachmentMenu bool `json:"show_in_attachment_menu"` + // True, if the bot must be shown in the side menu + ShowInSideMenu bool `json:"show_in_side_menu"` + // True, if a disclaimer, why the bot is shown in the side menu, is needed + ShowDisclaimerInSideMenu bool `json:"show_disclaimer_in_side_menu"` // Name for the bot in attachment menu Name string `json:"name"` // Color to highlight selected name of the bot if appropriate; may be null NameColor *AttachmentMenuBotColor `json:"name_color"` - // Default attachment menu icon for the bot in SVG format; may be null + // Default icon for the bot in SVG format; may be null DefaultIcon *File `json:"default_icon"` - // Attachment menu icon for the bot in SVG format for the official iOS app; may be null + // Icon for the bot in SVG format for the official iOS app; may be null IosStaticIcon *File `json:"ios_static_icon"` - // Attachment menu icon for the bot in TGS format for the official iOS app; may be null + // Icon for the bot in TGS format for the official iOS app; may be null IosAnimatedIcon *File `json:"ios_animated_icon"` - // Attachment menu icon for the bot in TGS format for the official Android app; may be null + // Icon for the bot in PNG format for the official iOS app side menu; may be null + IosSideMenuIcon *File `json:"ios_side_menu_icon"` + // Icon for the bot in TGS format for the official Android app; may be null AndroidIcon *File `json:"android_icon"` - // Attachment menu icon for the bot in TGS format for the official native macOS app; may be null + // Icon for the bot in SVG format for the official Android app side menu; may be null + AndroidSideMenuIcon *File `json:"android_side_menu_icon"` + // Icon for the bot in TGS format for the official native macOS app; may be null MacosIcon *File `json:"macos_icon"` + // Icon for the bot in PNG format for the official macOS app side menu; may be null + MacosSideMenuIcon *File `json:"macos_side_menu_icon"` // Color to highlight selected icon of the bot if appropriate; may be null IconColor *AttachmentMenuBotColor `json:"icon_color"` // Default placeholder for opened Web Apps in SVG format; may be null @@ -32097,7 +32285,7 @@ func (*NotificationTypeNewCall) NotificationTypeType() string { // New message was received through a push notification type NotificationTypeNewPushMessage struct { meta - // The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages, or as a message to reply + // The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to reply MessageId int64 `json:"message_id"` // Identifier of the sender of the message. Corresponding user or chat may be inaccessible SenderId MessageSender `json:"sender_id"` @@ -32826,30 +33014,30 @@ func (*StoryPrivacySettingsCloseFriends) StoryPrivacySettingsType() string { } // The story can be viewed by certain specified users -type StoryPrivacySettingsSelectedContacts struct { +type StoryPrivacySettingsSelectedUsers struct { meta // Identifiers of the users; always unknown and empty for non-owned stories UserIds []int64 `json:"user_ids"` } -func (entity *StoryPrivacySettingsSelectedContacts) MarshalJSON() ([]byte, error) { +func (entity *StoryPrivacySettingsSelectedUsers) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StoryPrivacySettingsSelectedContacts + type stub StoryPrivacySettingsSelectedUsers return json.Marshal((*stub)(entity)) } -func (*StoryPrivacySettingsSelectedContacts) GetClass() string { +func (*StoryPrivacySettingsSelectedUsers) GetClass() string { return ClassStoryPrivacySettings } -func (*StoryPrivacySettingsSelectedContacts) GetType() string { - return TypeStoryPrivacySettingsSelectedContacts +func (*StoryPrivacySettingsSelectedUsers) GetType() string { + return TypeStoryPrivacySettingsSelectedUsers } -func (*StoryPrivacySettingsSelectedContacts) StoryPrivacySettingsType() string { - return TypeStoryPrivacySettingsSelectedContacts +func (*StoryPrivacySettingsSelectedUsers) StoryPrivacySettingsType() string { + return TypeStoryPrivacySettingsSelectedUsers } // A rule to allow all users to do something @@ -33829,6 +34017,8 @@ type Session struct { IsCurrent bool `json:"is_current"` // True, if a 2-step verification password is needed to complete authorization of the session IsPasswordPending bool `json:"is_password_pending"` + // True, if the session wasn't confirmed from another session + IsUnconfirmed bool `json:"is_unconfirmed"` // True, if incoming secret chats can be accepted by the session CanAcceptSecretChats bool `json:"can_accept_secret_chats"` // True, if incoming calls can be accepted by the session @@ -33854,11 +34044,9 @@ type Session struct { // Point in time (Unix timestamp) when the session was last used LastActiveDate int32 `json:"last_active_date"` // IP address from which the session was created, in human-readable format - Ip string `json:"ip"` - // A two-letter country code for the country from which the session was created, based on the IP address - Country string `json:"country"` - // Region code from which the session was created, based on the IP address - Region string `json:"region"` + IpAddress string `json:"ip_address"` + // A human-readable description of the location from which the session was created, based on the IP address + Location string `json:"location"` } func (entity *Session) MarshalJSON() ([]byte, error) { @@ -33882,6 +34070,7 @@ func (session *Session) UnmarshalJSON(data []byte) error { Id JsonInt64 `json:"id"` IsCurrent bool `json:"is_current"` IsPasswordPending bool `json:"is_password_pending"` + IsUnconfirmed bool `json:"is_unconfirmed"` CanAcceptSecretChats bool `json:"can_accept_secret_chats"` CanAcceptCalls bool `json:"can_accept_calls"` Type json.RawMessage `json:"type"` @@ -33894,9 +34083,8 @@ func (session *Session) UnmarshalJSON(data []byte) error { SystemVersion string `json:"system_version"` LogInDate int32 `json:"log_in_date"` LastActiveDate int32 `json:"last_active_date"` - Ip string `json:"ip"` - Country string `json:"country"` - Region string `json:"region"` + IpAddress string `json:"ip_address"` + Location string `json:"location"` } err := json.Unmarshal(data, &tmp) @@ -33907,6 +34095,7 @@ func (session *Session) UnmarshalJSON(data []byte) error { session.Id = tmp.Id session.IsCurrent = tmp.IsCurrent session.IsPasswordPending = tmp.IsPasswordPending + session.IsUnconfirmed = tmp.IsUnconfirmed session.CanAcceptSecretChats = tmp.CanAcceptSecretChats session.CanAcceptCalls = tmp.CanAcceptCalls session.ApiId = tmp.ApiId @@ -33918,9 +34107,8 @@ func (session *Session) UnmarshalJSON(data []byte) error { session.SystemVersion = tmp.SystemVersion session.LogInDate = tmp.LogInDate session.LastActiveDate = tmp.LastActiveDate - session.Ip = tmp.Ip - session.Country = tmp.Country - session.Region = tmp.Region + session.IpAddress = tmp.IpAddress + session.Location = tmp.Location fieldType, _ := UnmarshalSessionType(tmp.Type) session.Type = fieldType @@ -33953,6 +34141,35 @@ func (*Sessions) GetType() string { return TypeSessions } +// Contains information about an unconfirmed session +type UnconfirmedSession struct { + meta + // Session identifier + Id JsonInt64 `json:"id"` + // Point in time (Unix timestamp) when the user has logged in + LogInDate int32 `json:"log_in_date"` + // Model of the device that was used for the session creation, as provided by the application + DeviceModel string `json:"device_model"` + // A human-readable description of the location from which the session was created, based on the IP address + Location string `json:"location"` +} + +func (entity *UnconfirmedSession) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UnconfirmedSession + + return json.Marshal((*stub)(entity)) +} + +func (*UnconfirmedSession) GetClass() string { + return ClassUnconfirmedSession +} + +func (*UnconfirmedSession) GetType() string { + return TypeUnconfirmedSession +} + // Contains information about one website the current user is logged in with Telegram type ConnectedWebsite struct { meta @@ -33971,7 +34188,7 @@ type ConnectedWebsite struct { // Point in time (Unix timestamp) when obtained authorization was last used LastActiveDate int32 `json:"last_active_date"` // IP address from which the user was logged in, in human-readable format - Ip string `json:"ip"` + IpAddress string `json:"ip_address"` // Human-readable description of a country and a region from which the user was logged in, based on the IP address Location string `json:"location"` } @@ -34391,7 +34608,7 @@ func (*InternalLinkTypeActiveSessions) InternalLinkTypeType() string { return TypeInternalLinkTypeActiveSessions } -// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then user needs to confirm adding the bot to attachment menu. If user confirms adding, then use toggleBotIsAddedToAttachmentMenu to add it. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL +// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL type InternalLinkTypeAttachmentMenuBot struct { meta // Target chat to be opened @@ -35054,7 +35271,7 @@ func (*InternalLinkTypePrivacyAndSecuritySettings) InternalLinkTypeType() string // The link is a link to a proxy. Call addProxy with the given parameters to process the link and add the proxy type InternalLinkTypeProxy struct { meta - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -35205,6 +35422,35 @@ func (*InternalLinkTypeSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeSettings } +// The link is a link to a bot, which can be installed to the side menu. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to side menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the bot is added to side menu, then use getWebAppUrl with the given URL +type InternalLinkTypeSideMenuBot struct { + meta + // Username of the bot + BotUsername string `json:"bot_username"` + // URL to be passed to getWebAppUrl + Url string `json:"url"` +} + +func (entity *InternalLinkTypeSideMenuBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeSideMenuBot + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeSideMenuBot) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeSideMenuBot) GetType() string { + return TypeInternalLinkTypeSideMenuBot +} + +func (*InternalLinkTypeSideMenuBot) InternalLinkTypeType() string { + return TypeInternalLinkTypeSideMenuBot +} + // The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set type InternalLinkTypeStickerSet struct { meta @@ -35452,7 +35698,7 @@ 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 +// 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. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being a third-party apps instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then call getWebAppLinkUrl and open the returned URL as a Web App type InternalLinkTypeWebApp struct { meta // Username of the bot that owns the Web App @@ -37079,6 +37325,31 @@ func (*TopChatCategoryForwardChats) TopChatCategoryType() string { return TypeTopChatCategoryForwardChats } +// Contains 0-based positions of matched objects +type FoundPositions struct { + meta + // Total number of matched objects + TotalCount int32 `json:"total_count"` + // The positions of the matched objects + Positions []int32 `json:"positions"` +} + +func (entity *FoundPositions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundPositions + + return json.Marshal((*stub)(entity)) +} + +func (*FoundPositions) GetClass() string { + return ClassFoundPositions +} + +func (*FoundPositions) GetType() string { + return TypeFoundPositions +} + // A URL linking to a user type TMeUrlTypeUser struct { meta @@ -37744,7 +38015,7 @@ type Proxy struct { meta // Unique identifier of the proxy Id int32 `json:"id"` - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -40151,9 +40422,9 @@ type UpdateNotificationGroup struct { NotificationSoundId JsonInt64 `json:"notification_sound_id"` // Total number of unread notifications in the group, can be bigger than number of active notifications TotalCount int32 `json:"total_count"` - // List of added group notifications, sorted by notification ID + // List of added group notifications, sorted by notification identifier AddedNotifications []*Notification `json:"added_notifications"` - // Identifiers of removed group notifications, sorted by notification ID + // Identifiers of removed group notifications, sorted by notification identifier RemovedNotificationIds []int32 `json:"removed_notification_ids"` } @@ -41843,10 +42114,37 @@ func (*UpdateUsersNearby) UpdateType() string { return TypeUpdateUsersNearby } -// The list of bots added to attachment menu has changed +// The first unconfirmed session has changed +type UpdateUnconfirmedSession struct { + meta + // The unconfirmed session; may be null if none + Session *UnconfirmedSession `json:"session"` +} + +func (entity *UpdateUnconfirmedSession) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUnconfirmedSession + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUnconfirmedSession) GetClass() string { + return ClassUpdate +} + +func (*UpdateUnconfirmedSession) GetType() string { + return TypeUpdateUnconfirmedSession +} + +func (*UpdateUnconfirmedSession) UpdateType() string { + return TypeUpdateUnconfirmedSession +} + +// The list of bots added to attachment or side menu has changed type UpdateAttachmentMenuBots struct { meta - // The new list of bots added to attachment menu. The bots must not be shown on scheduled messages screen + // The new list of bots. The bots must not be shown on scheduled messages screen Bots []*AttachmentMenuBot `json:"bots"` } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 695a3d7..21a0f6c 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -729,6 +729,43 @@ func UnmarshalListOfSupergroupMembersFilter(dataList []json.RawMessage) ([]Super return list, nil } +func UnmarshalInviteLinkChatType(data json.RawMessage) (InviteLinkChatType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInviteLinkChatTypeBasicGroup: + return UnmarshalInviteLinkChatTypeBasicGroup(data) + + case TypeInviteLinkChatTypeSupergroup: + return UnmarshalInviteLinkChatTypeSupergroup(data) + + case TypeInviteLinkChatTypeChannel: + return UnmarshalInviteLinkChatTypeChannel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInviteLinkChatType(dataList []json.RawMessage) ([]InviteLinkChatType, error) { + list := []InviteLinkChatType{} + + for _, data := range dataList { + entity, err := UnmarshalInviteLinkChatType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSecretChatState(data json.RawMessage) (SecretChatState, error) { var meta meta @@ -2552,6 +2589,40 @@ func UnmarshalListOfMessageSchedulingState(dataList []json.RawMessage) ([]Messag return list, nil } +func UnmarshalMessageSelfDestructType(data json.RawMessage) (MessageSelfDestructType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageSelfDestructTypeTimer: + return UnmarshalMessageSelfDestructTypeTimer(data) + + case TypeMessageSelfDestructTypeImmediately: + return UnmarshalMessageSelfDestructTypeImmediately(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageSelfDestructType(dataList []json.RawMessage) ([]MessageSelfDestructType, error) { + list := []MessageSelfDestructType{} + + for _, data := range dataList { + entity, err := UnmarshalMessageSelfDestructType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, error) { var meta meta @@ -4759,8 +4830,8 @@ func UnmarshalStoryPrivacySettings(data json.RawMessage) (StoryPrivacySettings, case TypeStoryPrivacySettingsCloseFriends: return UnmarshalStoryPrivacySettingsCloseFriends(data) - case TypeStoryPrivacySettingsSelectedContacts: - return UnmarshalStoryPrivacySettingsSelectedContacts(data) + case TypeStoryPrivacySettingsSelectedUsers: + return UnmarshalStoryPrivacySettingsSelectedUsers(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) @@ -5161,6 +5232,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(data) + case TypeInternalLinkTypeSideMenuBot: + return UnmarshalInternalLinkTypeSideMenuBot(data) + case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(data) @@ -6149,6 +6223,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateUsersNearby: return UnmarshalUpdateUsersNearby(data) + case TypeUpdateUnconfirmedSession: + return UnmarshalUpdateUnconfirmedSession(data) + case TypeUpdateAttachmentMenuBots: return UnmarshalUpdateAttachmentMenuBots(data) @@ -7479,6 +7556,30 @@ func UnmarshalChatInviteLinkMembers(data json.RawMessage) (*ChatInviteLinkMember return &resp, err } +func UnmarshalInviteLinkChatTypeBasicGroup(data json.RawMessage) (*InviteLinkChatTypeBasicGroup, error) { + var resp InviteLinkChatTypeBasicGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteLinkChatTypeSupergroup(data json.RawMessage) (*InviteLinkChatTypeSupergroup, error) { + var resp InviteLinkChatTypeSupergroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteLinkChatTypeChannel(data json.RawMessage) (*InviteLinkChatTypeChannel, error) { + var resp InviteLinkChatTypeChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatInviteLinkInfo(data json.RawMessage) (*ChatInviteLinkInfo, error) { var resp ChatInviteLinkInfo @@ -10535,6 +10636,22 @@ func UnmarshalMessageSchedulingStateSendWhenOnline(data json.RawMessage) (*Messa return &resp, err } +func UnmarshalMessageSelfDestructTypeTimer(data json.RawMessage) (*MessageSelfDestructTypeTimer, error) { + var resp MessageSelfDestructTypeTimer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSelfDestructTypeImmediately(data json.RawMessage) (*MessageSelfDestructTypeImmediately, error) { + var resp MessageSelfDestructTypeImmediately + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSendOptions(data json.RawMessage) (*MessageSendOptions, error) { var resp MessageSendOptions @@ -13703,8 +13820,8 @@ func UnmarshalStoryPrivacySettingsCloseFriends(data json.RawMessage) (*StoryPriv return &resp, err } -func UnmarshalStoryPrivacySettingsSelectedContacts(data json.RawMessage) (*StoryPrivacySettingsSelectedContacts, error) { - var resp StoryPrivacySettingsSelectedContacts +func UnmarshalStoryPrivacySettingsSelectedUsers(data json.RawMessage) (*StoryPrivacySettingsSelectedUsers, error) { + var resp StoryPrivacySettingsSelectedUsers err := json.Unmarshal(data, &resp) @@ -14031,6 +14148,14 @@ func UnmarshalSessions(data json.RawMessage) (*Sessions, error) { return &resp, err } +func UnmarshalUnconfirmedSession(data json.RawMessage) (*UnconfirmedSession, error) { + var resp UnconfirmedSession + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalConnectedWebsite(data json.RawMessage) (*ConnectedWebsite, error) { var resp ConnectedWebsite @@ -14383,6 +14508,14 @@ func UnmarshalInternalLinkTypeSettings(data json.RawMessage) (*InternalLinkTypeS return &resp, err } +func UnmarshalInternalLinkTypeSideMenuBot(data json.RawMessage) (*InternalLinkTypeSideMenuBot, error) { + var resp InternalLinkTypeSideMenuBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeStickerSet(data json.RawMessage) (*InternalLinkTypeStickerSet, error) { var resp InternalLinkTypeStickerSet @@ -14927,6 +15060,14 @@ func UnmarshalTopChatCategoryForwardChats(data json.RawMessage) (*TopChatCategor return &resp, err } +func UnmarshalFoundPositions(data json.RawMessage) (*FoundPositions, error) { + var resp FoundPositions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTMeUrlTypeUser(data json.RawMessage) (*TMeUrlTypeUser, error) { var resp TMeUrlTypeUser @@ -16079,6 +16220,14 @@ func UnmarshalUpdateUsersNearby(data json.RawMessage) (*UpdateUsersNearby, error return &resp, err } +func UnmarshalUpdateUnconfirmedSession(data json.RawMessage) (*UpdateUnconfirmedSession, error) { + var resp UpdateUnconfirmedSession + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateAttachmentMenuBots(data json.RawMessage) (*UpdateAttachmentMenuBots, error) { var resp UpdateAttachmentMenuBots @@ -16829,6 +16978,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatInviteLinkMembers: return UnmarshalChatInviteLinkMembers(data) + case TypeInviteLinkChatTypeBasicGroup: + return UnmarshalInviteLinkChatTypeBasicGroup(data) + + case TypeInviteLinkChatTypeSupergroup: + return UnmarshalInviteLinkChatTypeSupergroup(data) + + case TypeInviteLinkChatTypeChannel: + return UnmarshalInviteLinkChatTypeChannel(data) + case TypeChatInviteLinkInfo: return UnmarshalChatInviteLinkInfo(data) @@ -17975,6 +18133,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSchedulingStateSendWhenOnline: return UnmarshalMessageSchedulingStateSendWhenOnline(data) + case TypeMessageSelfDestructTypeTimer: + return UnmarshalMessageSelfDestructTypeTimer(data) + + case TypeMessageSelfDestructTypeImmediately: + return UnmarshalMessageSelfDestructTypeImmediately(data) + case TypeMessageSendOptions: return UnmarshalMessageSendOptions(data) @@ -19163,8 +19327,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryPrivacySettingsCloseFriends: return UnmarshalStoryPrivacySettingsCloseFriends(data) - case TypeStoryPrivacySettingsSelectedContacts: - return UnmarshalStoryPrivacySettingsSelectedContacts(data) + case TypeStoryPrivacySettingsSelectedUsers: + return UnmarshalStoryPrivacySettingsSelectedUsers(data) case TypeUserPrivacySettingRuleAllowAll: return UnmarshalUserPrivacySettingRuleAllowAll(data) @@ -19286,6 +19450,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSessions: return UnmarshalSessions(data) + case TypeUnconfirmedSession: + return UnmarshalUnconfirmedSession(data) + case TypeConnectedWebsite: return UnmarshalConnectedWebsite(data) @@ -19418,6 +19585,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(data) + case TypeInternalLinkTypeSideMenuBot: + return UnmarshalInternalLinkTypeSideMenuBot(data) + case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(data) @@ -19622,6 +19792,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTopChatCategoryForwardChats: return UnmarshalTopChatCategoryForwardChats(data) + case TypeFoundPositions: + return UnmarshalFoundPositions(data) + case TypeTMeUrlTypeUser: return UnmarshalTMeUrlTypeUser(data) @@ -20054,6 +20227,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateUsersNearby: return UnmarshalUpdateUsersNearby(data) + case TypeUpdateUnconfirmedSession: + return UnmarshalUpdateUnconfirmedSession(data) + case TypeUpdateAttachmentMenuBots: return UnmarshalUpdateAttachmentMenuBots(data) diff --git a/data/td_api.tl b/data/td_api.tl index 9f2eec0..df470f6 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -195,7 +195,7 @@ localFile path:string can_be_downloaded:Bool can_be_deleted:Bool is_downloading_ //@description Represents a remote file //@id Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. -//-If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. +//-If the identifier starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. //-If downloadFile/addFileToDownloads is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the application with the HTTP URL in the original_path and "#url#" as the conversion string. //-Application must generate the file by downloading it to the specified location //@unique_id Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time @@ -216,10 +216,10 @@ file id:int32 dc_id:int32 size:int53 expected_size:int53 local:localFile remote: //@class InputFile @description Points to a file -//@description A file defined by its unique ID @id Unique file identifier +//@description A file defined by its unique identifier @id Unique file identifier inputFileId id:int32 = InputFile; -//@description A file defined by its remote ID. The remote ID is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. +//@description A file defined by its remote identifier. The remote identifier is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. //-For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application //@id Remote file identifier inputFileRemote id:string = InputFile; @@ -556,7 +556,7 @@ userTypeDeleted = UserType; //@is_inline True, if the bot supports inline queries //@inline_query_placeholder Placeholder for inline queries (displayed on the application input field) //@need_location True, if the location of the user is expected to be sent with every inline query to this bot -//@can_be_added_to_attachment_menu True, if the bot can be added to attachment menu +//@can_be_added_to_attachment_menu True, if the bot can be added to attachment or side menu userTypeBot can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_be_added_to_attachment_menu:Bool = UserType; //@description No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type @@ -907,6 +907,19 @@ chatInviteLinkMember user_id:int53 joined_chat_date:int32 via_chat_folder_invite //@description Contains a list of chat members joined a chat via an invite link @total_count Approximate total number of chat members found @members List of chat members, joined a chat via an invite link chatInviteLinkMembers total_count:int32 members:vector = ChatInviteLinkMembers; + +//@class InviteLinkChatType @description Describes the type of a chat to which points an invite link + +//@description The link is an invite link for a basic group +inviteLinkChatTypeBasicGroup = InviteLinkChatType; + +//@description The link is an invite link for a supergroup +inviteLinkChatTypeSupergroup = InviteLinkChatType; + +//@description The link is an invite link for a channel +inviteLinkChatTypeChannel = InviteLinkChatType; + + //@description Contains information about a chat invite link //@chat_id Chat identifier of the invite link; 0 if the user has no access to the chat before joining //@accessible_for If non-zero, the amount of time for which read access to the chat will remain available, in seconds @@ -918,7 +931,11 @@ chatInviteLinkMembers total_count:int32 members:vector = C //@member_user_ids User identifiers of some chat members that may be known to the current user //@creates_join_request True, if the link only creates join request //@is_public True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup -chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:ChatType title:string photo:chatPhotoInfo description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool = ChatInviteLinkInfo; +//@is_verified True, if the chat is verified +//@is_scam True, if many users reported this chat as a scam +//@is_fake True, if many users reported this chat as a fake account +chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; + //@description Describes a user that sent a join request and waits for administrator approval @user_id User identifier @date Point in time (Unix timestamp) when the user sent the join request @bio A short bio of the user chatJoinRequest user_id:int53 date:int32 bio:string = ChatJoinRequest; @@ -1180,16 +1197,16 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@unread_reactions Information about unread reactions added to the message //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs -//@self_destruct_time The message's self-destruct time, in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the time expires -//@self_destruct_in Time left before the message self-destruct timer expires, in seconds. If the self-destruct timer isn't started yet, equals to the value of the self_destruct_time field -//@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never. TDLib will send updateDeleteMessages or updateMessageContent once the time expires +//@self_destruct_type The message's self-destruct type; may be null if none +//@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-desctruction isn't scheduled yet +//@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never //@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_time:int32 self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; @@ -1675,9 +1692,10 @@ loginUrlInfoRequestConfirmation url:string domain:string bot_user_id:int53 reque //@description Contains information about a Web App found by its short name //@web_app The Web App +//@supports_settings True, if the app supports "settings_button_pressed" event //@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; +foundWebApp web_app:webApp supports_settings:Bool 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; @@ -2708,8 +2726,10 @@ 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 @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 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 +//@by_request True, if user allowed the bot to send messages by an explicit call to allowBotToSendMessages +messageBotWriteAccessAllowed web_app:webApp by_request:Bool = 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; @@ -2809,6 +2829,15 @@ messageSchedulingStateSendAtDate send_date:int32 = MessageSchedulingState; messageSchedulingStateSendWhenOnline = MessageSchedulingState; +//@class MessageSelfDestructType @description Describes when a message will be self-destructed + +//@description The message will be self-destructed in the specified time after its content was opened @self_destruct_time The message's self-destruct time, in seconds; must be between 0 and 60 in private chats +messageSelfDestructTypeTimer self_destruct_time:int32 = MessageSelfDestructType; + +//@description The message can be opened only once and will be self-destructed once closed +messageSelfDestructTypeImmediately = MessageSelfDestructType; + + //@description Options to be used when a message is sent //@disable_notification Pass true to disable notification for the message //@from_background Pass true if the message is sent from the background @@ -2867,9 +2896,10 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content //@width Photo width //@height Photo height //@caption Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@self_destruct_time Photo self-destruct time, in seconds (0-60). A non-zero self-destruct time can be specified only in private chats +//@self_destruct_type Photo self-destruct type; pass null if none; private chats only //@has_spoiler True, if the photo preview must be covered by a spoiler animation; not supported in secret chats -inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText self_destruct_time:int32 has_spoiler:Bool = InputMessageContent; +inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; + //@description A sticker message //@sticker Sticker to be sent @@ -2888,9 +2918,9 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh //@height Video height //@supports_streaming True, if the video is supposed to be streamed //@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@self_destruct_time Video self-destruct time, in seconds (0-60). A non-zero self-destruct time can be specified only in private chats +//@self_destruct_type Video self-destruct type; pass null if none; private chats only //@has_spoiler True, if the video preview must be covered by a spoiler animation; not supported in secret chats -inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText self_destruct_time:int32 has_spoiler:Bool = InputMessageContent; +inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; //@description A video note message //@video_note Video note to be sent @@ -3162,9 +3192,10 @@ storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_t //@description Represents a list of story viewers //@total_count Approximate total number of story viewers found +//@total_reaction_count Approximate total number of reactions set by found story viewers //@viewers List of story viewers //@next_offset The offset for the next request. If empty, there are no more results -storyViewers total_count:int32 viewers:vector next_offset:string = StoryViewers; +storyViewers total_count:int32 total_reaction_count:int32 viewers:vector next_offset:string = StoryViewers; //@description Describes position of a clickable rectangle area on a story media @@ -3603,25 +3634,32 @@ speechRecognitionResultError error:error = SpeechRecognitionResult; //@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB24 format for light themes @dark_color Color in the RGB24 format for dark themes attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotColor; -//@description Represents a bot, which can be added to attachment menu -//@bot_user_id User identifier of the bot added to attachment menu +//@description Represents a bot, which can be added to attachment or side menu +//@bot_user_id User identifier of the bot //@supports_self_chat True, if the bot supports opening from attachment menu in the chat with the bot //@supports_user_chats True, if the bot supports opening from attachment menu in private chats with ordinary users //@supports_bot_chats True, if the bot supports opening from attachment menu in private chats with other bots //@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 must be asked for the permission to the bot to send them messages +//@request_write_access True, if the user must be asked for the permission to send messages to the bot +//@is_added True, if the bot was explicitly added by the user. If the bot isn't added, then on the first bot launch toggleBotIsAddedToAttachmentMenu must be called and the bot must be added or removed +//@show_in_attachment_menu True, if the bot must be shown in the attachment menu +//@show_in_side_menu True, if the bot must be shown in the side menu +//@show_disclaimer_in_side_menu True, if a disclaimer, why the bot is shown in the side menu, is needed //@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 -//@ios_static_icon Attachment menu icon for the bot in SVG format for the official iOS app; may be null -//@ios_animated_icon Attachment menu icon for the bot in TGS format for the official iOS app; may be null -//@android_icon Attachment menu icon for the bot in TGS format for the official Android app; may be null -//@macos_icon Attachment menu icon for the bot in TGS format for the official native macOS app; may be null +//@default_icon Default icon for the bot in SVG format; may be null +//@ios_static_icon Icon for the bot in SVG format for the official iOS app; may be null +//@ios_animated_icon Icon for the bot in TGS format for the official iOS app; may be null +//@ios_side_menu_icon Icon for the bot in PNG format for the official iOS app side menu; may be null +//@android_icon Icon for the bot in TGS format for the official Android app; may be null +//@android_side_menu_icon Icon for the bot in SVG format for the official Android app side menu; may be null +//@macos_icon Icon for the bot in TGS format for the official native macOS app; may be null +//@macos_side_menu_icon Icon for the bot in PNG format for the official macOS app side menu; may be null //@icon_color Color to highlight selected icon of the bot if appropriate; may be null //@web_app_placeholder Default placeholder for opened Web Apps in SVG format; may be null -attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool supports_settings:Bool request_write_access:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file android_icon:file macos_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; +attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool supports_settings:Bool request_write_access:Bool is_added:Bool show_in_attachment_menu:Bool show_in_side_menu:Bool show_disclaimer_in_side_menu:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file ios_side_menu_icon:file android_icon:file android_side_menu_icon:file macos_icon:file macos_side_menu_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; //@description Information about the message sent by answerWebAppQuery @inline_message_id Identifier of the sent inline message, if known sentWebAppMessage inline_message_id:string = SentWebAppMessage; @@ -4611,7 +4649,7 @@ notificationTypeNewSecretChat = NotificationType; notificationTypeNewCall call_id:int32 = NotificationType; //@description New message was received through a push notification -//@message_id The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages, or as a message to reply +//@message_id The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to reply //@sender_id Identifier of the sender of the message. Corresponding user or chat may be inaccessible //@sender_name Name of the sender //@is_outgoing True, if the message is outgoing @@ -4714,7 +4752,7 @@ storyPrivacySettingsContacts except_user_ids:vector = StoryPrivacySetting storyPrivacySettingsCloseFriends = StoryPrivacySettings; //@description The story can be viewed by certain specified users @user_ids Identifiers of the users; always unknown and empty for non-owned stories -storyPrivacySettingsSelectedContacts user_ids:vector = StoryPrivacySettings; +storyPrivacySettingsSelectedUsers user_ids:vector = StoryPrivacySettings; //@class UserPrivacySettingRule @description Represents a single rule for managing user privacy settings @@ -4846,6 +4884,7 @@ sessionTypeXbox = SessionType; //@id Session identifier //@is_current True, if this session is the current session //@is_password_pending True, if a 2-step verification password is needed to complete authorization of the session +//@is_unconfirmed True, if the session wasn't confirmed from another session //@can_accept_secret_chats True, if incoming secret chats can be accepted by the session //@can_accept_calls True, if incoming calls can be accepted by the session //@type Session type based on the system and application version, which can be used to display a corresponding icon @@ -4858,14 +4897,20 @@ sessionTypeXbox = SessionType; //@system_version Version of the operating system the application has been run or is running on, as provided by the application //@log_in_date Point in time (Unix timestamp) when the user has logged in //@last_active_date Point in time (Unix timestamp) when the session was last used -//@ip IP address from which the session was created, in human-readable format -//@country A two-letter country code for the country from which the session was created, based on the IP address -//@region Region code from which the session was created, based on the IP address -session id:int64 is_current:Bool is_password_pending:Bool can_accept_secret_chats:Bool can_accept_calls:Bool type:SessionType api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip:string country:string region:string = Session; +//@ip_address IP address from which the session was created, in human-readable format +//@location A human-readable description of the location from which the session was created, based on the IP address +session id:int64 is_current:Bool is_password_pending:Bool is_unconfirmed:Bool can_accept_secret_chats:Bool can_accept_calls:Bool type:SessionType api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip_address:string location:string = Session; //@description Contains a list of sessions @sessions List of sessions @inactive_session_ttl_days Number of days of inactivity before sessions will automatically be terminated; 1-366 days sessions sessions:vector inactive_session_ttl_days:int32 = Sessions; +//@description Contains information about an unconfirmed session +//@id Session identifier +//@log_in_date Point in time (Unix timestamp) when the user has logged in +//@device_model Model of the device that was used for the session creation, as provided by the application +//@location A human-readable description of the location from which the session was created, based on the IP address +unconfirmedSession id:int64 log_in_date:int32 device_model:string location:string = UnconfirmedSession; + //@description Contains information about one website the current user is logged in with Telegram //@id Website identifier @@ -4875,9 +4920,9 @@ sessions sessions:vector inactive_session_ttl_days:int32 = Sessions; //@platform Operating system the browser is running on //@log_in_date Point in time (Unix timestamp) when the user was logged in //@last_active_date Point in time (Unix timestamp) when obtained authorization was last used -//@ip IP address from which the user was logged in, in human-readable format +//@ip_address IP address from which the user was logged in, in human-readable format //@location Human-readable description of a country and a region from which the user was logged in, based on the IP address -connectedWebsite id:int64 domain_name:string bot_user_id:int53 browser:string platform:string log_in_date:int32 last_active_date:int32 ip:string location:string = ConnectedWebsite; +connectedWebsite id:int64 domain_name:string bot_user_id:int53 browser:string platform:string log_in_date:int32 last_active_date:int32 ip_address:string location:string = ConnectedWebsite; //@description Contains a list of websites the current user is logged in with Telegram @websites List of connected websites connectedWebsites websites:vector = ConnectedWebsites; @@ -4939,7 +4984,8 @@ internalLinkTypeActiveSessions = InternalLinkType; //@description The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. //-Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. -//-If the bot isn't added to attachment menu, then user needs to confirm adding the bot to attachment menu. If user confirms adding, then use toggleBotIsAddedToAttachmentMenu to add it. +//-If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. +//-If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. //-If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL //@target_chat Target chat to be opened //@bot_username Username of the bot @@ -5041,7 +5087,7 @@ internalLinkTypePremiumFeatures referrer:string = InternalLinkType; internalLinkTypePrivacyAndSecuritySettings = InternalLinkType; //@description The link is a link to a proxy. Call addProxy with the given parameters to process the link and add the proxy -//@server Proxy server IP address +//@server Proxy server domain or IP address //@port Proxy server port //@type Type of the proxy internalLinkTypeProxy server:string port:int32 type:ProxyType = InternalLinkType; @@ -5059,6 +5105,14 @@ internalLinkTypeRestorePurchases = InternalLinkType; //@description The link is a link to application settings internalLinkTypeSettings = InternalLinkType; +//@description The link is a link to a bot, which can be installed to the side menu. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. +//-Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to side menu, then show a disclaimer about Mini Apps being a third-party apps, +//-ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. +//-If the bot is added to side menu, then use getWebAppUrl with the given URL +//@bot_username Username of the bot +//@url URL to be passed to getWebAppUrl +internalLinkTypeSideMenuBot bot_username:string url:string = InternalLinkType; + //@description The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set //@sticker_set_name Name of the sticker set //@expect_custom_emoji True, if the sticker set is expected to contain custom emoji @@ -5094,7 +5148,9 @@ internalLinkTypeUserToken token:string = InternalLinkType; 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 +//-Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being a third-party apps +//-instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. +//-Then call getWebAppLinkUrl and open the returned URL as a Web App //@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 @@ -5352,6 +5408,10 @@ topChatCategoryCalls = TopChatCategory; topChatCategoryForwardChats = TopChatCategory; +//@description Contains 0-based positions of matched objects @total_count Total number of matched objects @positions The positions of the matched objects +foundPositions total_count:int32 positions:vector = FoundPositions; + + //@class TMeUrlType @description Describes the type of a URL linking to an internal Telegram entity //@description A URL linking to a user @user_id Identifier of the user @@ -5445,7 +5505,7 @@ proxyTypeMtproto secret:string = ProxyType; //@description Contains information about a proxy server //@id Unique identifier of the proxy -//@server Proxy server IP address +//@server Proxy server domain or IP address //@port Proxy server port //@last_used_date Point in time (Unix timestamp) when the proxy was last used; 0 if never //@is_enabled True, if the proxy is enabled now @@ -5765,8 +5825,8 @@ updateNotification notification_group_id:int32 notification:notification = Updat //@notification_settings_chat_id Chat identifier, which notification settings must be applied to the added notifications //@notification_sound_id Identifier of the notification sound to be played; 0 if sound is disabled //@total_count Total number of unread notifications in the group, can be bigger than number of active notifications -//@added_notifications List of added group notifications, sorted by notification ID -//@removed_notification_ids Identifiers of removed group notifications, sorted by notification ID +//@added_notifications List of added group notifications, sorted by notification identifier +//@removed_notification_ids Identifiers of removed group notifications, sorted by notification identifier updateNotificationGroup notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 notification_sound_id:int64 total_count:int32 added_notifications:vector removed_notification_ids:vector = Update; //@description Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update @groups Lists of active notification groups @@ -5954,7 +6014,10 @@ updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService //@description The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request @users_nearby The new list of users nearby updateUsersNearby users_nearby:vector = Update; -//@description The list of bots added to attachment menu has changed @bots The new list of bots added to attachment menu. The bots must not be shown on scheduled messages screen +//@description The first unconfirmed session has changed @session The unconfirmed session; may be null if none +updateUnconfirmedSession session:unconfirmedSession = Update; + +//@description The list of bots added to attachment or side menu has changed @bots The new list of bots. The bots must not be shown on scheduled messages screen updateAttachmentMenuBots bots:vector = Update; //@description A message was sent by an opened Web App, so the Web App needs to be closed @web_app_launch_id Identifier of Web App launch @@ -6340,7 +6403,7 @@ 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; -//@description Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. +//@description Returns information about a file by its remote identifier; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. //-For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application //@remote_file_id Remote identifier of the file to get //@file_type File type; pass null if unknown @@ -6400,7 +6463,7 @@ clearRecentlyFoundChats = Ok; //@description Returns recently opened chats; this is an offline request. Returns chats in the order of last opening @limit The maximum number of chats to be returned getRecentlyOpenedChats limit:int32 = Chats; -//@description Checks whether a username can be set for a chat @chat_id Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if the chat is being created @username Username to be checked +//@description Checks whether a username can be set for a chat @chat_id Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or 0 if the chat is being created @username Username to be checked checkChatUsername chat_id:int53 username:string = CheckChatUsernameResult; //@description Returns a list of public chats of the specified type, owned by the user @type Type of the public chats to return @@ -7003,9 +7066,9 @@ searchWebApp bot_user_id:int53 web_app_short_name:string = FoundWebApp; //@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 +//@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, an inlineQueryResultsButtonTypeWebApp button, or an internalLinkTypeSideMenuBot link //@bot_user_id Identifier of the target bot -//@url The URL from the keyboardButtonTypeWebApp or inlineQueryResultsButtonTypeWebApp button +//@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, an internalLinkTypeSideMenuBot link, or an empty when the bot is opened from the side menu //@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; @@ -7016,11 +7079,11 @@ getWebAppUrl bot_user_id:int53 url:string theme:themeParameters application_name //@data The data sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; -//@description Informs TDLib that a Web App is being opened from attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. +//@description Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. //-For each bot, a confirmation alert about data sent to the bot must be shown once //@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats //@bot_user_id Identifier of the bot, providing the Web App -//@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, or an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise +//@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise //@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 //@message_thread_id If not 0, a message thread identifier in which the message will be sent @@ -7552,10 +7615,10 @@ reportStory story_sender_chat_id:int53 story_id:int32 reason:ReportReason text:s activateStoryStealthMode = Ok; -//@description Returns information about a bot that can be added to attachment menu @bot_user_id Bot's user identifier +//@description Returns information about a bot that can be added to attachment or side menu @bot_user_id Bot's user identifier getAttachmentMenuBot bot_user_id:int53 = AttachmentMenuBot; -//@description Adds or removes a bot to attachment menu. Bot can be added to attachment menu, only if userTypeBot.can_be_added_to_attachment_menu == true +//@description Adds or removes a bot to attachment and side menu. Bot can be added to the menu, only if userTypeBot.can_be_added_to_attachment_menu == true //@bot_user_id Bot's user identifier //@is_added Pass true to add the bot to attachment menu; pass false to remove the bot from attachment menu //@allow_write_access Pass true if the current user allowed the bot to send them messages. Ignored if is_added is false @@ -8006,6 +8069,13 @@ getUserProfilePhotos user_id:int53 offset:int32 limit:int32 = ChatPhotos; //@chat_id Chat identifier for which to return stickers. Available custom emoji stickers may be different for different chats getStickers sticker_type:StickerType query:string limit:int32 chat_id:int53 = Stickers; +//@description Returns unique emoji that correspond to stickers to be found by the getStickers(sticker_type, query, 1000000, chat_id) +//@sticker_type Type of the stickers to search for +//@query Search query +//@chat_id Chat identifier for which to find stickers +//@return_only_main_emoji Pass true if only main emoji for each found sticker must be included in the result +getAllStickerEmojis sticker_type:StickerType query:string chat_id:int53 return_only_main_emoji:Bool = Emojis; + //@description Searches for stickers from public sticker sets that correspond to any of the given emoji //@sticker_type Type of the stickers to return //@emojis Space-separated list of emoji to search for; must be non-empty @@ -8216,6 +8286,19 @@ setDefaultGroupAdministratorRights default_group_administrator_rights:chatAdmini setDefaultChannelAdministratorRights default_channel_administrator_rights:chatAdministratorRights = Ok; +//@description Checks whether the specified bot can send messages to the user. Returns a 404 error if can't and the access can be granted by call to allowBotToSendMessages @bot_user_id Identifier of the target bot +canBotSendMessages bot_user_id:int53 = Ok; + +//@description Allows the specified bot to send messages to the user @bot_user_id Identifier of the target bot +allowBotToSendMessages bot_user_id:int53 = Ok; + +//@description Sends a custom request from a Web App +//@bot_user_id Identifier of the bot +//@method The method name +//@parameters JSON-serialized method parameters +sendWebAppCustomRequest bot_user_id:int53 method:string parameters:string = CustomRequestResult; + + //@description Sets the name of a bot. Can be called only if userTypeBot.can_be_edited == true //@bot_user_id Identifier of the target bot //@language_code A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose languages there is no dedicated name @@ -8271,6 +8354,9 @@ terminateSession session_id:int64 = Ok; //@description Terminates all other sessions of the current user terminateAllOtherSessions = Ok; +//@description Confirms an unconfirmed session of the current user from another device @session_id Session identifier +confirmSession session_id:int64 = Ok; + //@description Toggles whether a session can accept incoming calls @session_id Session identifier @can_accept_calls Pass true to allow accepting incoming calls by the session; pass false otherwise toggleSessionCanAcceptCalls session_id:int64 can_accept_calls:Bool = Ok; @@ -8453,7 +8539,7 @@ synchronizeLanguagePack language_pack_id:string = Ok; addCustomServerLanguagePack language_pack_id:string = Ok; //@description Adds or changes a custom local language pack to the current localization target -//@info Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization +//@info Information about the language pack. Language pack identifier must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization //@strings Strings of the new language pack setCustomLanguagePack info:languagePackInfo strings:vector = Ok; @@ -8809,6 +8895,14 @@ assignGooglePlayTransaction package_name:string store_product_id:string purchase acceptTermsOfService terms_of_service_id:string = Ok; +//@description Searches specified query by word prefixes in the provided strings. Returns 0-based positions of strings that matched. Can be called synchronously +//@strings The strings to search in for the query +//@query Query to search for +//@limit The maximum number of objects to return +//@return_none_for_empty_query Pass true to receive no results for an empty query +searchStringsByPrefix strings:vector query:string limit:int32 return_none_for_empty_query:Bool = FoundPositions; + + //@description Sends a custom request; for bots only @method The method name @parameters JSON-serialized method parameters sendCustomRequest method:string parameters:string = CustomRequestResult; @@ -8853,7 +8947,7 @@ getApplicationDownloadLink = HttpUrl; //@description Adds a proxy server for network requests. Can be called before authorization -//@server Proxy server IP address +//@server Proxy server domain or IP address //@port Proxy server port //@enable Pass true to immediately enable the proxy //@type Proxy type @@ -8861,7 +8955,7 @@ addProxy server:string port:int32 enable:Bool type:ProxyType = Proxy; //@description Edits an existing proxy server for network requests. Can be called before authorization //@proxy_id Proxy identifier -//@server Proxy server IP address +//@server Proxy server domain or IP address //@port Proxy server port //@enable Pass true to immediately enable the proxy //@type Proxy type @@ -8955,7 +9049,7 @@ testSquareInt x:int32 = TestInt; testNetwork = Ok; //@description Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization -//@server Proxy server IP address +//@server Proxy server domain or IP address //@port Proxy server port //@type Proxy type //@dc_id Identifier of a datacenter with which to test connection