diff --git a/client/function.go b/client/function.go index cb35a79..dac31ca 100755 --- a/client/function.go +++ b/client/function.go @@ -2121,7 +2121,7 @@ type DeleteChatRequest struct { ChatId int64 `json:"chat_id"` } -// Deletes a chat along with all messages in the corresponding chat for all chat members. For group chats this will release the username and remove all members. Use the field chat.can_be_deleted_for_all_users to find whether the method can be applied to the chat +// Deletes a chat along with all messages in the corresponding chat for all chat members. For group chats this will release the usernames and remove all members. Use the field chat.can_be_deleted_for_all_users to find whether the method can be applied to the chat func (client *Client) DeleteChat(req *DeleteChatRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -2161,7 +2161,7 @@ type SearchChatMessagesRequest struct { MessageThreadId int64 `json:"message_thread_id"` } -// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2540,6 +2540,41 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou return UnmarshalCount(result.Data) } +type GetChatMessagePositionRequest struct { + // Identifier of the chat in which to find message position + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function + Filter SearchMessagesFilter `json:"filter"` + // If not 0, only messages in the specified thread will be considered; supergroups only + MessageThreadId int64 `json:"message_thread_id"` +} + +// Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats +func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatMessagePosition", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "filter": req.Filter, + "message_thread_id": req.MessageThreadId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + type GetChatScheduledMessagesRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -2601,16 +2636,16 @@ func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequ return UnmarshalFoundMessages(result.Data) } -type GetChatSponsoredMessageRequest struct { +type GetChatSponsoredMessagesRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` } -// Returns sponsored message to be shown in a chat; for channel chats only. Returns a 404 error if there is no sponsored message in the chat -func (client *Client) GetChatSponsoredMessage(req *GetChatSponsoredMessageRequest) (*SponsoredMessage, error) { +// Returns sponsored messages to be shown in a chat; for channel chats only +func (client *Client) GetChatSponsoredMessages(req *GetChatSponsoredMessagesRequest) (*SponsoredMessages, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatSponsoredMessage", + Type: "getChatSponsoredMessages", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -2624,7 +2659,7 @@ func (client *Client) GetChatSponsoredMessage(req *GetChatSponsoredMessageReques return nil, buildResponseError(result.Data) } - return UnmarshalSponsoredMessage(result.Data) + return UnmarshalSponsoredMessages(result.Data) } type RemoveNotificationRequest struct { @@ -2694,8 +2729,8 @@ type GetMessageLinkRequest struct { MediaTimestamp int32 `json:"media_timestamp"` // Pass true to create a link for the whole media album ForAlbum bool `json:"for_album"` - // Pass true to create a link to the message as a channel post comment, or from a message thread - ForComment bool `json:"for_comment"` + // Pass true to create a link to the message as a channel post comment, in a message thread, or a forum topic + InMessageThread bool `json:"in_message_thread"` } // Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels, or if message.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request @@ -2709,7 +2744,7 @@ func (client *Client) GetMessageLink(req *GetMessageLinkRequest) (*MessageLink, "message_id": req.MessageId, "media_timestamp": req.MediaTimestamp, "for_album": req.ForAlbum, - "for_comment": req.ForComment, + "in_message_thread": req.InMessageThread, }, }) if err != nil { @@ -2820,7 +2855,7 @@ type RecognizeSpeechRequest struct { MessageId int64 `json:"message_id"` } -// Recognizes speech in a voice note message. The message must be successfully sent and must not be scheduled. May return an error with a message "MSG_VOICE_TOO_LONG" if the voice note is too long to be recognized +// Recognizes speech in a video note or a voice note message. The message must be successfully sent and must not be scheduled. May return an error with a message "MSG_VOICE_TOO_LONG" if media duration is too big to be recognized func (client *Client) RecognizeSpeech(req *RecognizeSpeechRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -2851,7 +2886,7 @@ type RateSpeechRecognitionRequest struct { IsGood bool `json:"is_good"` } -// Rates recognized speech in a voice note message +// Rates recognized speech in a video note or a voice note message func (client *Client) RateSpeechRecognition(req *RateSpeechRecognitionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -2880,7 +2915,7 @@ type GetChatAvailableMessageSendersRequest struct { } // Returns list of message sender identifiers, which can be used to send messages in a chat -func (client *Client) GetChatAvailableMessageSenders(req *GetChatAvailableMessageSendersRequest) (*MessageSenders, error) { +func (client *Client) GetChatAvailableMessageSenders(req *GetChatAvailableMessageSendersRequest) (*ChatMessageSenders, error) { result, err := client.Send(Request{ meta: meta{ Type: "getChatAvailableMessageSenders", @@ -2897,7 +2932,7 @@ func (client *Client) GetChatAvailableMessageSenders(req *GetChatAvailableMessag return nil, buildResponseError(result.Data) } - return UnmarshalMessageSenders(result.Data) + return UnmarshalChatMessageSenders(result.Data) } type SetChatMessageSenderRequest struct { @@ -3090,6 +3125,8 @@ func (client *Client) SendInlineQueryResultMessage(req *SendInlineQueryResultMes type ForwardMessagesRequest struct { // Identifier of the chat to which to forward messages ChatId int64 `json:"chat_id"` + // If not 0, a message thread identifier in which the message will be sent; for forum threads only + MessageThreadId int64 `json:"message_thread_id"` // Identifier of the chat from which to forward messages FromChatId int64 `json:"from_chat_id"` // Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously @@ -3112,6 +3149,7 @@ func (client *Client) ForwardMessages(req *ForwardMessagesRequest) (*Messages, e }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, "from_chat_id": req.FromChatId, "message_ids": req.MessageIds, "options": req.Options, @@ -3693,6 +3731,153 @@ func (client *Client) EditMessageSchedulingState(req *EditMessageSchedulingState return UnmarshalOk(result.Data) } +// Returns list of custom emojis, which can be used as forum topic icon by all users +func (client *Client) GetForumTopicDefaultIcons() (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getForumTopicDefaultIcons", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + +type CreateForumTopicRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Name of the topic; 1-128 characters + Name string `json:"name"` + // Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, other users can use only a custom emoji returned by getForumTopicDefaultIcons + Icon *ForumTopicIcon `json:"icon"` +} + +// Creates a topic in a forum supergroup chat; requires can_manage_topics rights in the supergroup +func (client *Client) CreateForumTopic(req *CreateForumTopicRequest) (*ForumTopicInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createForumTopic", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "name": req.Name, + "icon": req.Icon, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalForumTopicInfo(result.Data) +} + +type EditForumTopicRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Message thread identifier of the forum topic + MessageThreadId int64 `json:"message_thread_id"` + // New name of the topic; 1-128 characters + Name string `json:"name"` + // Identifier of the new custom emoji for topic icon. Telegram Premium users can use any custom emoji, other users can use only a custom emoji returned by getForumTopicDefaultIcons + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` +} + +// Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator rights in the supergroup unless the user is creator of the topic +func (client *Client) EditForumTopic(req *EditForumTopicRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editForumTopic", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + "name": req.Name, + "icon_custom_emoji_id": req.IconCustomEmojiId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleForumTopicIsClosedRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Message thread identifier of the forum topic + MessageThreadId int64 `json:"message_thread_id"` + // Pass true to close the topic; pass false to reopen it + IsClosed bool `json:"is_closed"` +} + +// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator rights in the supergroup unless the user is creator of the topic +func (client *Client) ToggleForumTopicIsClosed(req *ToggleForumTopicIsClosedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleForumTopicIsClosed", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + "is_closed": req.IsClosed, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteForumTopicRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Message thread identifier of the forum topic + MessageThreadId int64 `json:"message_thread_id"` +} + +// Deletes all messages in a forum topic; requires can_delete_messages administrator rights in the supergroup unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages +func (client *Client) DeleteForumTopic(req *DeleteForumTopicRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteForumTopic", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetEmojiReactionRequest struct { // Text representation of the reaction Emoji string `json:"emoji"` @@ -3719,8 +3904,8 @@ func (client *Client) GetEmojiReaction(req *GetEmojiReactionRequest) (*EmojiReac return UnmarshalEmojiReaction(result.Data) } -// Returns TGS files with generic animations for custom emoji reactions -func (client *Client) GetCustomEmojiReactionAnimations() (*Files, error) { +// Returns TGS stickers with generic animations for custom emoji reactions +func (client *Client) GetCustomEmojiReactionAnimations() (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ Type: "getCustomEmojiReactionAnimations", @@ -3735,7 +3920,7 @@ func (client *Client) GetCustomEmojiReactionAnimations() (*Files, error) { return nil, buildResponseError(result.Data) } - return UnmarshalFiles(result.Data) + return UnmarshalStickers(result.Data) } type GetMessageAvailableReactionsRequest struct { @@ -3928,7 +4113,7 @@ type GetTextEntitiesRequest struct { Text string `json:"text"` } -// Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) contained in the text. Can be called synchronously +// Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) found in the text. Can be called synchronously func GetTextEntities(req *GetTextEntitiesRequest) (*TextEntities, error) { result, err := Execute(Request{ meta: meta{ @@ -3950,7 +4135,7 @@ func GetTextEntities(req *GetTextEntitiesRequest) (*TextEntities, error) { } // deprecated -// Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) contained in the text. Can be called synchronously +// Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) found in the text. Can be called synchronously func (client *Client) GetTextEntities(req *GetTextEntitiesRequest) (*TextEntities, error) { return GetTextEntities(req)} @@ -3961,7 +4146,7 @@ type ParseTextEntitiesRequest struct { ParseMode TextParseMode `json:"parse_mode"` } -// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities contained in the text. Can be called synchronously +// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously func ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { result, err := Execute(Request{ meta: meta{ @@ -3984,7 +4169,7 @@ func ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { } // deprecated -// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities contained in the text. Can be called synchronously +// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously func (client *Client) ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { return ParseTextEntities(req)} @@ -4673,6 +4858,8 @@ type OpenWebAppRequest struct { Theme *ThemeParameters `json:"theme"` // Short name of the application; 0-64 English letters, digits, and underscores ApplicationName string `json:"application_name"` + // If not 0, a message thread identifier in which the message will be sent + MessageThreadId int64 `json:"message_thread_id"` // Identifier of the replied message for the message sent by the Web App; 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` } @@ -4689,6 +4876,7 @@ func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { "url": req.Url, "theme": req.Theme, "application_name": req.ApplicationName, + "message_thread_id": req.MessageThreadId, "reply_to_message_id": req.ReplyToMessageId, }, }) @@ -5453,12 +5641,41 @@ func (client *Client) ReadAllChatMentions(req *ReadAllChatMentionsRequest) (*Ok, return UnmarshalOk(result.Data) } +type ReadAllMessageThreadMentionsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message thread identifier in which mentions are marked as read + MessageThreadId int64 `json:"message_thread_id"` +} + +// Marks all mentions in a forum topic as read +func (client *Client) ReadAllMessageThreadMentions(req *ReadAllMessageThreadMentionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readAllMessageThreadMentions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ReadAllChatReactionsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` } -// Marks all reactions in a chat as read +// Marks all reactions in a chat or a forum topic as read func (client *Client) ReadAllChatReactions(req *ReadAllChatReactionsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -5479,6 +5696,35 @@ func (client *Client) ReadAllChatReactions(req *ReadAllChatReactionsRequest) (*O return UnmarshalOk(result.Data) } +type ReadAllMessageThreadReactionsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message thread identifier in which reactions are marked as read + MessageThreadId int64 `json:"message_thread_id"` +} + +// Marks all reactions in a forum topic as read +func (client *Client) ReadAllMessageThreadReactions(req *ReadAllMessageThreadReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readAllMessageThreadReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CreatePrivateChatRequest struct { // User identifier UserId int64 `json:"user_id"` @@ -6509,6 +6755,35 @@ func (client *Client) UnpinAllChatMessages(req *UnpinAllChatMessagesRequest) (*O return UnmarshalOk(result.Data) } +type UnpinAllMessageThreadMessagesRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Message thread identifier in which messages will be unpinned + MessageThreadId int64 `json:"message_thread_id"` +} + +// Removes all pinned messages from a forum topic; requires can_pin_messages rights in the supergroup +func (client *Client) UnpinAllMessageThreadMessages(req *UnpinAllMessageThreadMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "unpinAllMessageThreadMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type JoinChatRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -6795,7 +7070,7 @@ type SearchChatMembersRequest struct { Filter ChatMembersFilter `json:"filter"` } -// Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels +// Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights in channels func (client *Client) SearchChatMembers(req *SearchChatMembersRequest) (*ChatMembers, error) { result, err := client.Send(Request{ meta: meta{ @@ -9839,17 +10114,17 @@ func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*C } type GetStickersRequest struct { - // Type of the sticker sets to return + // Type of the stickers to return StickerType StickerType `json:"sticker_type"` - // String representation of emoji. If empty, returns all known installed stickers - Emoji string `json:"emoji"` + // Search query; an emoji or a keyword prefix. If empty, returns all known installed stickers + Query string `json:"query"` // The maximum number of stickers to be returned Limit int32 `json:"limit"` - // Chat identifier for which to return stickers. Available custom emoji may be different for different chats + // Chat identifier for which to return stickers. Available custom emoji stickers may be different for different chats ChatId int64 `json:"chat_id"` } -// Returns stickers from the installed sticker sets that correspond to a given emoji. If the emoji is non-empty, then favorite, recently used or trending stickers may also be returned +// Returns stickers from the installed sticker sets that correspond to a given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned func (client *Client) GetStickers(req *GetStickersRequest) (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -9857,7 +10132,7 @@ func (client *Client) GetStickers(req *GetStickersRequest) (*Stickers, error) { }, Data: map[string]interface{}{ "sticker_type": req.StickerType, - "emoji": req.Emoji, + "query": req.Query, "limit": req.Limit, "chat_id": req.ChatId, }, @@ -10866,11 +11141,11 @@ func (client *Client) SetBio(req *SetBioRequest) (*Ok, error) { } type SetUsernameRequest struct { - // The new value of the username. Use an empty string to remove the username + // The new value of the username. Use an empty string to remove the username. The username can't be completely removed if there is another active or disabled username Username string `json:"username"` } -// Changes the username of the current user +// Changes the editable username of the current user func (client *Client) SetUsername(req *SetUsernameRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -10891,6 +11166,61 @@ func (client *Client) SetUsername(req *SetUsernameRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type ToggleUsernameIsActiveRequest struct { + // The username to change + Username string `json:"username"` + // Pass true to activate the username; pass false to disable it + IsActive bool `json:"is_active"` +} + +// Changes active state for a username of the current user. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached +func (client *Client) ToggleUsernameIsActive(req *ToggleUsernameIsActiveRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleUsernameIsActive", + }, + Data: map[string]interface{}{ + "username": req.Username, + "is_active": req.IsActive, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReorderActiveUsernamesRequest struct { + // The new order of active usernames. All currently active usernames must be specified + Usernames []string `json:"usernames"` +} + +// Changes order of active usernames of the current user +func (client *Client) ReorderActiveUsernames(req *ReorderActiveUsernamesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderActiveUsernames", + }, + Data: map[string]interface{}{ + "usernames": req.Usernames, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetEmojiStatusRequest struct { // New emoji status; pass null to switch to the default badge EmojiStatus *EmojiStatus `json:"emoji_status"` @@ -11432,11 +11762,11 @@ func (client *Client) DisconnectAllWebsites() (*Ok, error) { type SetSupergroupUsernameRequest struct { // Identifier of the supergroup or channel SupergroupId int64 `json:"supergroup_id"` - // New value of the username. Use an empty string to remove the username + // New value of the username. Use an empty string to remove the username. The username can't be completely removed if there is another active or disabled username Username string `json:"username"` } -// Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel +// Changes the editable username of a supergroup or channel, requires owner privileges in the supergroup or channel func (client *Client) SetSupergroupUsername(req *SetSupergroupUsernameRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11458,6 +11788,93 @@ func (client *Client) SetSupergroupUsername(req *SetSupergroupUsernameRequest) ( return UnmarshalOk(result.Data) } +type ToggleSupergroupUsernameIsActiveRequest struct { + // Identifier of the supergroup or channel + SupergroupId int64 `json:"supergroup_id"` + // The username to change + Username string `json:"username"` + // Pass true to activate the username; pass false to disable it + IsActive bool `json:"is_active"` +} + +// Changes active state for a username of a supergroup or channel, requires owner privileges in the supergroup or channel. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached +func (client *Client) ToggleSupergroupUsernameIsActive(req *ToggleSupergroupUsernameIsActiveRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupUsernameIsActive", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "username": req.Username, + "is_active": req.IsActive, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DisableAllSupergroupUsernamesRequest struct { + // Identifier of the supergroup or channel + SupergroupId int64 `json:"supergroup_id"` +} + +// Disables all active non-editable usernames of a supergroup or channel, requires owner privileges in the supergroup or channel +func (client *Client) DisableAllSupergroupUsernames(req *DisableAllSupergroupUsernamesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "disableAllSupergroupUsernames", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReorderSupergroupActiveUsernamesRequest struct { + // Identifier of the supergroup or channel + SupergroupId int64 `json:"supergroup_id"` + // The new order of active usernames. All currently active usernames must be specified + Usernames []string `json:"usernames"` +} + +// Changes order of active usernames of a supergroup or channel, requires owner privileges in the supergroup or channel +func (client *Client) ReorderSupergroupActiveUsernames(req *ReorderSupergroupActiveUsernamesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderSupergroupActiveUsernames", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "usernames": req.Usernames, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetSupergroupStickerSetRequest struct { // Identifier of the supergroup SupergroupId int64 `json:"supergroup_id"` @@ -11603,6 +12020,35 @@ func (client *Client) ToggleSupergroupIsAllHistoryAvailable(req *ToggleSupergrou return UnmarshalOk(result.Data) } +type ToggleSupergroupIsForumRequest struct { + // Identifier of the supergroup + SupergroupId int64 `json:"supergroup_id"` + // New value of is_forum. A supergroup can be converted to a forum, only if it has at least GetOption("forum_member_count_min") members + IsForum bool `json:"is_forum"` +} + +// Toggles whether the supergroup is a forum; requires owner privileges in the supergroup +func (client *Client) ToggleSupergroupIsForum(req *ToggleSupergroupIsForumRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupIsForum", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "is_forum": req.IsForum, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupIsBroadcastGroupRequest struct { // Identifier of the supergroup SupergroupId int64 `json:"supergroup_id"` @@ -15603,6 +16049,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(result.Data) + case TypeUpdateForumTopicInfo: + return UnmarshalUpdateForumTopicInfo(result.Data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(result.Data) diff --git a/client/type.go b/client/type.go index f565b87..d512da5 100755 --- a/client/type.go +++ b/client/type.go @@ -44,6 +44,7 @@ const ( ClassInputCredentials = "InputCredentials" ClassPaymentProvider = "PaymentProvider" ClassInputInvoice = "InputInvoice" + ClassMessageExtendedMedia = "MessageExtendedMedia" ClassPassportElementType = "PassportElementType" ClassPassportElement = "PassportElement" ClassInputPassportElement = "InputPassportElement" @@ -121,7 +122,6 @@ const ( ClassLocalFile = "LocalFile" ClassRemoteFile = "RemoteFile" ClassFile = "File" - ClassFiles = "Files" ClassPhotoSize = "PhotoSize" ClassMinithumbnail = "Minithumbnail" ClassThumbnail = "Thumbnail" @@ -156,6 +156,7 @@ const ( ClassPremiumPaymentOption = "PremiumPaymentOption" ClassEmojiStatus = "EmojiStatus" ClassEmojiStatuses = "EmojiStatuses" + ClassUsernames = "Usernames" ClassUser = "User" ClassBotInfo = "BotInfo" ClassUserFullInfo = "UserFullInfo" @@ -180,6 +181,8 @@ const ( ClassSupergroupFullInfo = "SupergroupFullInfo" ClassSecretChat = "SecretChat" ClassMessageSenders = "MessageSenders" + ClassChatMessageSender = "ChatMessageSender" + ClassChatMessageSenders = "ChatMessageSenders" ClassMessageForwardInfo = "MessageForwardInfo" ClassMessageReplyInfo = "MessageReplyInfo" ClassMessageReaction = "MessageReaction" @@ -193,6 +196,7 @@ const ( ClassMessageCalendarDay = "MessageCalendarDay" ClassMessageCalendar = "MessageCalendar" ClassSponsoredMessage = "SponsoredMessage" + ClassSponsoredMessages = "SponsoredMessages" ClassFileDownload = "FileDownload" ClassDownloadedFileCounts = "DownloadedFileCounts" ClassFoundFileDownloads = "FoundFileDownloads" @@ -214,6 +218,9 @@ const ( ClassInlineKeyboardButton = "InlineKeyboardButton" ClassWebAppInfo = "WebAppInfo" ClassMessageThreadInfo = "MessageThreadInfo" + ClassForumTopicIcon = "ForumTopicIcon" + ClassForumTopicInfo = "ForumTopicInfo" + ClassForumTopic = "ForumTopic" ClassPageBlockCaption = "PageBlockCaption" ClassPageBlockListItem = "PageBlockListItem" ClassPageBlockTableCell = "PageBlockTableCell" @@ -397,7 +404,6 @@ const ( TypeLocalFile = "localFile" TypeRemoteFile = "remoteFile" TypeFile = "file" - TypeFiles = "files" TypeInputFileId = "inputFileId" TypeInputFileRemote = "inputFileRemote" TypeInputFileLocal = "inputFileLocal" @@ -462,6 +468,7 @@ const ( TypePremiumPaymentOption = "premiumPaymentOption" TypeEmojiStatus = "emojiStatus" TypeEmojiStatuses = "emojiStatuses" + TypeUsernames = "usernames" TypeUser = "user" TypeBotInfo = "botInfo" TypeUserFullInfo = "userFullInfo" @@ -512,6 +519,8 @@ const ( TypeMessageSenderUser = "messageSenderUser" TypeMessageSenderChat = "messageSenderChat" TypeMessageSenders = "messageSenders" + TypeChatMessageSender = "chatMessageSender" + TypeChatMessageSenders = "chatMessageSenders" TypeMessageForwardOriginUser = "messageForwardOriginUser" TypeMessageForwardOriginChat = "messageForwardOriginChat" TypeMessageForwardOriginHiddenUser = "messageForwardOriginHiddenUser" @@ -534,6 +543,7 @@ const ( TypeMessageCalendarDay = "messageCalendarDay" TypeMessageCalendar = "messageCalendar" TypeSponsoredMessage = "sponsoredMessage" + TypeSponsoredMessages = "sponsoredMessages" TypeFileDownload = "fileDownload" TypeDownloadedFileCounts = "downloadedFileCounts" TypeFoundFileDownloads = "foundFileDownloads" @@ -598,6 +608,9 @@ const ( TypeLoginUrlInfoRequestConfirmation = "loginUrlInfoRequestConfirmation" TypeWebAppInfo = "webAppInfo" TypeMessageThreadInfo = "messageThreadInfo" + TypeForumTopicIcon = "forumTopicIcon" + TypeForumTopicInfo = "forumTopicInfo" + TypeForumTopic = "forumTopic" TypeRichTextPlain = "richTextPlain" TypeRichTextBold = "richTextBold" TypeRichTextItalic = "richTextItalic" @@ -682,6 +695,10 @@ const ( TypePaymentReceipt = "paymentReceipt" TypeInputInvoiceMessage = "inputInvoiceMessage" TypeInputInvoiceName = "inputInvoiceName" + TypeMessageExtendedMediaPreview = "messageExtendedMediaPreview" + TypeMessageExtendedMediaPhoto = "messageExtendedMediaPhoto" + TypeMessageExtendedMediaVideo = "messageExtendedMediaVideo" + TypeMessageExtendedMediaUnsupported = "messageExtendedMediaUnsupported" TypeDatedFile = "datedFile" TypePassportElementTypePersonalDetails = "passportElementTypePersonalDetails" TypePassportElementTypePassport = "passportElementTypePassport" @@ -794,6 +811,9 @@ const ( TypeMessageScreenshotTaken = "messageScreenshotTaken" TypeMessageChatSetTheme = "messageChatSetTheme" TypeMessageChatSetTtl = "messageChatSetTtl" + TypeMessageForumTopicCreated = "messageForumTopicCreated" + TypeMessageForumTopicEdited = "messageForumTopicEdited" + TypeMessageForumTopicIsClosedToggled = "messageForumTopicIsClosedToggled" TypeMessageCustomServiceAction = "messageCustomServiceAction" TypeMessageGameScore = "messageGameScore" TypeMessagePaymentSuccessful = "messagePaymentSuccessful" @@ -1003,6 +1023,7 @@ const ( TypeChatEventStickerSetChanged = "chatEventStickerSetChanged" TypeChatEventTitleChanged = "chatEventTitleChanged" TypeChatEventUsernameChanged = "chatEventUsernameChanged" + TypeChatEventActiveUsernamesChanged = "chatEventActiveUsernamesChanged" TypeChatEventHasProtectedContentToggled = "chatEventHasProtectedContentToggled" TypeChatEventInvitesToggled = "chatEventInvitesToggled" TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled" @@ -1015,6 +1036,12 @@ const ( TypeChatEventVideoChatMuteNewParticipantsToggled = "chatEventVideoChatMuteNewParticipantsToggled" TypeChatEventVideoChatParticipantIsMutedToggled = "chatEventVideoChatParticipantIsMutedToggled" TypeChatEventVideoChatParticipantVolumeLevelChanged = "chatEventVideoChatParticipantVolumeLevelChanged" + TypeChatEventIsForumToggled = "chatEventIsForumToggled" + TypeChatEventForumTopicCreated = "chatEventForumTopicCreated" + TypeChatEventForumTopicEdited = "chatEventForumTopicEdited" + TypeChatEventForumTopicToggleIsClosed = "chatEventForumTopicToggleIsClosed" + TypeChatEventForumTopicDeleted = "chatEventForumTopicDeleted" + TypeChatEventForumTopicPinned = "chatEventForumTopicPinned" TypeChatEvent = "chatEvent" TypeChatEvents = "chatEvents" TypeChatEventLogFilters = "chatEventLogFilters" @@ -1047,6 +1074,7 @@ const ( TypePremiumFeatureProfileBadge = "premiumFeatureProfileBadge" TypePremiumFeatureEmojiStatus = "premiumFeatureEmojiStatus" TypePremiumFeatureAnimatedProfilePhoto = "premiumFeatureAnimatedProfilePhoto" + TypePremiumFeatureForumTopicIcon = "premiumFeatureForumTopicIcon" TypePremiumFeatureAppIcons = "premiumFeatureAppIcons" TypePremiumLimit = "premiumLimit" TypePremiumFeatures = "premiumFeatures" @@ -1373,6 +1401,7 @@ const ( TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread" TypeUpdateChatFilters = "updateChatFilters" TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" + TypeUpdateForumTopicInfo = "updateForumTopicInfo" TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" TypeUpdateNotification = "updateNotification" TypeUpdateNotificationGroup = "updateNotificationGroup" @@ -1633,11 +1662,16 @@ type PaymentProvider interface { PaymentProviderType() string } -// Describe an invoice to process +// Describes an invoice to process type InputInvoice interface { InputInvoiceType() string } +// Describes a media, which is attached to an invoice +type MessageExtendedMedia interface { + MessageExtendedMediaType() string +} + // Contains the type of a Telegram Passport element type PassportElementType interface { PassportElementTypeType() string @@ -2372,7 +2406,7 @@ type FormattedText struct { meta // The text Text string `json:"text"` - // Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and to be contained in all other entities. All other entities can't contain each other + // Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other Entities []*TextEntity `json:"entities"` } @@ -2927,29 +2961,6 @@ func (*File) GetType() string { return TypeFile } -// Represents a list of files -type Files struct { - meta - // List of files - Files []*File `json:"files"` -} - -func (entity *Files) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Files - - return json.Marshal((*stub)(entity)) -} - -func (*Files) GetClass() string { - return ClassFiles -} - -func (*Files) GetType() string { - return TypeFiles -} - // A file defined by its unique ID type InputFileId struct { meta @@ -4047,12 +4058,16 @@ type VideoNote struct { meta // Duration of the video, in seconds; as defined by the sender Duration int32 `json:"duration"` + // A waveform representation of the video note's audio in 5-bit format; may be empty if unknown + Waveform []byte `json:"waveform"` // Video width and height; as defined by the sender Length int32 `json:"length"` // Video minithumbnail; may be null Minithumbnail *Minithumbnail `json:"minithumbnail"` // Video thumbnail in JPEG format; as defined by the sender; may be null Thumbnail *Thumbnail `json:"thumbnail"` + // Result of speech recognition in the video note; may be null + SpeechRecognitionResult SpeechRecognitionResult `json:"speech_recognition_result"` // File containing the video Video *File `json:"video"` } @@ -4073,6 +4088,35 @@ func (*VideoNote) GetType() string { return TypeVideoNote } +func (videoNote *VideoNote) UnmarshalJSON(data []byte) error { + var tmp struct { + Duration int32 `json:"duration"` + Waveform []byte `json:"waveform"` + Length int32 `json:"length"` + Minithumbnail *Minithumbnail `json:"minithumbnail"` + Thumbnail *Thumbnail `json:"thumbnail"` + SpeechRecognitionResult json.RawMessage `json:"speech_recognition_result"` + Video *File `json:"video"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + videoNote.Duration = tmp.Duration + videoNote.Waveform = tmp.Waveform + videoNote.Length = tmp.Length + videoNote.Minithumbnail = tmp.Minithumbnail + videoNote.Thumbnail = tmp.Thumbnail + videoNote.Video = tmp.Video + + fieldSpeechRecognitionResult, _ := UnmarshalSpeechRecognitionResult(tmp.SpeechRecognitionResult) + videoNote.SpeechRecognitionResult = fieldSpeechRecognitionResult + + return nil +} + // Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel type VoiceNote struct { meta @@ -4134,6 +4178,10 @@ type AnimatedEmoji struct { meta // Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, it can have arbitrary format different from stickerFormatTgs Sticker *Sticker `json:"sticker"` + // Expected width of the sticker, which can be used if the sticker is null + StickerWidth int32 `json:"sticker_width"` + // Expected height of the sticker, which can be used if the sticker is null + StickerHeight int32 `json:"sticker_height"` // Emoji modifier fitzpatrick type; 0-6; 0 if none FitzpatrickType int32 `json:"fitzpatrick_type"` // File containing the sound to be played when the sticker is clicked; may be null. The sound is encoded with the Opus codec, and stored inside an OGG container @@ -4858,6 +4906,8 @@ type ChatPermissions struct { CanInviteUsers bool `json:"can_invite_users"` // True, if the user can pin messages CanPinMessages bool `json:"can_pin_messages"` + // True, if the user can manage topics + CanManageTopics bool `json:"can_manage_topics"` } func (entity *ChatPermissions) MarshalJSON() ([]byte, error) { @@ -4895,6 +4945,8 @@ type ChatAdministratorRights struct { CanRestrictMembers bool `json:"can_restrict_members"` // True, if the administrator can pin messages; applicable to basic groups and supergroups only CanPinMessages bool `json:"can_pin_messages"` + // True, if the administrator can manage topics; applicable to forum supergroups only + CanManageTopics bool `json:"can_manage_topics"` // True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them CanPromoteMembers bool `json:"can_promote_members"` // True, if the administrator can manage video chats @@ -5025,6 +5077,33 @@ func (*EmojiStatuses) GetType() string { return TypeEmojiStatuses } +// Describes usernames assigned to a user, a supergroup, or a channel +type Usernames struct { + meta + // List of active usernames; the first one must be shown as the primary username. The order of active usernames can be changed with reorderActiveUsernames or reorderSupergroupActiveUsernames + ActiveUsernames []string `json:"active_usernames"` + // List of currently disabled usernames; the username can be activated with toggleUsernameIsActive/toggleSupergroupUsernameIsActive + DisabledUsernames []string `json:"disabled_usernames"` + // The active username, which can be changed with setUsername/setSupergroupUsername + EditableUsername string `json:"editable_username"` +} + +func (entity *Usernames) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Usernames + + return json.Marshal((*stub)(entity)) +} + +func (*Usernames) GetClass() string { + return ClassUsernames +} + +func (*Usernames) GetType() string { + return TypeUsernames +} + // Represents a user type User struct { meta @@ -5036,8 +5115,8 @@ type User struct { FirstName string `json:"first_name"` // Last name of the user LastName string `json:"last_name"` - // Username of the user - Username string `json:"username"` + // Usernames of the user; may be null + Usernames *Usernames `json:"usernames"` // Phone number of the user PhoneNumber string `json:"phone_number"` // Current online status of the user @@ -5094,7 +5173,7 @@ func (user *User) UnmarshalJSON(data []byte) error { AccessHash JsonInt64 `json:"access_hash"` FirstName string `json:"first_name"` LastName string `json:"last_name"` - Username string `json:"username"` + Usernames *Usernames `json:"usernames"` PhoneNumber string `json:"phone_number"` Status json.RawMessage `json:"status"` ProfilePhoto *ProfilePhoto `json:"profile_photo"` @@ -5122,7 +5201,7 @@ func (user *User) UnmarshalJSON(data []byte) error { user.AccessHash = tmp.AccessHash user.FirstName = tmp.FirstName user.LastName = tmp.LastName - user.Username = tmp.Username + user.Usernames = tmp.Usernames user.PhoneNumber = tmp.PhoneNumber user.ProfilePhoto = tmp.ProfilePhoto user.EmojiStatus = tmp.EmojiStatus @@ -5187,7 +5266,7 @@ func (*BotInfo) GetType() string { // Contains full information about a user type UserFullInfo struct { meta - // User profile photo; may be null + // User profile photo; may be null if empty or unknown. If non-null, then it is the same photo as in user.profile_photo and chat.photo Photo *ChatPhoto `json:"photo"` // True, if the user is blocked by the current user IsBlocked bool `json:"is_blocked"` @@ -6330,7 +6409,7 @@ func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { // Contains full information about a basic group type BasicGroupFullInfo struct { meta - // Chat photo; may be null + // Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo Photo *ChatPhoto `json:"photo"` // Group description. Updated only after the basic group is opened Description string `json:"description"` @@ -6367,11 +6446,11 @@ type Supergroup struct { Id int64 `json:"id"` // Supergroup or channel access hash AccessHash JsonInt64 `json:"access_hash"` - // Username of the supergroup or channel; empty for private supergroups or channels - Username string `json:"username"` + // Usernames of the supergroup or channel; may be null + Usernames *Usernames `json:"usernames"` // Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member Date int32 `json:"date"` - // Status of the current user in the supergroup or channel; custom title will be always empty + // Status of the current user in the supergroup or channel; custom title will always be empty Status ChatMemberStatus `json:"status"` // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, or getUserPrivacySettingRules MemberCount int32 `json:"member_count"` @@ -6391,6 +6470,8 @@ type Supergroup struct { IsChannel bool `json:"is_channel"` // True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members IsBroadcastGroup bool `json:"is_broadcast_group"` + // True, if the supergroup must be shown as a forum by default + IsForum bool `json:"is_forum"` // True, if the supergroup or channel is verified IsVerified bool `json:"is_verified"` // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted @@ -6421,7 +6502,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { var tmp struct { Id int64 `json:"id"` AccessHash JsonInt64 `json:"access_hash"` - Username string `json:"username"` + Usernames *Usernames `json:"usernames"` Date int32 `json:"date"` Status json.RawMessage `json:"status"` MemberCount int32 `json:"member_count"` @@ -6433,6 +6514,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { IsSlowModeEnabled bool `json:"is_slow_mode_enabled"` IsChannel bool `json:"is_channel"` IsBroadcastGroup bool `json:"is_broadcast_group"` + IsForum bool `json:"is_forum"` IsVerified bool `json:"is_verified"` RestrictionReason string `json:"restriction_reason"` IsScam bool `json:"is_scam"` @@ -6446,7 +6528,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.Id = tmp.Id supergroup.AccessHash = tmp.AccessHash - supergroup.Username = tmp.Username + supergroup.Usernames = tmp.Usernames supergroup.Date = tmp.Date supergroup.MemberCount = tmp.MemberCount supergroup.HasLinkedChat = tmp.HasLinkedChat @@ -6457,6 +6539,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.IsSlowModeEnabled = tmp.IsSlowModeEnabled supergroup.IsChannel = tmp.IsChannel supergroup.IsBroadcastGroup = tmp.IsBroadcastGroup + supergroup.IsForum = tmp.IsForum supergroup.IsVerified = tmp.IsVerified supergroup.RestrictionReason = tmp.RestrictionReason supergroup.IsScam = tmp.IsScam @@ -6471,7 +6554,7 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { // Contains full information about a supergroup or channel type SupergroupFullInfo struct { meta - // Chat photo; may be null + // Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo Photo *ChatPhoto `json:"photo"` // Supergroup or channel description Description string `json:"description"` @@ -6499,7 +6582,7 @@ type SupergroupFullInfo struct { CanSetLocation bool `json:"can_set_location"` // True, if the supergroup or channel statistics are available CanGetStatistics bool `json:"can_get_statistics"` - // True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. The value of this field is only available for chat administrators + // True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available, so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available for chat administrators IsAllHistoryAvailable bool `json:"is_all_history_available"` // Identifier of the supergroup sticker set; 0 if none StickerSetId JsonInt64 `json:"sticker_set_id"` @@ -6764,6 +6847,73 @@ func (messageSenders *MessageSenders) UnmarshalJSON(data []byte) error { return nil } +// Represents a message sender, which can be used to send messages in a chat +type ChatMessageSender struct { + meta + // Available message senders + Sender MessageSender `json:"sender"` + // True, if Telegram Premium is needed to use the message sender + NeedsPremium bool `json:"needs_premium"` +} + +func (entity *ChatMessageSender) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMessageSender + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMessageSender) GetClass() string { + return ClassChatMessageSender +} + +func (*ChatMessageSender) GetType() string { + return TypeChatMessageSender +} + +func (chatMessageSender *ChatMessageSender) UnmarshalJSON(data []byte) error { + var tmp struct { + Sender json.RawMessage `json:"sender"` + NeedsPremium bool `json:"needs_premium"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatMessageSender.NeedsPremium = tmp.NeedsPremium + + fieldSender, _ := UnmarshalMessageSender(tmp.Sender) + chatMessageSender.Sender = fieldSender + + return nil +} + +// Represents a list of message senders, which can be used to send messages in a chat +type ChatMessageSenders struct { + meta + // List of available message senders + Senders []*ChatMessageSender `json:"senders"` +} + +func (entity *ChatMessageSenders) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMessageSenders + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMessageSenders) GetClass() string { + return ClassChatMessageSenders +} + +func (*ChatMessageSenders) GetType() string { + return TypeChatMessageSenders +} + // The message was originally sent by a known user type MessageForwardOriginUser struct { meta @@ -7307,6 +7457,8 @@ type Message struct { HasTimestampedMedia bool `json:"has_timestamped_media"` // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts IsChannelPost bool `json:"is_channel_post"` + // True, if the message is a forum topic message + IsTopicMessage bool `json:"is_topic_message"` // True, if the message contains an unread mention for the current user ContainsUnreadMention bool `json:"contains_unread_mention"` // Point in time (Unix timestamp) when the message was sent @@ -7381,6 +7533,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { CanReportReactions bool `json:"can_report_reactions"` HasTimestampedMedia bool `json:"has_timestamped_media"` IsChannelPost bool `json:"is_channel_post"` + IsTopicMessage bool `json:"is_topic_message"` ContainsUnreadMention bool `json:"contains_unread_mention"` Date int32 `json:"date"` EditDate int32 `json:"edit_date"` @@ -7422,6 +7575,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.CanReportReactions = tmp.CanReportReactions message.HasTimestampedMedia = tmp.HasTimestampedMedia message.IsChannelPost = tmp.IsChannelPost + message.IsTopicMessage = tmp.IsTopicMessage message.ContainsUnreadMention = tmp.ContainsUnreadMention message.Date = tmp.Date message.EditDate = tmp.EditDate @@ -7621,6 +7775,8 @@ type SponsoredMessage struct { SponsorChatId int64 `json:"sponsor_chat_id"` // Information about the sponsor chat; may be null unless sponsor_chat_id == 0 SponsorChatInfo *ChatInviteLinkInfo `json:"sponsor_chat_info"` + // True, if the sponsor's chat photo must be shown + ShowChatPhoto bool `json:"show_chat_photo"` // An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead Link InternalLinkType `json:"link"` // Content of the message. Currently, can be only of the type messageText @@ -7649,6 +7805,7 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { IsRecommended bool `json:"is_recommended"` SponsorChatId int64 `json:"sponsor_chat_id"` SponsorChatInfo *ChatInviteLinkInfo `json:"sponsor_chat_info"` + ShowChatPhoto bool `json:"show_chat_photo"` Link json.RawMessage `json:"link"` Content json.RawMessage `json:"content"` } @@ -7662,6 +7819,7 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { sponsoredMessage.IsRecommended = tmp.IsRecommended sponsoredMessage.SponsorChatId = tmp.SponsorChatId sponsoredMessage.SponsorChatInfo = tmp.SponsorChatInfo + sponsoredMessage.ShowChatPhoto = tmp.ShowChatPhoto fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) sponsoredMessage.Link = fieldLink @@ -7672,6 +7830,31 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { return nil } +// Contains a list of sponsored messages +type SponsoredMessages struct { + meta + // List of sponsored messages + Messages []*SponsoredMessage `json:"messages"` + // The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages + MessagesBetween int32 `json:"messages_between"` +} + +func (entity *SponsoredMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SponsoredMessages + + return json.Marshal((*stub)(entity)) +} + +func (*SponsoredMessages) GetClass() string { + return ClassSponsoredMessages +} + +func (*SponsoredMessages) GetType() string { + return TypeSponsoredMessages +} + // Describes a file added to file download list type FileDownload struct { meta @@ -8767,7 +8950,7 @@ func (*ChatsNearby) GetType() string { return TypeChatsNearby } -// The chat is public, because it has username +// The chat is public, because it has an active username type PublicChatTypeHasUsername struct{ meta } @@ -8817,7 +9000,7 @@ func (*PublicChatTypeIsLocationBased) PublicChatTypeType() string { return TypePublicChatTypeIsLocationBased } -// The chat can be reported as spam using the method reportChat with the reason chatReportReasonSpam +// The chat can be reported as spam using the method reportChat with the reason chatReportReasonSpam. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown type ChatActionBarReportSpam struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings @@ -8894,7 +9077,7 @@ func (*ChatActionBarInviteMembers) ChatActionBarType() string { return TypeChatActionBarInviteMembers } -// The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method toggleMessageSenderIsBlocked, or the other user can be added to the contact list using the method addContact +// The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method toggleMessageSenderIsBlocked, or the other user can be added to the contact list using the method addContact. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown type ChatActionBarReportAddBlock struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings @@ -9680,7 +9863,7 @@ type MessageThreadInfo struct { ChatId int64 `json:"chat_id"` // Message thread identifier, unique within the chat MessageThreadId int64 `json:"message_thread_id"` - // Information about the message thread + // Information about the message thread; may be null for forum topic threads ReplyInfo *MessageReplyInfo `json:"reply_info"` // Approximate number of unread messages in the message thread UnreadMessageCount int32 `json:"unread_message_count"` @@ -9706,6 +9889,136 @@ func (*MessageThreadInfo) GetType() string { return TypeMessageThreadInfo } +// Describes a forum topic icon +type ForumTopicIcon struct { + meta + // Color of the topic icon in RGB format + Color int32 `json:"color"` + // Unique identifier of the custom emoji shown on the topic icon; 0 if none + CustomEmojiId JsonInt64 `json:"custom_emoji_id"` +} + +func (entity *ForumTopicIcon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ForumTopicIcon + + return json.Marshal((*stub)(entity)) +} + +func (*ForumTopicIcon) GetClass() string { + return ClassForumTopicIcon +} + +func (*ForumTopicIcon) GetType() string { + return TypeForumTopicIcon +} + +// Contains basic information about a forum topic +type ForumTopicInfo struct { + meta + // Message thread identifier of the topic + MessageThreadId int64 `json:"message_thread_id"` + // Name of the topic + Name string `json:"name"` + // Icon of the topic + Icon *ForumTopicIcon `json:"icon"` + // Date the topic was created + CreationDate int32 `json:"creation_date"` + // Identifier of the creator of the topic + CreatorId MessageSender `json:"creator_id"` + // True, if the topic was created by the current user + IsOutgoing bool `json:"is_outgoing"` + // True, if the topic is closed + IsClosed bool `json:"is_closed"` +} + +func (entity *ForumTopicInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ForumTopicInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ForumTopicInfo) GetClass() string { + return ClassForumTopicInfo +} + +func (*ForumTopicInfo) GetType() string { + return TypeForumTopicInfo +} + +func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + MessageThreadId int64 `json:"message_thread_id"` + Name string `json:"name"` + Icon *ForumTopicIcon `json:"icon"` + CreationDate int32 `json:"creation_date"` + CreatorId json.RawMessage `json:"creator_id"` + IsOutgoing bool `json:"is_outgoing"` + IsClosed bool `json:"is_closed"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + forumTopicInfo.MessageThreadId = tmp.MessageThreadId + forumTopicInfo.Name = tmp.Name + forumTopicInfo.Icon = tmp.Icon + forumTopicInfo.CreationDate = tmp.CreationDate + forumTopicInfo.IsOutgoing = tmp.IsOutgoing + forumTopicInfo.IsClosed = tmp.IsClosed + + fieldCreatorId, _ := UnmarshalMessageSender(tmp.CreatorId) + forumTopicInfo.CreatorId = fieldCreatorId + + return nil +} + +// Describes a forum topic +type ForumTopic struct { + meta + // Basic information about the topic + Info *ForumTopicInfo `json:"info"` + // Last message in the topic; may be null + LastMessage *Message `json:"last_message"` + // True, if the topic is pinned in the topic list + IsPinned bool `json:"is_pinned"` + // Number of unread messages in the topic + UnreadCount int32 `json:"unread_count"` + // Identifier of the last read incoming message + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + // Identifier of the last read outgoing message + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Number of unread messages with a mention/reply in the topic + UnreadMentionCount int32 `json:"unread_mention_count"` + // Number of messages with unread reactions in the topic + UnreadReactionCount int32 `json:"unread_reaction_count"` + // Notification settings for the topic + NotificationSettings *ChatNotificationSettings `json:"notification_settings"` + // A draft of a message in the topic; may be null + DraftMessage *DraftMessage `json:"draft_message"` +} + +func (entity *ForumTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ForumTopic + + return json.Marshal((*stub)(entity)) +} + +func (*ForumTopic) GetClass() string { + return ClassForumTopic +} + +func (*ForumTopic) GetType() string { + return TypeForumTopic +} + // A plain text type RichTextPlain struct { meta @@ -12897,6 +13210,126 @@ func (*InputInvoiceName) InputInvoiceType() string { return TypeInputInvoiceName } +// The media is hidden until the invoice is paid +type MessageExtendedMediaPreview struct { + meta + // Media width; 0 if unknown + Width int32 `json:"width"` + // Media height; 0 if unknown + Height int32 `json:"height"` + // Media duration; 0 if unknown + Duration int32 `json:"duration"` + // Media minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Media caption + Caption *FormattedText `json:"caption"` +} + +func (entity *MessageExtendedMediaPreview) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExtendedMediaPreview + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExtendedMediaPreview) GetClass() string { + return ClassMessageExtendedMedia +} + +func (*MessageExtendedMediaPreview) GetType() string { + return TypeMessageExtendedMediaPreview +} + +func (*MessageExtendedMediaPreview) MessageExtendedMediaType() string { + return TypeMessageExtendedMediaPreview +} + +// The media is a photo +type MessageExtendedMediaPhoto struct { + meta + // The photo + Photo *Photo `json:"photo"` + // Photo caption + Caption *FormattedText `json:"caption"` +} + +func (entity *MessageExtendedMediaPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExtendedMediaPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExtendedMediaPhoto) GetClass() string { + return ClassMessageExtendedMedia +} + +func (*MessageExtendedMediaPhoto) GetType() string { + return TypeMessageExtendedMediaPhoto +} + +func (*MessageExtendedMediaPhoto) MessageExtendedMediaType() string { + return TypeMessageExtendedMediaPhoto +} + +// The media is a video +type MessageExtendedMediaVideo struct { + meta + // The video + Video *Video `json:"video"` + // Photo caption + Caption *FormattedText `json:"caption"` +} + +func (entity *MessageExtendedMediaVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExtendedMediaVideo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExtendedMediaVideo) GetClass() string { + return ClassMessageExtendedMedia +} + +func (*MessageExtendedMediaVideo) GetType() string { + return TypeMessageExtendedMediaVideo +} + +func (*MessageExtendedMediaVideo) MessageExtendedMediaType() string { + return TypeMessageExtendedMediaVideo +} + +// The media is unuspported +type MessageExtendedMediaUnsupported struct { + meta + // Media caption + Caption *FormattedText `json:"caption"` +} + +func (entity *MessageExtendedMediaUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExtendedMediaUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExtendedMediaUnsupported) GetClass() string { + return ClassMessageExtendedMedia +} + +func (*MessageExtendedMediaUnsupported) GetType() string { + return TypeMessageExtendedMediaUnsupported +} + +func (*MessageExtendedMediaUnsupported) MessageExtendedMediaType() string { + return TypeMessageExtendedMediaUnsupported +} + // File with the date it was uploaded type DatedFile struct { meta @@ -15622,6 +16055,8 @@ type MessageInvoice struct { NeedShippingAddress bool `json:"need_shipping_address"` // The identifier of the message with the receipt, after the product has been purchased ReceiptMessageId int64 `json:"receipt_message_id"` + // Extended media attached to the invoice; may be null + ExtendedMedia MessageExtendedMedia `json:"extended_media"` } func (entity *MessageInvoice) MarshalJSON() ([]byte, error) { @@ -15644,6 +16079,41 @@ func (*MessageInvoice) MessageContentType() string { return TypeMessageInvoice } +func (messageInvoice *MessageInvoice) UnmarshalJSON(data []byte) error { + var tmp struct { + Title string `json:"title"` + Description *FormattedText `json:"description"` + Photo *Photo `json:"photo"` + Currency string `json:"currency"` + TotalAmount int64 `json:"total_amount"` + StartParameter string `json:"start_parameter"` + IsTest bool `json:"is_test"` + NeedShippingAddress bool `json:"need_shipping_address"` + ReceiptMessageId int64 `json:"receipt_message_id"` + ExtendedMedia json.RawMessage `json:"extended_media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageInvoice.Title = tmp.Title + messageInvoice.Description = tmp.Description + messageInvoice.Photo = tmp.Photo + messageInvoice.Currency = tmp.Currency + messageInvoice.TotalAmount = tmp.TotalAmount + messageInvoice.StartParameter = tmp.StartParameter + messageInvoice.IsTest = tmp.IsTest + messageInvoice.NeedShippingAddress = tmp.NeedShippingAddress + messageInvoice.ReceiptMessageId = tmp.ReceiptMessageId + + fieldExtendedMedia, _ := UnmarshalMessageExtendedMedia(tmp.ExtendedMedia) + messageInvoice.ExtendedMedia = fieldExtendedMedia + + return nil +} + // A message with information about an ended call type MessageCall struct { meta @@ -16209,6 +16679,93 @@ func (*MessageChatSetTtl) MessageContentType() string { return TypeMessageChatSetTtl } +// A forum topic has been created +type MessageForumTopicCreated struct { + meta + // Name of the topic + Name string `json:"name"` + // Icon of the topic + Icon *ForumTopicIcon `json:"icon"` +} + +func (entity *MessageForumTopicCreated) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageForumTopicCreated + + return json.Marshal((*stub)(entity)) +} + +func (*MessageForumTopicCreated) GetClass() string { + return ClassMessageContent +} + +func (*MessageForumTopicCreated) GetType() string { + return TypeMessageForumTopicCreated +} + +func (*MessageForumTopicCreated) MessageContentType() string { + return TypeMessageForumTopicCreated +} + +// A forum topic has been edited +type MessageForumTopicEdited struct { + meta + // If non-empty, the new name of the topic + Name string `json:"name"` + // True, if icon's custom_emoji_id is changed + EditIconCustomEmojiId bool `json:"edit_icon_custom_emoji_id"` + // New unique identifier of the custom emoji shown on the topic icon; 0 if none. Must be ignored if edit_icon_custom_emoji_id is false + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` +} + +func (entity *MessageForumTopicEdited) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageForumTopicEdited + + return json.Marshal((*stub)(entity)) +} + +func (*MessageForumTopicEdited) GetClass() string { + return ClassMessageContent +} + +func (*MessageForumTopicEdited) GetType() string { + return TypeMessageForumTopicEdited +} + +func (*MessageForumTopicEdited) MessageContentType() string { + return TypeMessageForumTopicEdited +} + +// A forum topic has been closed or opened +type MessageForumTopicIsClosedToggled struct { + meta + // True if the topic was closed or reopened + IsClosed bool `json:"is_closed"` +} + +func (entity *MessageForumTopicIsClosedToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageForumTopicIsClosedToggled + + return json.Marshal((*stub)(entity)) +} + +func (*MessageForumTopicIsClosedToggled) GetClass() string { + return ClassMessageContent +} + +func (*MessageForumTopicIsClosedToggled) GetType() string { + return TypeMessageForumTopicIsClosedToggled +} + +func (*MessageForumTopicIsClosedToggled) MessageContentType() string { + return TypeMessageForumTopicIsClosedToggled +} + // A non-standard action has happened in the chat type MessageCustomServiceAction struct { meta @@ -16270,7 +16827,7 @@ func (*MessageGameScore) MessageContentType() string { // A payment has been completed type MessagePaymentSuccessful struct { meta - // Identifier of the chat, containing the corresponding invoice message; 0 if unknown + // Identifier of the chat, containing the corresponding invoice message InvoiceChatId int64 `json:"invoice_chat_id"` // Identifier of the message with the corresponding invoice; can be 0 or an identifier of a deleted message InvoiceMessageId int64 `json:"invoice_message_id"` @@ -16641,7 +17198,7 @@ func (*MessageUnsupported) MessageContentType() string { return TypeMessageUnsupported } -// A mention of a user by their username +// A mention of a user, a supergroup, or a channel by their username type TextEntityTypeMention struct{ meta } @@ -17504,7 +18061,7 @@ type InputMessageDocument struct { Document InputFile `json:"document"` // Document thumbnail; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` - // If true, automatic file type detection will be disabled and the document will be always sent as file. Always true for files sent to secret chats + // If true, automatic file type detection will be disabled and the document will always be sent as file. Always true for files sent to secret chats DisableContentTypeDetection bool `json:"disable_content_type_detection"` // Document caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` @@ -17820,7 +18377,7 @@ type InputMessageVoiceNote struct { VoiceNote InputFile `json:"voice_note"` // Duration of the voice note, in seconds Duration int32 `json:"duration"` - // Waveform representation of the voice note, in 5-bit format + // Waveform representation of the voice note in 5-bit format Waveform []byte `json:"waveform"` // Voice note caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` @@ -18039,6 +18596,8 @@ type InputMessageInvoice struct { ProviderData string `json:"provider_data"` // Unique invoice bot deep link parameter for the generation of this invoice. If empty, it would be possible to pay directly from forwards of the invoice message StartParameter string `json:"start_parameter"` + // The content of extended media attached to the invoice. The content of the message to be sent. Must be one of the following types: inputMessagePhoto, inputMessageVideo + ExtendedMediaContent InputMessageContent `json:"extended_media_content"` } func (entity *InputMessageInvoice) MarshalJSON() ([]byte, error) { @@ -18061,6 +18620,45 @@ func (*InputMessageInvoice) InputMessageContentType() string { return TypeInputMessageInvoice } +func (inputMessageInvoice *InputMessageInvoice) UnmarshalJSON(data []byte) error { + var tmp struct { + Invoice *Invoice `json:"invoice"` + Title string `json:"title"` + Description string `json:"description"` + PhotoUrl string `json:"photo_url"` + PhotoSize int32 `json:"photo_size"` + PhotoWidth int32 `json:"photo_width"` + PhotoHeight int32 `json:"photo_height"` + Payload []byte `json:"payload"` + ProviderToken string `json:"provider_token"` + ProviderData string `json:"provider_data"` + StartParameter string `json:"start_parameter"` + ExtendedMediaContent json.RawMessage `json:"extended_media_content"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputMessageInvoice.Invoice = tmp.Invoice + inputMessageInvoice.Title = tmp.Title + inputMessageInvoice.Description = tmp.Description + inputMessageInvoice.PhotoUrl = tmp.PhotoUrl + inputMessageInvoice.PhotoSize = tmp.PhotoSize + inputMessageInvoice.PhotoWidth = tmp.PhotoWidth + inputMessageInvoice.PhotoHeight = tmp.PhotoHeight + inputMessageInvoice.Payload = tmp.Payload + inputMessageInvoice.ProviderToken = tmp.ProviderToken + inputMessageInvoice.ProviderData = tmp.ProviderData + inputMessageInvoice.StartParameter = tmp.StartParameter + + fieldExtendedMediaContent, _ := UnmarshalInputMessageContent(tmp.ExtendedMediaContent) + inputMessageInvoice.ExtendedMediaContent = fieldExtendedMediaContent + + return nil +} + // A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot type InputMessagePoll struct { meta @@ -23374,7 +23972,7 @@ func (*ChatEventTitleChanged) ChatEventActionType() string { return TypeChatEventTitleChanged } -// The chat username was changed +// The chat editable username was changed type ChatEventUsernameChanged struct { meta // Previous chat username @@ -23403,6 +24001,35 @@ func (*ChatEventUsernameChanged) ChatEventActionType() string { return TypeChatEventUsernameChanged } +// The chat active usernames were changed +type ChatEventActiveUsernamesChanged struct { + meta + // Previous list of active usernames + OldUsernames []string `json:"old_usernames"` + // New list of active usernames + NewUsernames []string `json:"new_usernames"` +} + +func (entity *ChatEventActiveUsernamesChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventActiveUsernamesChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventActiveUsernamesChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventActiveUsernamesChanged) GetType() string { + return TypeChatEventActiveUsernamesChanged +} + +func (*ChatEventActiveUsernamesChanged) ChatEventActionType() string { + return TypeChatEventActiveUsernamesChanged +} + // The has_protected_content setting of a channel was toggled type ChatEventHasProtectedContentToggled struct { meta @@ -23771,6 +24398,172 @@ func (chatEventVideoChatParticipantVolumeLevelChanged *ChatEventVideoChatPartici return nil } +// The is_forum setting of a channel was toggled +type ChatEventIsForumToggled struct { + meta + // New value of is_forum + IsForum bool `json:"is_forum"` +} + +func (entity *ChatEventIsForumToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventIsForumToggled + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventIsForumToggled) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventIsForumToggled) GetType() string { + return TypeChatEventIsForumToggled +} + +func (*ChatEventIsForumToggled) ChatEventActionType() string { + return TypeChatEventIsForumToggled +} + +// A new forum topic was created +type ChatEventForumTopicCreated struct { + meta + // Information about the topic + TopicInfo *ForumTopicInfo `json:"topic_info"` +} + +func (entity *ChatEventForumTopicCreated) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventForumTopicCreated + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventForumTopicCreated) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventForumTopicCreated) GetType() string { + return TypeChatEventForumTopicCreated +} + +func (*ChatEventForumTopicCreated) ChatEventActionType() string { + return TypeChatEventForumTopicCreated +} + +// A forum topic was edited +type ChatEventForumTopicEdited struct { + meta + // Old information about the topic + OldTopicInfo *ForumTopicInfo `json:"old_topic_info"` + // New information about the topic + NewTopicInfo *ForumTopicInfo `json:"new_topic_info"` +} + +func (entity *ChatEventForumTopicEdited) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventForumTopicEdited + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventForumTopicEdited) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventForumTopicEdited) GetType() string { + return TypeChatEventForumTopicEdited +} + +func (*ChatEventForumTopicEdited) ChatEventActionType() string { + return TypeChatEventForumTopicEdited +} + +// A forum topic was closed or reopened +type ChatEventForumTopicToggleIsClosed struct { + meta + // New information about the topic + TopicInfo *ForumTopicInfo `json:"topic_info"` +} + +func (entity *ChatEventForumTopicToggleIsClosed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventForumTopicToggleIsClosed + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventForumTopicToggleIsClosed) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventForumTopicToggleIsClosed) GetType() string { + return TypeChatEventForumTopicToggleIsClosed +} + +func (*ChatEventForumTopicToggleIsClosed) ChatEventActionType() string { + return TypeChatEventForumTopicToggleIsClosed +} + +// A forum topic was deleted +type ChatEventForumTopicDeleted struct { + meta + // Information about the topic + TopicInfo *ForumTopicInfo `json:"topic_info"` +} + +func (entity *ChatEventForumTopicDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventForumTopicDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventForumTopicDeleted) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventForumTopicDeleted) GetType() string { + return TypeChatEventForumTopicDeleted +} + +func (*ChatEventForumTopicDeleted) ChatEventActionType() string { + return TypeChatEventForumTopicDeleted +} + +// A pinned forum topic was changed +type ChatEventForumTopicPinned struct { + meta + // Information about the old pinned topic; may be null + OldTopicInfo *ForumTopicInfo `json:"old_topic_info"` + // Information about the new pinned topic; may be null + NewTopicInfo *ForumTopicInfo `json:"new_topic_info"` +} + +func (entity *ChatEventForumTopicPinned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventForumTopicPinned + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventForumTopicPinned) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventForumTopicPinned) GetType() string { + return TypeChatEventForumTopicPinned +} + +func (*ChatEventForumTopicPinned) ChatEventActionType() string { + return TypeChatEventForumTopicPinned +} + // Represents a chat event type ChatEvent struct { meta @@ -23875,6 +24668,8 @@ type ChatEventLogFilters struct { InviteLinkChanges bool `json:"invite_link_changes"` // True, if video chat actions need to be returned VideoChatChanges bool `json:"video_chat_changes"` + // True, if forum-related actions need to be returned + ForumChanges bool `json:"forum_changes"` } func (entity *ChatEventLogFilters) MarshalJSON() ([]byte, error) { @@ -24669,6 +25464,31 @@ func (*PremiumFeatureAnimatedProfilePhoto) PremiumFeatureType() string { return TypePremiumFeatureAnimatedProfilePhoto } +// The ability to set a custom emoji as a forum topic icon +type PremiumFeatureForumTopicIcon struct{ + meta +} + +func (entity *PremiumFeatureForumTopicIcon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureForumTopicIcon + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureForumTopicIcon) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureForumTopicIcon) GetType() string { + return TypePremiumFeatureForumTopicIcon +} + +func (*PremiumFeatureForumTopicIcon) PremiumFeatureType() string { + return TypePremiumFeatureForumTopicIcon +} + // Allowed to set a premium appllication icons type PremiumFeatureAppIcons struct{ meta @@ -25425,7 +26245,7 @@ type BackgroundFillGradient struct { TopColor int32 `json:"top_color"` // A bottom color of the background in the RGB24 format BottomColor int32 `json:"bottom_color"` - // Clockwise rotation angle of the gradient, in degrees; 0-359. Must be always divisible by 45 + // Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible by 45 RotationAngle int32 `json:"rotation_angle"` } @@ -29690,6 +30510,8 @@ type InternalLinkTypeInstantView struct { meta // URL to be passed to getWebPageInstantView Url string `json:"url"` + // An URL to open if getWebPageInstantView fails + FallbackUrl string `json:"fallback_url"` } func (entity *InternalLinkTypeInstantView) MarshalJSON() ([]byte, error) { @@ -30338,14 +31160,14 @@ type MessageLinkInfo struct { IsPublic bool `json:"is_public"` // If found, identifier of the chat to which the message belongs, 0 otherwise ChatId int64 `json:"chat_id"` + // If found, identifier of the message thread in which to open the message, or which to open in case of a missing message + MessageThreadId int64 `json:"message_thread_id"` // If found, the linked message; may be null Message *Message `json:"message"` // Timestamp from which the video/audio/video note/voice note playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview MediaTimestamp int32 `json:"media_timestamp"` // True, if the whole media album to which the message belongs is linked ForAlbum bool `json:"for_album"` - // True, if the message is linked as a channel post comment or from a message thread - ForComment bool `json:"for_comment"` } func (entity *MessageLinkInfo) MarshalJSON() ([]byte, error) { @@ -34418,6 +35240,35 @@ func (*UpdateChatOnlineMemberCount) UpdateType() string { return TypeUpdateChatOnlineMemberCount } +// Basic information about a topic in a forum chat was changed +type UpdateForumTopicInfo struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New information about the topic + Info *ForumTopicInfo `json:"info"` +} + +func (entity *UpdateForumTopicInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateForumTopicInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateForumTopicInfo) GetClass() string { + return ClassUpdate +} + +func (*UpdateForumTopicInfo) GetType() string { + return TypeUpdateForumTopicInfo +} + +func (*UpdateForumTopicInfo) UpdateType() string { + return TypeUpdateForumTopicInfo +} + // Notification settings for some type of chats were updated type UpdateScopeNotificationSettings struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 4c366f5..03b594c 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -1610,6 +1610,46 @@ func UnmarshalListOfInputInvoice(dataList []json.RawMessage) ([]InputInvoice, er return list, nil } +func UnmarshalMessageExtendedMedia(data json.RawMessage) (MessageExtendedMedia, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageExtendedMediaPreview: + return UnmarshalMessageExtendedMediaPreview(data) + + case TypeMessageExtendedMediaPhoto: + return UnmarshalMessageExtendedMediaPhoto(data) + + case TypeMessageExtendedMediaVideo: + return UnmarshalMessageExtendedMediaVideo(data) + + case TypeMessageExtendedMediaUnsupported: + return UnmarshalMessageExtendedMediaUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageExtendedMedia(dataList []json.RawMessage) ([]MessageExtendedMedia, error) { + list := []MessageExtendedMedia{} + + for _, data := range dataList { + entity, err := UnmarshalMessageExtendedMedia(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalPassportElementType(data json.RawMessage) (PassportElementType, error) { var meta meta @@ -2047,6 +2087,15 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageChatSetTtl: return UnmarshalMessageChatSetTtl(data) + case TypeMessageForumTopicCreated: + return UnmarshalMessageForumTopicCreated(data) + + case TypeMessageForumTopicEdited: + return UnmarshalMessageForumTopicEdited(data) + + case TypeMessageForumTopicIsClosedToggled: + return UnmarshalMessageForumTopicIsClosedToggled(data) + case TypeMessageCustomServiceAction: return UnmarshalMessageCustomServiceAction(data) @@ -3033,6 +3082,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventUsernameChanged: return UnmarshalChatEventUsernameChanged(data) + case TypeChatEventActiveUsernamesChanged: + return UnmarshalChatEventActiveUsernamesChanged(data) + case TypeChatEventHasProtectedContentToggled: return UnmarshalChatEventHasProtectedContentToggled(data) @@ -3069,6 +3121,24 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventVideoChatParticipantVolumeLevelChanged: return UnmarshalChatEventVideoChatParticipantVolumeLevelChanged(data) + case TypeChatEventIsForumToggled: + return UnmarshalChatEventIsForumToggled(data) + + case TypeChatEventForumTopicCreated: + return UnmarshalChatEventForumTopicCreated(data) + + case TypeChatEventForumTopicEdited: + return UnmarshalChatEventForumTopicEdited(data) + + case TypeChatEventForumTopicToggleIsClosed: + return UnmarshalChatEventForumTopicToggleIsClosed(data) + + case TypeChatEventForumTopicDeleted: + return UnmarshalChatEventForumTopicDeleted(data) + + case TypeChatEventForumTopicPinned: + return UnmarshalChatEventForumTopicPinned(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3228,6 +3298,9 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureAnimatedProfilePhoto: return UnmarshalPremiumFeatureAnimatedProfilePhoto(data) + case TypePremiumFeatureForumTopicIcon: + return UnmarshalPremiumFeatureForumTopicIcon(data) + case TypePremiumFeatureAppIcons: return UnmarshalPremiumFeatureAppIcons(data) @@ -5064,6 +5137,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(data) + case TypeUpdateForumTopicInfo: + return UnmarshalUpdateForumTopicInfo(data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) @@ -5584,14 +5660,6 @@ func UnmarshalFile(data json.RawMessage) (*File, error) { return &resp, err } -func UnmarshalFiles(data json.RawMessage) (*Files, error) { - var resp Files - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalInputFileId(data json.RawMessage) (*InputFileId, error) { var resp InputFileId @@ -6104,6 +6172,14 @@ func UnmarshalEmojiStatuses(data json.RawMessage) (*EmojiStatuses, error) { return &resp, err } +func UnmarshalUsernames(data json.RawMessage) (*Usernames, error) { + var resp Usernames + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUser(data json.RawMessage) (*User, error) { var resp User @@ -6504,6 +6580,22 @@ func UnmarshalMessageSenders(data json.RawMessage) (*MessageSenders, error) { return &resp, err } +func UnmarshalChatMessageSender(data json.RawMessage) (*ChatMessageSender, error) { + var resp ChatMessageSender + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMessageSenders(data json.RawMessage) (*ChatMessageSenders, error) { + var resp ChatMessageSenders + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageForwardOriginUser(data json.RawMessage) (*MessageForwardOriginUser, error) { var resp MessageForwardOriginUser @@ -6680,6 +6772,14 @@ func UnmarshalSponsoredMessage(data json.RawMessage) (*SponsoredMessage, error) return &resp, err } +func UnmarshalSponsoredMessages(data json.RawMessage) (*SponsoredMessages, error) { + var resp SponsoredMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFileDownload(data json.RawMessage) (*FileDownload, error) { var resp FileDownload @@ -7192,6 +7292,30 @@ func UnmarshalMessageThreadInfo(data json.RawMessage) (*MessageThreadInfo, error return &resp, err } +func UnmarshalForumTopicIcon(data json.RawMessage) (*ForumTopicIcon, error) { + var resp ForumTopicIcon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalForumTopicInfo(data json.RawMessage) (*ForumTopicInfo, error) { + var resp ForumTopicInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalForumTopic(data json.RawMessage) (*ForumTopic, error) { + var resp ForumTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalRichTextPlain(data json.RawMessage) (*RichTextPlain, error) { var resp RichTextPlain @@ -7864,6 +7988,38 @@ func UnmarshalInputInvoiceName(data json.RawMessage) (*InputInvoiceName, error) return &resp, err } +func UnmarshalMessageExtendedMediaPreview(data json.RawMessage) (*MessageExtendedMediaPreview, error) { + var resp MessageExtendedMediaPreview + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExtendedMediaPhoto(data json.RawMessage) (*MessageExtendedMediaPhoto, error) { + var resp MessageExtendedMediaPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExtendedMediaVideo(data json.RawMessage) (*MessageExtendedMediaVideo, error) { + var resp MessageExtendedMediaVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExtendedMediaUnsupported(data json.RawMessage) (*MessageExtendedMediaUnsupported, error) { + var resp MessageExtendedMediaUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDatedFile(data json.RawMessage) (*DatedFile, error) { var resp DatedFile @@ -8760,6 +8916,30 @@ func UnmarshalMessageChatSetTtl(data json.RawMessage) (*MessageChatSetTtl, error return &resp, err } +func UnmarshalMessageForumTopicCreated(data json.RawMessage) (*MessageForumTopicCreated, error) { + var resp MessageForumTopicCreated + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageForumTopicEdited(data json.RawMessage) (*MessageForumTopicEdited, error) { + var resp MessageForumTopicEdited + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageForumTopicIsClosedToggled(data json.RawMessage) (*MessageForumTopicIsClosedToggled, error) { + var resp MessageForumTopicIsClosedToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageCustomServiceAction(data json.RawMessage) (*MessageCustomServiceAction, error) { var resp MessageCustomServiceAction @@ -10432,6 +10612,14 @@ func UnmarshalChatEventUsernameChanged(data json.RawMessage) (*ChatEventUsername return &resp, err } +func UnmarshalChatEventActiveUsernamesChanged(data json.RawMessage) (*ChatEventActiveUsernamesChanged, error) { + var resp ChatEventActiveUsernamesChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventHasProtectedContentToggled(data json.RawMessage) (*ChatEventHasProtectedContentToggled, error) { var resp ChatEventHasProtectedContentToggled @@ -10528,6 +10716,54 @@ func UnmarshalChatEventVideoChatParticipantVolumeLevelChanged(data json.RawMessa return &resp, err } +func UnmarshalChatEventIsForumToggled(data json.RawMessage) (*ChatEventIsForumToggled, error) { + var resp ChatEventIsForumToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventForumTopicCreated(data json.RawMessage) (*ChatEventForumTopicCreated, error) { + var resp ChatEventForumTopicCreated + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventForumTopicEdited(data json.RawMessage) (*ChatEventForumTopicEdited, error) { + var resp ChatEventForumTopicEdited + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventForumTopicToggleIsClosed(data json.RawMessage) (*ChatEventForumTopicToggleIsClosed, error) { + var resp ChatEventForumTopicToggleIsClosed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventForumTopicDeleted(data json.RawMessage) (*ChatEventForumTopicDeleted, error) { + var resp ChatEventForumTopicDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventForumTopicPinned(data json.RawMessage) (*ChatEventForumTopicPinned, error) { + var resp ChatEventForumTopicPinned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEvent(data json.RawMessage) (*ChatEvent, error) { var resp ChatEvent @@ -10784,6 +11020,14 @@ func UnmarshalPremiumFeatureAnimatedProfilePhoto(data json.RawMessage) (*Premium return &resp, err } +func UnmarshalPremiumFeatureForumTopicIcon(data json.RawMessage) (*PremiumFeatureForumTopicIcon, error) { + var resp PremiumFeatureForumTopicIcon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumFeatureAppIcons(data json.RawMessage) (*PremiumFeatureAppIcons, error) { var resp PremiumFeatureAppIcons @@ -13392,6 +13636,14 @@ func UnmarshalUpdateChatOnlineMemberCount(data json.RawMessage) (*UpdateChatOnli return &resp, err } +func UnmarshalUpdateForumTopicInfo(data json.RawMessage) (*UpdateForumTopicInfo, error) { + var resp UpdateForumTopicInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateScopeNotificationSettings(data json.RawMessage) (*UpdateScopeNotificationSettings, error) { var resp UpdateScopeNotificationSettings @@ -14127,9 +14379,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFile: return UnmarshalFile(data) - case TypeFiles: - return UnmarshalFiles(data) - case TypeInputFileId: return UnmarshalInputFileId(data) @@ -14322,6 +14571,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeEmojiStatuses: return UnmarshalEmojiStatuses(data) + case TypeUsernames: + return UnmarshalUsernames(data) + case TypeUser: return UnmarshalUser(data) @@ -14472,6 +14724,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSenders: return UnmarshalMessageSenders(data) + case TypeChatMessageSender: + return UnmarshalChatMessageSender(data) + + case TypeChatMessageSenders: + return UnmarshalChatMessageSenders(data) + case TypeMessageForwardOriginUser: return UnmarshalMessageForwardOriginUser(data) @@ -14538,6 +14796,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSponsoredMessage: return UnmarshalSponsoredMessage(data) + case TypeSponsoredMessages: + return UnmarshalSponsoredMessages(data) + case TypeFileDownload: return UnmarshalFileDownload(data) @@ -14730,6 +14991,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageThreadInfo: return UnmarshalMessageThreadInfo(data) + case TypeForumTopicIcon: + return UnmarshalForumTopicIcon(data) + + case TypeForumTopicInfo: + return UnmarshalForumTopicInfo(data) + + case TypeForumTopic: + return UnmarshalForumTopic(data) + case TypeRichTextPlain: return UnmarshalRichTextPlain(data) @@ -14982,6 +15252,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputInvoiceName: return UnmarshalInputInvoiceName(data) + case TypeMessageExtendedMediaPreview: + return UnmarshalMessageExtendedMediaPreview(data) + + case TypeMessageExtendedMediaPhoto: + return UnmarshalMessageExtendedMediaPhoto(data) + + case TypeMessageExtendedMediaVideo: + return UnmarshalMessageExtendedMediaVideo(data) + + case TypeMessageExtendedMediaUnsupported: + return UnmarshalMessageExtendedMediaUnsupported(data) + case TypeDatedFile: return UnmarshalDatedFile(data) @@ -15318,6 +15600,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageChatSetTtl: return UnmarshalMessageChatSetTtl(data) + case TypeMessageForumTopicCreated: + return UnmarshalMessageForumTopicCreated(data) + + case TypeMessageForumTopicEdited: + return UnmarshalMessageForumTopicEdited(data) + + case TypeMessageForumTopicIsClosedToggled: + return UnmarshalMessageForumTopicIsClosedToggled(data) + case TypeMessageCustomServiceAction: return UnmarshalMessageCustomServiceAction(data) @@ -15945,6 +16236,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventUsernameChanged: return UnmarshalChatEventUsernameChanged(data) + case TypeChatEventActiveUsernamesChanged: + return UnmarshalChatEventActiveUsernamesChanged(data) + case TypeChatEventHasProtectedContentToggled: return UnmarshalChatEventHasProtectedContentToggled(data) @@ -15981,6 +16275,24 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventVideoChatParticipantVolumeLevelChanged: return UnmarshalChatEventVideoChatParticipantVolumeLevelChanged(data) + case TypeChatEventIsForumToggled: + return UnmarshalChatEventIsForumToggled(data) + + case TypeChatEventForumTopicCreated: + return UnmarshalChatEventForumTopicCreated(data) + + case TypeChatEventForumTopicEdited: + return UnmarshalChatEventForumTopicEdited(data) + + case TypeChatEventForumTopicToggleIsClosed: + return UnmarshalChatEventForumTopicToggleIsClosed(data) + + case TypeChatEventForumTopicDeleted: + return UnmarshalChatEventForumTopicDeleted(data) + + case TypeChatEventForumTopicPinned: + return UnmarshalChatEventForumTopicPinned(data) + case TypeChatEvent: return UnmarshalChatEvent(data) @@ -16077,6 +16389,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureAnimatedProfilePhoto: return UnmarshalPremiumFeatureAnimatedProfilePhoto(data) + case TypePremiumFeatureForumTopicIcon: + return UnmarshalPremiumFeatureForumTopicIcon(data) + case TypePremiumFeatureAppIcons: return UnmarshalPremiumFeatureAppIcons(data) @@ -17055,6 +17370,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(data) + case TypeUpdateForumTopicInfo: + return UnmarshalUpdateForumTopicInfo(data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) diff --git a/data/td_api.tl b/data/td_api.tl index 081a1dc..d49b654 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -66,7 +66,7 @@ textEntity offset:int32 length:int32 type:TextEntityType = TextEntity; textEntities entities:vector = TextEntities; //@description A text with some entities @text The text @entities Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. -//-Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and to be contained in all other entities. All other entities can't contain each other +//-Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other formattedText text:string entities:vector = FormattedText; @@ -157,16 +157,13 @@ remoteFile id:string unique_id:string is_uploading_active:Bool is_uploading_comp //@description Represents a file //@id Unique file identifier -//@dc_id File data center +//@dc_id File data center //@size File size, in bytes; 0 if unknown //@expected_size Approximate file size in bytes in case the exact file size is unknown. Can be used to show download/upload progress //@local Information about the local copy of the file //@remote Information about the remote copy of the file file id:int32 dc_id:int32 size:int53 expected_size:int53 local:localFile remote:remoteFile = File; -//@description Represents a list of files @files List of files -files files:vector = Files; - //@class InputFile @description Points to a file @@ -324,9 +321,9 @@ sticker set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat video duration:int32 width:int32 height:int32 file_name:string mime_type:string has_stickers:Bool supports_streaming:Bool minithumbnail:minithumbnail thumbnail:thumbnail video:file = Video; //@description Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format @duration Duration of the video, in seconds; as defined by the sender -//@length Video width and height; as defined by the sender @minithumbnail Video minithumbnail; may be null -//@thumbnail Video thumbnail in JPEG format; as defined by the sender; may be null @video File containing the video -videoNote duration:int32 length:int32 minithumbnail:minithumbnail thumbnail:thumbnail video:file = VideoNote; +//@waveform A waveform representation of the video note's audio in 5-bit format; may be empty if unknown @length Video width and height; as defined by the sender @minithumbnail Video minithumbnail; may be null +//@thumbnail Video thumbnail in JPEG format; as defined by the sender; may be null @speech_recognition_result Result of speech recognition in the video note; may be null @video File containing the video +videoNote duration:int32 waveform:bytes length:int32 minithumbnail:minithumbnail thumbnail:thumbnail speech_recognition_result:SpeechRecognitionResult video:file = VideoNote; //@description Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel //@duration Duration of the voice note, in seconds; as defined by the sender @waveform A waveform representation of the voice note in 5-bit format @@ -335,9 +332,11 @@ voiceNote duration:int32 waveform:bytes mime_type:string speech_recognition_resu //@description Describes an animated or custom representation of an emoji //@sticker Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, it can have arbitrary format different from stickerFormatTgs +//@sticker_width Expected width of the sticker, which can be used if the sticker is null +//@sticker_height Expected height of the sticker, which can be used if the sticker is null //@fitzpatrick_type Emoji modifier fitzpatrick type; 0-6; 0 if none //@sound File containing the sound to be played when the sticker is clicked; may be null. The sound is encoded with the Opus codec, and stored inside an OGG container -animatedEmoji sticker:sticker fitzpatrick_type:int32 sound:file = AnimatedEmoji; +animatedEmoji sticker:sticker sticker_width:int32 sticker_height:int32 fitzpatrick_type:int32 sound:file = AnimatedEmoji; //@description Describes a user contact @phone_number Phone number of the user @first_name First name of the user; 1-255 characters in length @last_name Last name of the user @vcard Additional data about the user in a form of vCard; 0-2048 bytes in length @user_id Identifier of the user, if known; otherwise 0 contact phone_number:string first_name:string last_name:string vcard:string user_id:int53 = Contact; @@ -457,7 +456,8 @@ inputChatPhotoAnimation animation:InputFile main_frame_timestamp:double = InputC //@can_change_info True, if the user can change the chat title, photo, and other settings //@can_invite_users True, if the user can invite new users to the chat //@can_pin_messages True, if the user can pin messages -chatPermissions can_send_messages:Bool can_send_media_messages:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool = ChatPermissions; +//@can_manage_topics True, if the user can manage topics +chatPermissions can_send_messages:Bool can_send_media_messages:Bool can_send_polls:Bool can_send_stickers:Bool can_send_animations:Bool can_send_games:Bool can_use_inline_bots:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_manage_topics:Bool = ChatPermissions; //@description Describes rights of the administrator //@can_manage_chat True, if the administrator can get chat event log, get chat statistics, get message statistics in channels, get channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only @@ -468,10 +468,11 @@ chatPermissions can_send_messages:Bool can_send_media_messages:Bool can_send_pol //@can_invite_users True, if the administrator can invite new users to the chat //@can_restrict_members True, if the administrator can restrict, ban, or unban chat members; always true for channels //@can_pin_messages True, if the administrator can pin messages; applicable to basic groups and supergroups only +//@can_manage_topics True, if the administrator can manage topics; applicable to forum supergroups only //@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them //@can_manage_video_chats True, if the administrator can manage video chats //@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only -chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_promote_members:Bool can_manage_video_chats:Bool is_anonymous:Bool = ChatAdministratorRights; +chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool is_anonymous:Bool = ChatAdministratorRights; //@description Describes an option for buying Telegram Premium to a user @@ -483,6 +484,7 @@ chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messa //@payment_link An internal link to be opened for buying Telegram Premium to the user if store payment isn't possible; may be null if direct payment isn't available premiumPaymentOption currency:string amount:int53 discount_percentage:int32 month_count:int32 store_product_id:string payment_link:InternalLinkType = PremiumPaymentOption; + //@description Describes a custom emoji to be shown instead of the Telegram Premium badge @custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format. If the custom emoji belongs to the sticker set GetOption("themed_emoji_statuses_sticker_set_id"), then it's color must be changed to the color of the Telegram Premium badge emojiStatus custom_emoji_id:int64 = EmojiStatus; @@ -490,12 +492,19 @@ emojiStatus custom_emoji_id:int64 = EmojiStatus; emojiStatuses emoji_statuses:vector = EmojiStatuses; +//@description Describes usernames assigned to a user, a supergroup, or a channel +//@active_usernames List of active usernames; the first one must be shown as the primary username. The order of active usernames can be changed with reorderActiveUsernames or reorderSupergroupActiveUsernames +//@disabled_usernames List of currently disabled usernames; the username can be activated with toggleUsernameIsActive/toggleSupergroupUsernameIsActive +//@editable_username The active username, which can be changed with setUsername/setSupergroupUsername +usernames active_usernames:vector disabled_usernames:vector editable_username:string = Usernames; + + //@description Represents a user //@id User identifier //@access_hash User access hash //@first_name First name of the user //@last_name Last name of the user -//@username Username of the user +//@usernames Usernames of the user; may be null //@phone_number Phone number of the user //@status Current online status of the user //@profile_photo Profile photo of the user; may be null @@ -512,7 +521,7 @@ emojiStatuses emoji_statuses:vector = EmojiStatuses; //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 access_hash:int64 first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 access_hash:int64 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -527,7 +536,7 @@ user id:int53 access_hash:int64 first_name:string last_name:string username:stri botInfo share_text:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights = BotInfo; //@description Contains full information about a user -//@photo User profile photo; may be null +//@photo User profile photo; may be null if empty or unknown. If non-null, then it is the same photo as in user.profile_photo and chat.photo //@is_blocked True, if the user is blocked by the current user //@can_be_called True, if the user can be called //@supports_video_calls True, if a video call can be created with the user @@ -711,7 +720,7 @@ chatJoinRequestsInfo total_count:int32 user_ids:vector = ChatJoinRequests basicGroup id:int53 access_hash:int64 member_count:int32 status:ChatMemberStatus is_active:Bool upgraded_to_supergroup_id:int53 = BasicGroup; //@description Contains full information about a basic group -//@photo Chat photo; may be null +//@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo //@param_description Group description. Updated only after the basic group is opened //@creator_user_id User identifier of the creator of the group; 0 if unknown //@members Group members @@ -723,9 +732,9 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@description Represents a supergroup or channel with zero or more members (subscribers in the case of channels). From the point of view of the system, a channel is a special kind of a supergroup: only administrators can post and see the list of members, and posts from all administrators use the name and photo of the channel instead of individual names and profile photos. Unlike supergroups, channels can have an unlimited number of subscribers //@id Supergroup or channel identifier //@access_hash Supergroup or channel access hash -//@username Username of the supergroup or channel; empty for private supergroups or channels +//@usernames Usernames of the supergroup or channel; may be null //@date Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member -//@status Status of the current user in the supergroup or channel; custom title will be always empty +//@status Status of the current user in the supergroup or channel; custom title will always be empty //@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, or getUserPrivacySettingRules //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup @@ -735,14 +744,15 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup //@is_channel True, if the supergroup is a channel //@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members +//@is_forum True, if the supergroup must be shown as a forum by default //@is_verified True, if the supergroup or channel is verified //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted //@is_scam True, if many users reported this supergroup or channel as a scam //@is_fake True, if many users reported this supergroup or channel as a fake account -supergroup id:int53 access_hash:int64 username:string date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool = Supergroup; +supergroup id:int53 access_hash:int64 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool = Supergroup; //@description Contains full information about a supergroup or channel -//@photo Chat photo; may be null +//@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo //@param_description Supergroup or channel description //@member_count Number of members in the supergroup or channel; 0 if unknown //@administrator_count Number of privileged users in the supergroup or channel; 0 if unknown @@ -756,7 +766,7 @@ supergroup id:int53 access_hash:int64 username:string date:int32 status:ChatMemb //@can_set_sticker_set True, if the supergroup sticker set can be changed //@can_set_location True, if the supergroup location can be changed //@can_get_statistics True, if the supergroup or channel statistics are available -//@is_all_history_available True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. The value of this field is only available for chat administrators +//@is_all_history_available True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available, so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available for chat administrators //@sticker_set_id Identifier of the supergroup sticker set; 0 if none //@location Location to which the supergroup is connected; may be null //@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only @@ -802,6 +812,13 @@ messageSenderChat chat_id:int53 = MessageSender; messageSenders total_count:int32 senders:vector = MessageSenders; +//@description Represents a message sender, which can be used to send messages in a chat @sender Available message senders @needs_premium True, if Telegram Premium is needed to use the message sender +chatMessageSender sender:MessageSender needs_premium:Bool = ChatMessageSender; + +//@description Represents a list of message senders, which can be used to send messages in a chat @senders List of available message senders +chatMessageSenders senders:vector = ChatMessageSenders; + + //@class MessageForwardOrigin @description Contains information about the origin of a forwarded message //@description The message was originally sent by a known user @sender_user_id Identifier of the user that originally sent the message @@ -904,6 +921,7 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool n //@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions //@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message //@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts +//@is_topic_message True, if the message is a forum topic message //@contains_unread_mention True, if the message contains an unread mention for the current user //@date Point in time (Unix timestamp) when the message was sent //@edit_date Point in time (Unix timestamp) when the message was last edited @@ -921,7 +939,7 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool n //@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 -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 contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_in_chat_id:int53 reply_to_message_id:int53 message_thread_id:int53 ttl:int32 ttl_expires_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_in_chat_id:int53 reply_to_message_id:int53 message_thread_id:int53 ttl:int32 ttl_expires_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; @@ -947,9 +965,13 @@ messageCalendar total_count:int32 days:vector = MessageCalen //@is_recommended True, if the message needs to be labeled as "recommended" instead of "sponsored" //@sponsor_chat_id Sponsor chat identifier; 0 if the sponsor chat is accessible through an invite link //@sponsor_chat_info Information about the sponsor chat; may be null unless sponsor_chat_id == 0 +//@show_chat_photo True, if the sponsor's chat photo must be shown //@link An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead //@content Content of the message. Currently, can be only of the type messageText -sponsoredMessage message_id:int53 is_recommended:Bool sponsor_chat_id:int53 sponsor_chat_info:chatInviteLinkInfo link:InternalLinkType content:MessageContent = SponsoredMessage; +sponsoredMessage message_id:int53 is_recommended:Bool sponsor_chat_id:int53 sponsor_chat_info:chatInviteLinkInfo show_chat_photo:Bool link:InternalLinkType content:MessageContent = SponsoredMessage; + +//@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages +sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; //@description Describes a file added to file download list @@ -1149,7 +1171,7 @@ chatsNearby users_nearby:vector supergroups_nearby:vector draft_message:draftMessage = MessageThreadInfo; +//@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none +forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon; + +//@description Contains basic information about a forum topic +//@message_thread_id Message thread identifier of the topic +//@name Name of the topic +//@icon Icon of the topic +//@creation_date Date the topic was created +//@creator_id Identifier of the creator of the topic +//@is_outgoing True, if the topic was created by the current user +//@is_closed True, if the topic is closed +forumTopicInfo message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_outgoing:Bool is_closed:Bool = ForumTopicInfo; + +//@description Describes a forum topic +//@info Basic information about the topic +//@last_message Last message in the topic; may be null +//@is_pinned True, if the topic is pinned in the topic list +//@unread_count Number of unread messages in the topic +//@last_read_inbox_message_id Identifier of the last read incoming message +//@last_read_outbox_message_id Identifier of the last read outgoing message +//@unread_mention_count Number of unread messages with a mention/reply in the topic +//@unread_reaction_count Number of messages with unread reactions in the topic +//@notification_settings Notification settings for the topic +//@draft_message A draft of a message in the topic; may be null +forumTopic info:forumTopicInfo last_message:message is_pinned:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings draft_message:draftMessage = ForumTopic; + + //@class RichText @description Describes a text object inside an instant-view web page //@description A plain text @text Text @@ -1641,7 +1690,7 @@ paymentResult success:Bool verification_url:string = PaymentResult; paymentReceipt title:string description:formattedText photo:photo date:int32 seller_bot_user_id:int53 payment_provider_user_id:int53 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string tip_amount:int53 = PaymentReceipt; -//@class InputInvoice @description Describe an invoice to process +//@class InputInvoice @description Describes an invoice to process //@description An invoice from a message of the type messageInvoice @chat_id Chat identifier of the message @message_id Message identifier inputInvoiceMessage chat_id:int53 message_id:int53 = InputInvoice; @@ -1650,6 +1699,27 @@ inputInvoiceMessage chat_id:int53 message_id:int53 = InputInvoice; inputInvoiceName name:string = InputInvoice; +//@class MessageExtendedMedia @description Describes a media, which is attached to an invoice + +//@description The media is hidden until the invoice is paid +//@width Media width; 0 if unknown +//@height Media height; 0 if unknown +//@duration Media duration; 0 if unknown +//@minithumbnail Media minithumbnail; may be null +//@caption Media caption +messageExtendedMediaPreview width:int32 height:int32 duration:int32 minithumbnail:minithumbnail caption:formattedText = MessageExtendedMedia; + +//@description The media is a photo @photo The photo @caption Photo caption +messageExtendedMediaPhoto photo:photo caption:formattedText = MessageExtendedMedia; + +//@description The media is a video @video The video @caption Photo caption +messageExtendedMediaVideo video:video caption:formattedText = MessageExtendedMedia; + +//@description The media is unuspported @caption Media caption +messageExtendedMediaUnsupported caption:formattedText = MessageExtendedMedia; + + + //@description File with the date it was uploaded @file The file @date Point in time (Unix timestamp) when the file was uploaded datedFile file:file date:int32 = DatedFile; @@ -1967,7 +2037,8 @@ messagePoll poll:poll = MessageContent; //@description A message with an invoice from a bot @title Product title @param_description Product description @photo Product photo; may be null @currency Currency for the product price @total_amount Product total price in the smallest units of the currency //@start_parameter Unique invoice bot start_parameter. To share an invoice use the URL https://t.me/{bot_username}?start={start_parameter} @is_test True, if the invoice is a test invoice //@need_shipping_address True, if the shipping address must be specified @receipt_message_id The identifier of the message with the receipt, after the product has been purchased -messageInvoice title:string description:formattedText photo:photo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 = MessageContent; +//@extended_media Extended media attached to the invoice; may be null +messageInvoice title:string description:formattedText photo:photo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 extended_media:MessageExtendedMedia = MessageContent; //@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; @@ -2029,13 +2100,22 @@ messageChatSetTheme theme_name:string = MessageContent; //@description The TTL (Time To Live) setting for messages in the chat has been changed @ttl New message TTL messageChatSetTtl ttl:int32 = MessageContent; +//@description A forum topic has been created @name Name of the topic @icon Icon of the topic +messageForumTopicCreated name:string icon:forumTopicIcon = MessageContent; + +//@description A forum topic has been edited @name If non-empty, the new name of the topic @edit_icon_custom_emoji_id True, if icon's custom_emoji_id is changed @icon_custom_emoji_id New unique identifier of the custom emoji shown on the topic icon; 0 if none. Must be ignored if edit_icon_custom_emoji_id is false +messageForumTopicEdited name:string edit_icon_custom_emoji_id:Bool icon_custom_emoji_id:int64 = MessageContent; + +//@description A forum topic has been closed or opened @is_closed True if the topic was closed or reopened +messageForumTopicIsClosedToggled is_closed:Bool = MessageContent; + //@description A non-standard action has happened in the chat @text Message text to be shown in the chat messageCustomServiceAction text:string = MessageContent; //@description A new high score was achieved in a game @game_message_id Identifier of the message with the game, can be an identifier of a deleted message @game_id Identifier of the game; may be different from the games presented in the message with the game @score New score messageGameScore game_message_id:int53 game_id:int64 score:int32 = MessageContent; -//@description A payment has been completed @invoice_chat_id Identifier of the chat, containing the corresponding invoice message; 0 if unknown @invoice_message_id Identifier of the message with the corresponding invoice; can be 0 or an identifier of a deleted message +//@description A payment has been completed @invoice_chat_id Identifier of the chat, containing the corresponding invoice message @invoice_message_id Identifier of the message with the corresponding invoice; can be 0 or an identifier of a deleted message //@currency Currency for the price of the product @total_amount Total price for the product, in the smallest units of the currency //@is_recurring True, if this is a recurring payment @is_first_recurring True, if this is the first recurring payment @invoice_name Name of the invoice; may be empty if unknown messagePaymentSuccessful invoice_chat_id:int53 invoice_message_id:int53 currency:string total_amount:int53 is_recurring:Bool is_first_recurring:Bool invoice_name:string = MessageContent; @@ -2077,7 +2157,7 @@ messageUnsupported = MessageContent; //@class TextEntityType @description Represents a part of the text which must be formatted differently -//@description A mention of a user by their username +//@description A mention of a user, a supergroup, or a channel by their username textEntityTypeMention = TextEntityType; //@description A hashtag text, beginning with "#" @@ -2183,7 +2263,7 @@ inputMessageAnimation animation:InputFile thumbnail:inputThumbnail added_sticker //@performer Performer of the audio; 0-64 characters, may be replaced by the server @caption Audio caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters inputMessageAudio audio:InputFile album_cover_thumbnail:inputThumbnail duration:int32 title:string performer:string caption:formattedText = InputMessageContent; -//@description A document message (general file) @document Document to be sent @thumbnail Document thumbnail; pass null to skip thumbnail uploading @disable_content_type_detection If true, automatic file type detection will be disabled and the document will be always sent as file. Always true for files sent to secret chats @caption Document caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters +//@description A document message (general file) @document Document to be sent @thumbnail Document thumbnail; pass null to skip thumbnail uploading @disable_content_type_detection If true, automatic file type detection will be disabled and the document will always be sent as file. Always true for files sent to secret chats @caption Document caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; //@description A photo message @photo Photo to send. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20 @thumbnail Photo thumbnail to be sent; pass null to skip thumbnail uploading. The thumbnail is sent to the other party only in secret chats @added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable @width Photo width @height Photo height @caption Photo caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters @@ -2201,7 +2281,7 @@ inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_id //@description A video note message @video_note Video note to be sent @thumbnail Video thumbnail; pass null to skip thumbnail uploading @duration Duration of the video, in seconds @length Video width and height; must be positive and not greater than 640 inputMessageVideoNote video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 = InputMessageContent; -//@description A voice note message @voice_note Voice note to be sent @duration Duration of the voice note, in seconds @waveform Waveform representation of the voice note, in 5-bit format @caption Voice note caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters +//@description A voice note message @voice_note Voice note to be sent @duration Duration of the voice note, in seconds @waveform Waveform representation of the voice note in 5-bit format @caption Voice note caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption:formattedText = InputMessageContent; //@description A message with a location @location Location to be sent @live_period Period for which the location can be updated, in seconds; must be between 60 and 86400 for a live location and 0 otherwise @@ -2225,7 +2305,8 @@ inputMessageGame bot_user_id:int53 game_short_name:string = InputMessageContent; //@photo_url Product photo URL; optional @photo_size Product photo size @photo_width Product photo width @photo_height Product photo height //@payload The invoice payload @provider_token Payment provider token @provider_data JSON-encoded data about the invoice, which will be shared with the payment provider //@start_parameter Unique invoice bot deep link parameter for the generation of this invoice. If empty, it would be possible to pay directly from forwards of the invoice message -inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string = InputMessageContent; +//@extended_media_content The content of extended media attached to the invoice. The content of the message to be sent. Must be one of the following types: inputMessagePhoto, inputMessageVideo +inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string extended_media_content:InputMessageContent = InputMessageContent; //@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot @question Poll question; 1-255 characters (up to 300 characters for bots) @options List of poll answer options, 2-10 strings 1-100 characters each //@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels @type Type of the poll @@ -2894,9 +2975,12 @@ chatEventStickerSetChanged old_sticker_set_id:int64 new_sticker_set_id:int64 = C //@description The chat title was changed @old_title Previous chat title @new_title New chat title chatEventTitleChanged old_title:string new_title:string = ChatEventAction; -//@description The chat username was changed @old_username Previous chat username @new_username New chat username +//@description The chat editable username was changed @old_username Previous chat username @new_username New chat username chatEventUsernameChanged old_username:string new_username:string = ChatEventAction; +//@description The chat active usernames were changed @old_usernames Previous list of active usernames @new_usernames New list of active usernames +chatEventActiveUsernamesChanged old_usernames:vector new_usernames:vector = ChatEventAction; + //@description The has_protected_content setting of a channel was toggled @has_protected_content New value of has_protected_content chatEventHasProtectedContentToggled has_protected_content:Bool = ChatEventAction; @@ -2933,6 +3017,24 @@ chatEventVideoChatParticipantIsMutedToggled participant_id:MessageSender is_mute //@description A video chat participant volume level was changed @participant_id Identifier of the affected group call participant @volume_level New value of volume_level; 1-20000 in hundreds of percents chatEventVideoChatParticipantVolumeLevelChanged participant_id:MessageSender volume_level:int32 = ChatEventAction; +//@description The is_forum setting of a channel was toggled @is_forum New value of is_forum +chatEventIsForumToggled is_forum:Bool = ChatEventAction; + +//@description A new forum topic was created @topic_info Information about the topic +chatEventForumTopicCreated topic_info:forumTopicInfo = ChatEventAction; + +//@description A forum topic was edited @old_topic_info Old information about the topic @new_topic_info New information about the topic +chatEventForumTopicEdited old_topic_info:forumTopicInfo new_topic_info:forumTopicInfo = ChatEventAction; + +//@description A forum topic was closed or reopened @topic_info New information about the topic +chatEventForumTopicToggleIsClosed topic_info:forumTopicInfo = ChatEventAction; + +//@description A forum topic was deleted @topic_info Information about the topic +chatEventForumTopicDeleted topic_info:forumTopicInfo = ChatEventAction; + +//@description A pinned forum topic was changed @old_topic_info Information about the old pinned topic; may be null @new_topic_info Information about the new pinned topic; may be null +chatEventForumTopicPinned old_topic_info:forumTopicInfo new_topic_info:forumTopicInfo = ChatEventAction; + //@description Represents a chat event @id Chat event identifier @date Point in time (Unix timestamp) when the event happened @member_id Identifier of the user or chat who performed the action @action The action chatEvent id:int64 date:int32 member_id:MessageSender action:ChatEventAction = ChatEvent; @@ -2952,7 +3054,8 @@ chatEvents events:vector = ChatEvents; //@setting_changes True, if changes in chat settings need to be returned //@invite_link_changes True, if changes to invite links need to be returned //@video_chat_changes True, if video chat actions need to be returned -chatEventLogFilters message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool invite_link_changes:Bool video_chat_changes:Bool = ChatEventLogFilters; +//@forum_changes True, if forum-related actions need to be returned +chatEventLogFilters message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool invite_link_changes:Bool video_chat_changes:Bool forum_changes:Bool = ChatEventLogFilters; //@class LanguagePackStringValue @description Represents the value of a string in a language pack @@ -3060,6 +3163,9 @@ premiumFeatureEmojiStatus = PremiumFeature; //@description Profile photo animation on message and chat screens premiumFeatureAnimatedProfilePhoto = PremiumFeature; +//@description The ability to set a custom emoji as a forum topic icon +premiumFeatureForumTopicIcon = PremiumFeature; + //@description Allowed to set a premium appllication icons premiumFeatureAppIcons = PremiumFeature; @@ -3153,7 +3259,7 @@ pushReceiverId id:int64 = PushReceiverId; backgroundFillSolid color:int32 = BackgroundFill; //@description Describes a gradient fill of a background @top_color A top color of the background in the RGB24 format @bottom_color A bottom color of the background in the RGB24 format -//@rotation_angle Clockwise rotation angle of the gradient, in degrees; 0-359. Must be always divisible by 45 +//@rotation_angle Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible by 45 backgroundFillGradient top_color:int32 bottom_color:int32 rotation_angle:int32 = BackgroundFill; //@description Describes a freeform gradient fill of a background @colors A list of 3 or 4 colors of the freeform gradients in the RGB24 format @@ -3732,8 +3838,8 @@ internalLinkTypeFilterSettings = InternalLinkType; //@bot_username Username of the bot that owns the game @game_short_name Short name of the game internalLinkTypeGame bot_username:string game_short_name:string = InternalLinkType; -//@description The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link @url URL to be passed to getWebPageInstantView -internalLinkTypeInstantView url:string = InternalLinkType; +//@description The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link @url URL to be passed to getWebPageInstantView @fallback_url An URL to open if getWebPageInstantView fails +internalLinkTypeInstantView url:string fallback_url:string = InternalLinkType; //@description The link is a link to an invoice. Call getPaymentForm with the given invoice name to process the link @invoice_name Name of the invoice internalLinkTypeInvoice invoice_name:string = InternalLinkType; @@ -3813,11 +3919,11 @@ messageLink link:string is_public:Bool = MessageLink; //@description Contains information about a link to a message in a chat //@is_public True, if the link is a public link for a message in a chat //@chat_id If found, identifier of the chat to which the message belongs, 0 otherwise +//@message_thread_id If found, identifier of the message thread in which to open the message, or which to open in case of a missing message //@message If found, the linked message; may be null //@media_timestamp Timestamp from which the video/audio/video note/voice note playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview //@for_album True, if the whole media album to which the message belongs is linked -//@for_comment True, if the message is linked as a channel post comment or from a message thread -messageLinkInfo is_public:Bool chat_id:int53 message:message media_timestamp:int32 for_album:Bool for_comment:Bool = MessageLinkInfo; +messageLinkInfo is_public:Bool chat_id:int53 message_thread_id:int53 message:message media_timestamp:int32 for_album:Bool = MessageLinkInfo; //@description Contains a part of a file @data File bytes @@ -4341,6 +4447,9 @@ updateChatFilters chat_filters:vector main_chat_list_position:in //@description The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. There is no guarantee that it will be sent just after the number of online users has changed @chat_id Identifier of the chat @online_member_count New number of online members in the chat, or 0 if unknown updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update; +//@description Basic information about a topic in a forum chat was changed @chat_id Chat identifier @info New information about the topic +updateForumTopicInfo chat_id:int53 info:forumTopicInfo = Update; + //@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; @@ -4903,11 +5012,12 @@ getMessageThreadHistory chat_id:int53 message_id:int53 from_message_id:int53 off //@chat_id Chat identifier @remove_from_chat_list Pass true to remove the chat from all chat lists @revoke Pass true to delete chat history for all users deleteChatHistory chat_id:int53 remove_from_chat_list:Bool revoke:Bool = Ok; -//@description Deletes a chat along with all messages in the corresponding chat for all chat members. For group chats this will release the username and remove all members. Use the field chat.can_be_deleted_for_all_users to find whether the method can be applied to the chat @chat_id Chat identifier +//@description Deletes a chat along with all messages in the corresponding chat for all chat members. For group chats this will release the usernames and remove all members. Use the field chat.can_be_deleted_for_all_users to find whether the method can be applied to the chat @chat_id Chat identifier deleteChat chat_id:int53 = Ok; //@description Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query -//-(searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//-(searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. +//-A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation //@chat_id Identifier of the chat in which to search messages //@query Query to search for //@sender_id Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats @@ -4979,6 +5089,12 @@ getChatMessageCalendar chat_id:int53 filter:SearchMessagesFilter from_message_id //@description Returns approximate number of messages of the specified type in the chat @chat_id Identifier of the chat in which to count messages @filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function @return_local Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally getChatMessageCount chat_id:int53 filter:SearchMessagesFilter return_local:Bool = Count; +//@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats +//@chat_id Identifier of the chat in which to find message position @message_id Message identifier +//@filter Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function +//@message_thread_id If not 0, only messages in the specified thread will be considered; supergroups only +getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 = Count; + //@description Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; @@ -4989,8 +5105,8 @@ getChatScheduledMessages chat_id:int53 = Messages; //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; -//@description Returns sponsored message to be shown in a chat; for channel chats only. Returns a 404 error if there is no sponsored message in the chat @chat_id Identifier of the chat -getChatSponsoredMessage chat_id:int53 = SponsoredMessage; +//@description Returns sponsored messages to be shown in a chat; for channel chats only @chat_id Identifier of the chat +getChatSponsoredMessages chat_id:int53 = SponsoredMessages; //@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user @notification_group_id Identifier of notification group to which the notification belongs @notification_id Identifier of removed notification @@ -5005,8 +5121,8 @@ removeNotificationGroup notification_group_id:int32 max_notification_id:int32 = //@message_id Identifier of the message //@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note playing must start, in seconds. The media can be in the message content or in its web page preview //@for_album Pass true to create a link for the whole media album -//@for_comment Pass true to create a link to the message as a channel post comment, or from a message thread -getMessageLink chat_id:int53 message_id:int53 media_timestamp:int32 for_album:Bool for_comment:Bool = MessageLink; +//@in_message_thread Pass true to create a link to the message as a channel post comment, in a message thread, or a forum topic +getMessageLink chat_id:int53 message_id:int53 media_timestamp:int32 for_album:Bool in_message_thread:Bool = MessageLink; //@description Returns an HTML code for embedding the message. Available only for messages in supergroups and channels with a username //@chat_id Identifier of the chat to which the message belongs @@ -5024,17 +5140,17 @@ getMessageLinkInfo url:string = MessageLinkInfo; //@to_language_code A two-letter ISO 639-1 language code of the language to which the message is translated translateText text:string from_language_code:string to_language_code:string = Text; -//@description Recognizes speech in a voice note message. The message must be successfully sent and must not be scheduled. May return an error with a message "MSG_VOICE_TOO_LONG" if the voice note is too long to be recognized +//@description Recognizes speech in a video note or a voice note message. The message must be successfully sent and must not be scheduled. May return an error with a message "MSG_VOICE_TOO_LONG" if media duration is too big to be recognized //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message recognizeSpeech chat_id:int53 message_id:int53 = Ok; -//@description Rates recognized speech in a voice note message @chat_id Identifier of the chat to which the message belongs @message_id Identifier of the message @is_good Pass true if the speech recognition is good +//@description Rates recognized speech in a video note or a voice note message @chat_id Identifier of the chat to which the message belongs @message_id Identifier of the message @is_good Pass true if the speech recognition is good rateSpeechRecognition chat_id:int53 message_id:int53 is_good:Bool = Ok; //@description Returns list of message sender identifiers, which can be used to send messages in a chat @chat_id Chat identifier -getChatAvailableMessageSenders chat_id:int53 = MessageSenders; +getChatAvailableMessageSenders chat_id:int53 = ChatMessageSenders; //@description Selects a message sender to send messages in a chat @chat_id Chat identifier @message_sender_id New message sender for the chat setChatMessageSender chat_id:int53 message_sender_id:MessageSender = Ok; @@ -5073,13 +5189,14 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to_mess //@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message //@chat_id Identifier of the chat to which to forward messages +//@message_thread_id If not 0, a message thread identifier in which the message will be sent; for forum threads only //@from_chat_id Identifier of the chat from which to forward messages //@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously //@options Options to be used to send the messages; pass null to use default options //@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false //@only_preview Pass true to get fake messages instead of actually forwarding them -forwardMessages chat_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool only_preview:Bool = Messages; +forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool only_preview:Bool = Messages; //@description Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. //-If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message @@ -5183,11 +5300,39 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; +//@description Returns list of custom emojis, which can be used as forum topic icon by all users +getForumTopicDefaultIcons = Stickers; + +//@description Creates a topic in a forum supergroup chat; requires can_manage_topics rights in the supergroup +//@chat_id Identifier of the chat +//@name Name of the topic; 1-128 characters +//@icon Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, other users can use only a custom emoji returned by getForumTopicDefaultIcons +createForumTopic chat_id:int53 name:string icon:forumTopicIcon = ForumTopicInfo; + +//@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator rights in the supergroup unless the user is creator of the topic +//@chat_id Identifier of the chat +//@message_thread_id Message thread identifier of the forum topic +//@name New name of the topic; 1-128 characters +//@icon_custom_emoji_id Identifier of the new custom emoji for topic icon. Telegram Premium users can use any custom emoji, other users can use only a custom emoji returned by getForumTopicDefaultIcons +editForumTopic chat_id:int53 message_thread_id:int53 name:string icon_custom_emoji_id:int64 = Ok; + +//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator rights in the supergroup unless the user is creator of the topic +//@chat_id Identifier of the chat +//@message_thread_id Message thread identifier of the forum topic +//@is_closed Pass true to close the topic; pass false to reopen it +toggleForumTopicIsClosed chat_id:int53 message_thread_id:int53 is_closed:Bool = Ok; + +//@description Deletes all messages in a forum topic; requires can_delete_messages administrator rights in the supergroup unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages +//@chat_id Identifier of the chat +//@message_thread_id Message thread identifier of the forum topic +deleteForumTopic chat_id:int53 message_thread_id:int53 = Ok; + + //@description Returns information about a emoji reaction. Returns a 404 error if the reaction is not found @emoji Text representation of the reaction getEmojiReaction emoji:string = EmojiReaction; -//@description Returns TGS files with generic animations for custom emoji reactions -getCustomEmojiReactionAnimations = Files; +//@description Returns TGS stickers with generic animations for custom emoji reactions +getCustomEmojiReactionAnimations = Stickers; //@description Returns reactions, which can be added to a message. The list can change after updateActiveEmojiReactions, updateChatAvailableReactions for the chat, or updateMessageInteractionInfo for the message //@chat_id Identifier of the chat to which the message belongs @@ -5224,10 +5369,10 @@ getMessageAddedReactions chat_id:int53 message_id:int53 reaction_type:ReactionTy setDefaultReactionType reaction_type:ReactionType = Ok; -//@description Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) contained in the text. Can be called synchronously @text The text in which to look for entites +//@description Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) found in the text. Can be called synchronously @text The text in which to look for entites getTextEntities text:string = TextEntities; -//@description Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities contained in the text. Can be called synchronously @text The text to parse @parse_mode Text parse mode +//@description Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously @text The text to parse @parse_mode Text parse mode parseTextEntities text:string parse_mode:TextParseMode = FormattedText; //@description Parses Markdown entities in a human-friendly format, ignoring markup errors. Can be called synchronously @@ -5333,8 +5478,9 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, or 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 //@reply_to_message_id Identifier of the replied message for the message sent by the Web App; 0 if none -openWebApp chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string reply_to_message_id:int53 = WebAppInfo; +openWebApp chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to_message_id:int53 = WebAppInfo; //@description Informs TDLib that a previously opened Web App was closed @web_app_launch_id Identifier of Web App launch, received from openWebApp closeWebApp web_app_launch_id:int64 = Ok; @@ -5418,9 +5564,15 @@ getExternalLink link:string allow_write_access:Bool = HttpUrl; //@description Marks all mentions in a chat as read @chat_id Chat identifier readAllChatMentions chat_id:int53 = Ok; -//@description Marks all reactions in a chat as read @chat_id Chat identifier +//@description Marks all mentions in a forum topic as read @chat_id Chat identifier @message_thread_id Message thread identifier in which mentions are marked as read +readAllMessageThreadMentions chat_id:int53 message_thread_id:int53 = Ok; + +//@description Marks all reactions in a chat or a forum topic as read @chat_id Chat identifier readAllChatReactions chat_id:int53 = Ok; +//@description Marks all reactions in a forum topic as read @chat_id Chat identifier @message_thread_id Message thread identifier in which reactions are marked as read +readAllMessageThreadReactions chat_id:int53 message_thread_id:int53 = Ok; + //@description Returns an existing chat corresponding to a given user @user_id User identifier @force Pass true to create the chat without a network request. In this case all information about the chat except its type, title and photo can be incorrect createPrivateChat user_id:int53 force:Bool = Chat; @@ -5550,6 +5702,10 @@ unpinChatMessage chat_id:int53 message_id:int53 = Ok; //@description Removes all pinned messages from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel @chat_id Identifier of the chat unpinAllChatMessages chat_id:int53 = Ok; +//@description Removes all pinned messages from a forum topic; requires can_pin_messages rights in the supergroup @chat_id Identifier of the chat +//@message_thread_id Message thread identifier in which messages will be unpinned +unpinAllMessageThreadMessages chat_id:int53 message_thread_id:int53 = Ok; + //@description Adds the current user as a new member to a chat. Private and secret chats can't be joined using this method. May return an error with a message "INVITE_REQUEST_SENT" if only a join request was created @chat_id Chat identifier joinChat chat_id:int53 = Ok; @@ -5586,7 +5742,7 @@ transferChatOwnership chat_id:int53 user_id:int53 password:string = Ok; //@description Returns information about a single member of a chat @chat_id Chat identifier @member_id Member identifier getChatMember chat_id:int53 member_id:MessageSender = ChatMember; -//@description Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels +//@description Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights in channels //@chat_id Chat identifier //@query Query to search for //@limit The maximum number of users to be returned; up to 200 @@ -6031,12 +6187,12 @@ sharePhoneNumber user_id:int53 = Ok; getUserProfilePhotos user_id:int53 offset:int32 limit:int32 = ChatPhotos; -//@description Returns stickers from the installed sticker sets that correspond to a given emoji. If the emoji is non-empty, then favorite, recently used or trending stickers may also be returned -//@sticker_type Type of the sticker sets to return -//@emoji String representation of emoji. If empty, returns all known installed stickers +//@description Returns stickers from the installed sticker sets that correspond to a given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned +//@sticker_type Type of the stickers to return +//@query Search query; an emoji or a keyword prefix. If empty, returns all known installed stickers //@limit The maximum number of stickers to be returned -//@chat_id Chat identifier for which to return stickers. Available custom emoji may be different for different chats -getStickers sticker_type:StickerType emoji:string limit:int32 chat_id:int53 = Stickers; +//@chat_id Chat identifier for which to return stickers. Available custom emoji stickers may be different for different chats +getStickers sticker_type:StickerType query:string limit:int32 chat_id:int53 = Stickers; //@description Searches for stickers from public sticker sets that correspond to a given emoji @emoji String representation of emoji; must be non-empty @limit The maximum number of stickers to be returned; 0-100 searchStickers emoji:string limit:int32 = Stickers; @@ -6160,9 +6316,15 @@ setName first_name:string last_name:string = Ok; //@description Changes the bio of the current user @bio The new value of the user bio; 0-GetOption("bio_length_max") characters without line feeds setBio bio:string = Ok; -//@description Changes the username of the current user @username The new value of the username. Use an empty string to remove the username +//@description Changes the editable username of the current user @username The new value of the username. Use an empty string to remove the username. The username can't be completely removed if there is another active or disabled username setUsername username:string = Ok; +//@description Changes active state for a username of the current user. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached @username The username to change @is_active Pass true to activate the username; pass false to disable it +toggleUsernameIsActive username:string is_active:Bool = Ok; + +//@description Changes order of active usernames of the current user @usernames The new order of active usernames. All currently active usernames must be specified +reorderActiveUsernames usernames:vector = Ok; + //@description Changes the emoji status of the current user; for Telegram Premium users only //@emoji_status New emoji status; pass null to switch to the default badge //@duration Duration of the status, in seconds; pass 0 to keep the status active until it will be changed manually @@ -6242,9 +6404,18 @@ disconnectWebsite website_id:int64 = Ok; disconnectAllWebsites = Ok; -//@description Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @username New value of the username. Use an empty string to remove the username +//@description Changes the editable username of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @username New value of the username. Use an empty string to remove the username. The username can't be completely removed if there is another active or disabled username setSupergroupUsername supergroup_id:int53 username:string = Ok; +//@description Changes active state for a username of a supergroup or channel, requires owner privileges in the supergroup or channel. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached @supergroup_id Identifier of the supergroup or channel @username The username to change @is_active Pass true to activate the username; pass false to disable it +toggleSupergroupUsernameIsActive supergroup_id:int53 username:string is_active:Bool = Ok; + +//@description Disables all active non-editable usernames of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel +disableAllSupergroupUsernames supergroup_id:int53 = Ok; + +//@description Changes order of active usernames of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @usernames The new order of active usernames. All currently active usernames must be specified +reorderSupergroupActiveUsernames supergroup_id:int53 usernames:vector = Ok; + //@description Changes the sticker set of a supergroup; requires can_change_info administrator right @supergroup_id Identifier of the supergroup @sticker_set_id New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set setSupergroupStickerSet supergroup_id:int53 sticker_set_id:int64 = Ok; @@ -6260,6 +6431,9 @@ toggleSupergroupJoinByRequest supergroup_id:int53 join_by_request:Bool = Ok; //@description Toggles whether the message history of a supergroup is available to new members; requires can_change_info administrator right @supergroup_id The identifier of the supergroup @is_all_history_available The new value of is_all_history_available toggleSupergroupIsAllHistoryAvailable supergroup_id:int53 is_all_history_available:Bool = Ok; +//@description Toggles whether the supergroup is a forum; requires owner privileges in the supergroup @supergroup_id Identifier of the supergroup @is_forum New value of is_forum. A supergroup can be converted to a forum, only if it has at least GetOption("forum_member_count_min") members +toggleSupergroupIsForum supergroup_id:int53 is_forum:Bool = Ok; + //@description Upgrades supergroup to a broadcast group; requires owner privileges in the supergroup @supergroup_id Identifier of the supergroup toggleSupergroupIsBroadcastGroup supergroup_id:int53 = Ok;