diff --git a/client/function.go b/client/function.go index 60ac996..fd68971 100755 --- a/client/function.go +++ b/client/function.go @@ -1976,7 +1976,7 @@ type DeleteChatRequest struct { ChatId int64 `json:"chat_id"` } -// Deletes a chat along with all messages in the corresponding chat for all chat members; requires owner privileges. For group chats this will release the username and remove all members. Chats with more than 1000 members can't be deleted using this method +// 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 func (client *Client) DeleteChat(req *DeleteChatRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -2728,7 +2728,7 @@ type SendMessageRequest struct { ChatId int64 `json:"chat_id"` // If not 0, a message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of the message to reply to or 0 + // Identifier of the replied message; 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` // Options to be used to send the message; pass null to use default options Options *MessageSendOptions `json:"options"` @@ -2769,7 +2769,7 @@ type SendMessageAlbumRequest struct { ChatId int64 `json:"chat_id"` // If not 0, a message thread identifier in which the messages will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of a message to reply to or 0 + // Identifier of a replied message; 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` @@ -2842,7 +2842,7 @@ type SendInlineQueryResultMessageRequest struct { ChatId int64 `json:"chat_id"` // If not 0, a message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of a message to reply to or 0 + // Identifier of a replied message; 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` // Options to be used to send the message; pass null to use default options Options *MessageSendOptions `json:"options"` @@ -2985,7 +2985,7 @@ type AddLocalMessageRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the sender of the message SenderId MessageSender `json:"sender_id"` - // Identifier of the message to reply to or 0 + // Identifier of the replied message; 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` // Pass true to disable notification for the message DisableNotification bool `json:"disable_notification"` @@ -3944,6 +3944,37 @@ func GetJsonString(req *GetJsonStringRequest) (*Text, error) { func (client *Client) GetJsonString(req *GetJsonStringRequest) (*Text, error) { return GetJsonString(req)} +type GetThemeParametersJsonStringRequest struct { + // Theme parameters to convert to JSON + Theme *ThemeParameters `json:"theme"` +} + +// Converts a themeParameters object to corresponding JSON-serialized string. Can be called synchronously +func GetThemeParametersJsonString(req *GetThemeParametersJsonStringRequest) (*Text, error) { + result, err := Execute(Request{ + meta: meta{ + Type: "getThemeParametersJsonString", + }, + Data: map[string]interface{}{ + "theme": req.Theme, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +// deprecated +// Converts a themeParameters object to corresponding JSON-serialized string. Can be called synchronously +func (client *Client) GetThemeParametersJsonString(req *GetThemeParametersJsonStringRequest) (*Text, error) { + return GetThemeParametersJsonString(req)} + type SetPollAnswerRequest struct { // Identifier of the chat to which the poll belongs ChatId int64 `json:"chat_id"` @@ -4230,6 +4261,163 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err return UnmarshalOk(result.Data) } +type GetWebAppUrlRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // The URL from the keyboardButtonTypeWebApp button + Url string `json:"url"` + // Preferred web app theme; pass null to use the default theme + Theme *ThemeParameters `json:"theme"` +} + +// Returns an HTTPS URL of a web app to open after keyboardButtonTypeWebApp button is pressed +func (client *Client) GetWebAppUrl(req *GetWebAppUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getWebAppUrl", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "url": req.Url, + "theme": req.Theme, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +type SendWebAppDataRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // Text of the keyboardButtonTypeWebApp button, which opened the web app + ButtonText string `json:"button_text"` + // Received data + Data string `json:"data"` +} + +// Sends data received from a keyboardButtonTypeWebApp web app to a bot +func (client *Client) SendWebAppData(req *SendWebAppDataRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendWebAppData", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "button_text": req.ButtonText, + "data": req.Data, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type OpenWebAppRequest struct { + // Identifier of the chat in which the web app is opened. Web apps can be opened only in private chats for now + ChatId int64 `json:"chat_id"` + // Identifier of the bot, providing the web app + BotUserId int64 `json:"bot_user_id"` + // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, or an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise + Url string `json:"url"` + // Preferred web app theme; pass null to use the default theme + Theme *ThemeParameters `json:"theme"` + // Identifier of the replied message for the message sent by the web app; 0 if none + ReplyToMessageId int64 `json:"reply_to_message_id"` +} + +// Informs TDLib that a web app is being opened from attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. For each bot, a confirmation alert about data sent to the bot must be shown once +func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openWebApp", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + "url": req.Url, + "theme": req.Theme, + "reply_to_message_id": req.ReplyToMessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalWebAppInfo(result.Data) +} + +type CloseWebAppRequest struct { + // Identifier of web app launch, received from openWebApp + WebAppLaunchId JsonInt64 `json:"web_app_launch_id"` +} + +// Informs TDLib that a previously opened web app was closed +func (client *Client) CloseWebApp(req *CloseWebAppRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "closeWebApp", + }, + Data: map[string]interface{}{ + "web_app_launch_id": req.WebAppLaunchId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AnswerWebAppQueryRequest struct { + // Identifier of the web app query + WebAppQueryId string `json:"web_app_query_id"` + // The result of the query + Result InputInlineQueryResult `json:"result"` +} + +// Sets the result of interaction with a web app and sends corresponding message on behalf of the user to the chat from which the query originated; for bots only +func (client *Client) AnswerWebAppQuery(req *AnswerWebAppQueryRequest) (*SentWebAppMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "answerWebAppQuery", + }, + Data: map[string]interface{}{ + "web_app_query_id": req.WebAppQueryId, + "result": req.Result, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSentWebAppMessage(result.Data) +} + type GetCallbackQueryAnswerRequest struct { // Identifier of the chat with the message ChatId int64 `json:"chat_id"` @@ -4734,6 +4922,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeActiveSessions: return UnmarshalInternalLinkTypeActiveSessions(result.Data) + case TypeInternalLinkTypeAttachmentMenuBot: + return UnmarshalInternalLinkTypeAttachmentMenuBot(result.Data) + case TypeInternalLinkTypeAuthenticationCode: return UnmarshalInternalLinkTypeAuthenticationCode(result.Data) @@ -4746,6 +4937,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(result.Data) + case TypeInternalLinkTypeBotAddToChannel: + return UnmarshalInternalLinkTypeBotAddToChannel(result.Data) + case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(result.Data) @@ -5464,11 +5658,11 @@ func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { type SetChatMessageTtlRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // New TTL value, in seconds; must be one of 0, 86400, 7 * 86400, or 31 * 86400 unless the chat is secret + // New TTL value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400 Ttl int32 `json:"ttl"` } -// Changes the message TTL in a chat. Requires can_delete_messages administrator right in basic groups, supergroups and channels Message TTL can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram) +// Changes the message TTL in a chat. Requires can_delete_messages administrator right in basic groups, supergroups and channels Message TTL can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). func (client *Client) SetChatMessageTtl(req *SetChatMessageTtlRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6322,6 +6516,103 @@ func (client *Client) ClearAllDraftMessages(req *ClearAllDraftMessagesRequest) ( return UnmarshalOk(result.Data) } +type GetSavedNotificationSoundRequest struct { + // Identifier of the notification sound + NotificationSoundId JsonInt64 `json:"notification_sound_id"` +} + +// Returns saved notification sound by its identifier. Returns a 404 error if there is no saved notification sound with the specified identifier +func (client *Client) GetSavedNotificationSound(req *GetSavedNotificationSoundRequest) (*NotificationSounds, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedNotificationSound", + }, + Data: map[string]interface{}{ + "notification_sound_id": req.NotificationSoundId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalNotificationSounds(result.Data) +} + +// Returns list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used +func (client *Client) GetSavedNotificationSounds() (*NotificationSounds, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedNotificationSounds", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalNotificationSounds(result.Data) +} + +type AddSavedNotificationSoundRequest struct { + // Notification sound file to add + Sound InputFile `json:"sound"` +} + +// Adds a new notification sound to the list of saved notification sounds. The new notification sound is added to the top of the list. If it is already in the list, its position isn't changed +func (client *Client) AddSavedNotificationSound(req *AddSavedNotificationSoundRequest) (*NotificationSound, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addSavedNotificationSound", + }, + Data: map[string]interface{}{ + "sound": req.Sound, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalNotificationSound(result.Data) +} + +type RemoveSavedNotificationSoundRequest struct { + // Identifier of the notification sound + NotificationSoundId JsonInt64 `json:"notification_sound_id"` +} + +// Removes a notification sound from the list of saved notification sounds +func (client *Client) RemoveSavedNotificationSound(req *RemoveSavedNotificationSoundRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeSavedNotificationSound", + }, + Data: map[string]interface{}{ + "notification_sound_id": req.NotificationSoundId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetChatNotificationSettingsExceptionsRequest struct { // If specified, only chats from the scope will be returned; pass null to return chats from all scopes Scope NotificationSettingsScope `json:"scope"` @@ -6406,7 +6697,7 @@ func (client *Client) SetScopeNotificationSettings(req *SetScopeNotificationSett return UnmarshalOk(result.Data) } -// Resets all notification settings to their default values. By default, all chats are unmuted, the sound is set to "default" and message previews are shown +// Resets all notification settings to their default values. By default, all chats are unmuted and message previews are shown func (client *Client) ResetAllNotificationSettings() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6486,6 +6777,61 @@ func (client *Client) SetPinnedChats(req *SetPinnedChatsRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type GetAttachmentMenuBotRequest struct { + // Bot's user identifier + BotUserId int64 `json:"bot_user_id"` +} + +// Returns information about a bot that can be added to attachment menu +func (client *Client) GetAttachmentMenuBot(req *GetAttachmentMenuBotRequest) (*AttachmentMenuBot, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAttachmentMenuBot", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAttachmentMenuBot(result.Data) +} + +type ToggleBotIsAddedToAttachmentMenuRequest struct { + // Bot's user identifier + BotUserId int64 `json:"bot_user_id"` + // Pass true to add the bot to attachment menu; pass false to remove the bot from attachment menu + IsAdded bool `json:"is_added"` +} + +// Adds or removes a bot to attachment menu. Bot can be added to attachment menu, only if userTypeBot.can_be_added_to_attachment_menu == true +func (client *Client) ToggleBotIsAddedToAttachmentMenu(req *ToggleBotIsAddedToAttachmentMenuRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleBotIsAddedToAttachmentMenu", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "is_added": req.IsAdded, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type DownloadFileRequest struct { // Identifier of the file to download FileId int32 `json:"file_id"` @@ -7830,7 +8176,7 @@ func (client *Client) SetVideoChatDefaultParticipant(req *SetVideoChatDefaultPar } type CreateVideoChatRequest struct { - // Chat identifier, in which the video chat will be created + // Identifier of a chat in which the video chat will be created ChatId int64 `json:"chat_id"` // Group call title; if empty, chat title will be used Title string `json:"title"` @@ -10214,6 +10560,113 @@ func (client *Client) GetCommands(req *GetCommandsRequest) (*BotCommands, error) return UnmarshalBotCommands(result.Data) } +type SetMenuButtonRequest struct { + // Identifier of the user or 0 to set menu button for all users + UserId int64 `json:"user_id"` + // New menu button + MenuButton *BotMenuButton `json:"menu_button"` +} + +// Sets menu button for the given user or for all users; for bots only +func (client *Client) SetMenuButton(req *SetMenuButtonRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMenuButton", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "menu_button": req.MenuButton, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetMenuButtonRequest struct { + // Identifier of the user or 0 to get the default menu button + UserId int64 `json:"user_id"` +} + +// Returns menu button set by the bot for the given user; for bots only +func (client *Client) GetMenuButton(req *GetMenuButtonRequest) (*BotMenuButton, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMenuButton", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBotMenuButton(result.Data) +} + +type SetDefaultGroupAdministratorRightsRequest struct { + // Default administrator rights for adding the bot to basic group and supergroup chats; may be null + DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` +} + +// Sets default administrator rights for adding the bot to basic group and supergroup chats; for bots only +func (client *Client) SetDefaultGroupAdministratorRights(req *SetDefaultGroupAdministratorRightsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setDefaultGroupAdministratorRights", + }, + Data: map[string]interface{}{ + "default_group_administrator_rights": req.DefaultGroupAdministratorRights, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetDefaultChannelAdministratorRightsRequest struct { + // Default administrator rights for adding the bot to channels; may be null + DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` +} + +// Sets default administrator rights for adding the bot to channel chats; for bots only +func (client *Client) SetDefaultChannelAdministratorRights(req *SetDefaultChannelAdministratorRightsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setDefaultChannelAdministratorRights", + }, + Data: map[string]interface{}{ + "default_channel_administrator_rights": req.DefaultChannelAdministratorRights, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns all active sessions of the current user func (client *Client) GetActiveSessions() (*Sessions, error) { result, err := client.Send(Request{ @@ -10705,7 +11158,7 @@ type GetPaymentFormRequest struct { // Message identifier MessageId int64 `json:"message_id"` // Preferred payment form theme; pass null to use the default theme - Theme *PaymentFormTheme `json:"theme"` + Theme *ThemeParameters `json:"theme"` } // Returns an invoice payment form. This method must be called when the user presses inlineKeyboardButtonBuy @@ -12973,7 +13426,7 @@ type GetMapThumbnailFileRequest struct { Height int32 `json:"height"` // Map scale; 1-3 Scale int32 `json:"scale"` - // Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown + // Identifier of a chat in which the thumbnail will be shown. Use 0 if unknown ChatId int64 `json:"chat_id"` } @@ -14015,7 +14468,7 @@ type TestProxyRequest struct { Port int32 `json:"port"` // Proxy type Type ProxyType `json:"type"` - // Identifier of a datacenter, with which to test connection + // Identifier of a datacenter with which to test connection DcId int32 `json:"dc_id"` // The maximum overall timeout for the request Timeout float64 `json:"timeout"` @@ -14313,6 +14766,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedAnimations: return UnmarshalUpdateSavedAnimations(result.Data) + case TypeUpdateSavedNotificationSounds: + return UnmarshalUpdateSavedNotificationSounds(result.Data) + case TypeUpdateSelectedBackground: return UnmarshalUpdateSelectedBackground(result.Data) @@ -14331,6 +14787,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateUsersNearby: return UnmarshalUpdateUsersNearby(result.Data) + case TypeUpdateAttachmentMenuBots: + return UnmarshalUpdateAttachmentMenuBots(result.Data) + + case TypeUpdateWebAppMessageSent: + return UnmarshalUpdateWebAppMessageSent(result.Data) + case TypeUpdateReactions: return UnmarshalUpdateReactions(result.Data) diff --git a/client/type.go b/client/type.go index 57f8291..a37059e 100755 --- a/client/type.go +++ b/client/type.go @@ -133,16 +133,19 @@ const ( ClassChatPhotoInfo = "ChatPhotoInfo" ClassBotCommand = "BotCommand" ClassBotCommands = "BotCommands" + ClassBotMenuButton = "BotMenuButton" ClassChatLocation = "ChatLocation" ClassAnimatedChatPhoto = "AnimatedChatPhoto" ClassChatPhoto = "ChatPhoto" ClassChatPhotos = "ChatPhotos" + ClassChatPermissions = "ChatPermissions" + ClassChatAdministratorRights = "ChatAdministratorRights" ClassUser = "User" + ClassBotInfo = "BotInfo" ClassUserFullInfo = "UserFullInfo" ClassUsers = "Users" ClassChatAdministrator = "ChatAdministrator" ClassChatAdministrators = "ChatAdministrators" - ClassChatPermissions = "ChatPermissions" ClassChatMember = "ChatMember" ClassChatMembers = "ChatMembers" ClassChatInviteLink = "ChatInviteLink" @@ -193,6 +196,7 @@ const ( ClassChatsNearby = "ChatsNearby" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" + ClassWebAppInfo = "WebAppInfo" ClassMessageThreadInfo = "MessageThreadInfo" ClassPageBlockCaption = "PageBlockCaption" ClassPageBlockListItem = "PageBlockListItem" @@ -206,13 +210,13 @@ const ( ClassBankCardActionOpenUrl = "BankCardActionOpenUrl" ClassBankCardInfo = "BankCardInfo" ClassAddress = "Address" + ClassThemeParameters = "ThemeParameters" ClassLabeledPricePart = "LabeledPricePart" ClassInvoice = "Invoice" ClassOrderInfo = "OrderInfo" ClassShippingOption = "ShippingOption" ClassSavedCredentials = "SavedCredentials" ClassPaymentsProviderStripe = "PaymentsProviderStripe" - ClassPaymentFormTheme = "PaymentFormTheme" ClassPaymentForm = "PaymentForm" ClassValidatedOrderInfo = "ValidatedOrderInfo" ClassPaymentResult = "PaymentResult" @@ -261,6 +265,9 @@ const ( ClassReaction = "Reaction" ClassAnimations = "Animations" ClassImportedContacts = "ImportedContacts" + ClassAttachmentMenuBotColor = "AttachmentMenuBotColor" + ClassAttachmentMenuBot = "AttachmentMenuBot" + ClassSentWebAppMessage = "SentWebAppMessage" ClassHttpUrl = "HttpUrl" ClassInlineQueryResults = "InlineQueryResults" ClassCallbackQueryAnswer = "CallbackQueryAnswer" @@ -280,6 +287,8 @@ const ( ClassThemeSettings = "ThemeSettings" ClassChatTheme = "ChatTheme" ClassHashtags = "Hashtags" + ClassNotificationSound = "NotificationSound" + ClassNotificationSounds = "NotificationSounds" ClassNotification = "Notification" ClassNotificationGroup = "NotificationGroup" ClassJsonObjectMember = "JsonObjectMember" @@ -410,6 +419,7 @@ const ( TypeUserTypeUnknown = "userTypeUnknown" TypeBotCommand = "botCommand" TypeBotCommands = "botCommands" + TypeBotMenuButton = "botMenuButton" TypeChatLocation = "chatLocation" TypeAnimatedChatPhoto = "animatedChatPhoto" TypeChatPhoto = "chatPhoto" @@ -417,12 +427,14 @@ const ( TypeInputChatPhotoPrevious = "inputChatPhotoPrevious" TypeInputChatPhotoStatic = "inputChatPhotoStatic" TypeInputChatPhotoAnimation = "inputChatPhotoAnimation" + TypeChatPermissions = "chatPermissions" + TypeChatAdministratorRights = "chatAdministratorRights" TypeUser = "user" + TypeBotInfo = "botInfo" TypeUserFullInfo = "userFullInfo" TypeUsers = "users" TypeChatAdministrator = "chatAdministrator" TypeChatAdministrators = "chatAdministrators" - TypeChatPermissions = "chatPermissions" TypeChatMemberStatusCreator = "chatMemberStatusCreator" TypeChatMemberStatusAdministrator = "chatMemberStatusAdministrator" TypeChatMemberStatusMember = "chatMemberStatusMember" @@ -529,9 +541,11 @@ const ( TypeKeyboardButtonTypeRequestPhoneNumber = "keyboardButtonTypeRequestPhoneNumber" TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation" TypeKeyboardButtonTypeRequestPoll = "keyboardButtonTypeRequestPoll" + TypeKeyboardButtonTypeWebApp = "keyboardButtonTypeWebApp" TypeKeyboardButton = "keyboardButton" TypeInlineKeyboardButtonTypeUrl = "inlineKeyboardButtonTypeUrl" TypeInlineKeyboardButtonTypeLoginUrl = "inlineKeyboardButtonTypeLoginUrl" + TypeInlineKeyboardButtonTypeWebApp = "inlineKeyboardButtonTypeWebApp" TypeInlineKeyboardButtonTypeCallback = "inlineKeyboardButtonTypeCallback" TypeInlineKeyboardButtonTypeCallbackWithPassword = "inlineKeyboardButtonTypeCallbackWithPassword" TypeInlineKeyboardButtonTypeCallbackGame = "inlineKeyboardButtonTypeCallbackGame" @@ -545,6 +559,7 @@ const ( TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard" TypeLoginUrlInfoOpen = "loginUrlInfoOpen" TypeLoginUrlInfoRequestConfirmation = "loginUrlInfoRequestConfirmation" + TypeWebAppInfo = "webAppInfo" TypeMessageThreadInfo = "messageThreadInfo" TypeRichTextPlain = "richTextPlain" TypeRichTextBold = "richTextBold" @@ -610,6 +625,7 @@ const ( TypeBankCardActionOpenUrl = "bankCardActionOpenUrl" TypeBankCardInfo = "bankCardInfo" TypeAddress = "address" + TypeThemeParameters = "themeParameters" TypeLabeledPricePart = "labeledPricePart" TypeInvoice = "invoice" TypeOrderInfo = "orderInfo" @@ -620,7 +636,6 @@ const ( TypeInputCredentialsApplePay = "inputCredentialsApplePay" TypeInputCredentialsGooglePay = "inputCredentialsGooglePay" TypePaymentsProviderStripe = "paymentsProviderStripe" - TypePaymentFormTheme = "paymentFormTheme" TypePaymentForm = "paymentForm" TypeValidatedOrderInfo = "validatedOrderInfo" TypePaymentResult = "paymentResult" @@ -743,6 +758,8 @@ const ( TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageWebsiteConnected = "messageWebsiteConnected" + TypeMessageWebAppDataSent = "messageWebAppDataSent" + TypeMessageWebAppDataReceived = "messageWebAppDataReceived" TypeMessagePassportDataSent = "messagePassportDataSent" TypeMessagePassportDataReceived = "messagePassportDataReceived" TypeMessageProximityAlertTriggered = "messageProximityAlertTriggered" @@ -878,6 +895,9 @@ const ( TypeDiceStickersRegular = "diceStickersRegular" TypeDiceStickersSlotMachine = "diceStickersSlotMachine" TypeImportedContacts = "importedContacts" + TypeAttachmentMenuBotColor = "attachmentMenuBotColor" + TypeAttachmentMenuBot = "attachmentMenuBot" + TypeSentWebAppMessage = "sentWebAppMessage" TypeHttpUrl = "httpUrl" TypeInputInlineQueryResultAnimation = "inputInlineQueryResultAnimation" TypeInputInlineQueryResultArticle = "inputInlineQueryResultArticle" @@ -1035,6 +1055,8 @@ const ( TypeNotificationGroupTypeMentions = "notificationGroupTypeMentions" TypeNotificationGroupTypeSecretChat = "notificationGroupTypeSecretChat" TypeNotificationGroupTypeCalls = "notificationGroupTypeCalls" + TypeNotificationSound = "notificationSound" + TypeNotificationSounds = "notificationSounds" TypeNotification = "notification" TypeNotificationGroup = "notificationGroup" TypeOptionValueBoolean = "optionValueBoolean" @@ -1081,10 +1103,12 @@ const ( TypeChatReportReasonPersonalDetails = "chatReportReasonPersonalDetails" TypeChatReportReasonCustom = "chatReportReasonCustom" TypeInternalLinkTypeActiveSessions = "internalLinkTypeActiveSessions" + TypeInternalLinkTypeAttachmentMenuBot = "internalLinkTypeAttachmentMenuBot" TypeInternalLinkTypeAuthenticationCode = "internalLinkTypeAuthenticationCode" TypeInternalLinkTypeBackground = "internalLinkTypeBackground" TypeInternalLinkTypeBotStart = "internalLinkTypeBotStart" TypeInternalLinkTypeBotStartInGroup = "internalLinkTypeBotStartInGroup" + TypeInternalLinkTypeBotAddToChannel = "internalLinkTypeBotAddToChannel" TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" TypeInternalLinkTypeChatInvite = "internalLinkTypeChatInvite" TypeInternalLinkTypeFilterSettings = "internalLinkTypeFilterSettings" @@ -1114,6 +1138,7 @@ const ( TypeFileTypeAnimation = "fileTypeAnimation" TypeFileTypeAudio = "fileTypeAudio" TypeFileTypeDocument = "fileTypeDocument" + TypeFileTypeNotificationSound = "fileTypeNotificationSound" TypeFileTypePhoto = "fileTypePhoto" TypeFileTypeProfilePhoto = "fileTypeProfilePhoto" TypeFileTypeSecret = "fileTypeSecret" @@ -1276,12 +1301,15 @@ const ( TypeUpdateRecentStickers = "updateRecentStickers" TypeUpdateFavoriteStickers = "updateFavoriteStickers" TypeUpdateSavedAnimations = "updateSavedAnimations" + TypeUpdateSavedNotificationSounds = "updateSavedNotificationSounds" TypeUpdateSelectedBackground = "updateSelectedBackground" TypeUpdateChatThemes = "updateChatThemes" TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" TypeUpdateTermsOfService = "updateTermsOfService" TypeUpdateUsersNearby = "updateUsersNearby" + TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" + TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" TypeUpdateReactions = "updateReactions" TypeUpdateDiceEmojis = "updateDiceEmojis" TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" @@ -4088,6 +4116,8 @@ type UserTypeBot struct { InlineQueryPlaceholder string `json:"inline_query_placeholder"` // True, if the location of the user is expected to be sent with every inline query to this bot NeedLocation bool `json:"need_location"` + // True, if the bot can be added to attachment menu + CanBeAddedToAttachmentMenu bool `json:"can_be_added_to_attachment_menu"` } func (entity *UserTypeBot) MarshalJSON() ([]byte, error) { @@ -4185,6 +4215,31 @@ func (*BotCommands) GetType() string { return TypeBotCommands } +// Describes a button to be shown instead of bot commands menu button +type BotMenuButton struct { + meta + // Text of the button + Text string `json:"text"` + // URL to be passed to openWebApp + Url string `json:"url"` +} + +func (entity *BotMenuButton) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotMenuButton + + return json.Marshal((*stub)(entity)) +} + +func (*BotMenuButton) GetClass() string { + return ClassBotMenuButton +} + +func (*BotMenuButton) GetType() string { + return TypeBotMenuButton +} + // Represents a location to which a chat is connected type ChatLocation struct { meta @@ -4411,6 +4466,92 @@ func (inputChatPhotoAnimation *InputChatPhotoAnimation) UnmarshalJSON(data []byt return nil } +// Describes actions that a user is allowed to take in a chat +type ChatPermissions struct { + meta + // True, if the user can send text messages, contacts, locations, and venues + CanSendMessages bool `json:"can_send_messages"` + // True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions + CanSendMediaMessages bool `json:"can_send_media_messages"` + // True, if the user can send polls. Implies can_send_messages permissions + CanSendPolls bool `json:"can_send_polls"` + // True, if the user can send stickers. Implies can_send_messages permissions + CanSendStickers bool `json:"can_send_stickers"` + // True, if the user can send animations. Implies can_send_messages permissions + CanSendAnimations bool `json:"can_send_animations"` + // True, if the user can send games. Implies can_send_messages permissions + CanSendGames bool `json:"can_send_games"` + // True, if the user can use inline bots. Implies can_send_messages permissions + CanUseInlineBots bool `json:"can_use_inline_bots"` + // True, if the user may add a web page preview to their messages. Implies can_send_messages permissions + CanAddWebPagePreviews bool `json:"can_add_web_page_previews"` + // True, if the user can change the chat title, photo, and other settings + CanChangeInfo bool `json:"can_change_info"` + // True, if the user can invite new users to the chat + CanInviteUsers bool `json:"can_invite_users"` + // True, if the user can pin messages + CanPinMessages bool `json:"can_pin_messages"` +} + +func (entity *ChatPermissions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatPermissions + + return json.Marshal((*stub)(entity)) +} + +func (*ChatPermissions) GetClass() string { + return ClassChatPermissions +} + +func (*ChatPermissions) GetType() string { + return TypeChatPermissions +} + +// Describes rights of the administrator +type ChatAdministratorRights struct { + meta + // 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 + CanManageChat bool `json:"can_manage_chat"` + // True, if the administrator can change the chat title, photo, and other settings + CanChangeInfo bool `json:"can_change_info"` + // True, if the administrator can create channel posts; applicable to channels only + CanPostMessages bool `json:"can_post_messages"` + // True, if the administrator can edit messages of other users and pin messages; applicable to channels only + CanEditMessages bool `json:"can_edit_messages"` + // True, if the administrator can delete messages of other users + CanDeleteMessages bool `json:"can_delete_messages"` + // True, if the administrator can invite new users to the chat + CanInviteUsers bool `json:"can_invite_users"` + // True, if the administrator can restrict, ban, or unban chat members; always true for channels + 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 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 + CanManageVideoChats bool `json:"can_manage_video_chats"` + // True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only + IsAnonymous bool `json:"is_anonymous"` +} + +func (entity *ChatAdministratorRights) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatAdministratorRights + + return json.Marshal((*stub)(entity)) +} + +func (*ChatAdministratorRights) GetClass() string { + return ClassChatAdministratorRights +} + +func (*ChatAdministratorRights) GetType() string { + return TypeChatAdministratorRights +} + // Represents a user type User struct { meta @@ -4521,6 +4662,39 @@ func (user *User) UnmarshalJSON(data []byte) error { return nil } +// Contains information about a bot +type BotInfo struct { + meta + // The text that is shown on the bot's profile page and is sent together with the link when users share the bot + ShareText string `json:"share_text"` + // The text shown in the chat with the bot if the chat is empty + Description string `json:"description"` + // Information about a button to show instead of the bot commands menu button; may be null if ordinary bot commands menu must be shown + MenuButton *BotMenuButton `json:"menu_button"` + // List of the bot commands + Commands []*BotCommand `json:"commands"` + // Default administrator rights for adding the bot to basic group and supergroup chats; may be null + DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` + // Default administrator rights for adding the bot to channels; may be null + DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` +} + +func (entity *BotInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotInfo + + return json.Marshal((*stub)(entity)) +} + +func (*BotInfo) GetClass() string { + return ClassBotInfo +} + +func (*BotInfo) GetType() string { + return TypeBotInfo +} + // Contains full information about a user type UserFullInfo struct { meta @@ -4540,14 +4714,10 @@ type UserFullInfo struct { NeedPhoneNumberPrivacyException bool `json:"need_phone_number_privacy_exception"` // A short user bio Bio string `json:"bio"` - // For bots, the text that is shown on the bot's profile page and is sent together with the link when users share the bot - ShareText string `json:"share_text"` - // For bots, the text shown in the chat with the bot if the chat is empty - Description string `json:"description"` // Number of group chats where both the other user and the current user are a member; 0 for the current user GroupInCommonCount int32 `json:"group_in_common_count"` - // For bots, list of the bot commands - Commands []*BotCommand `json:"commands"` + // For bots, information about the bot; may be null + BotInfo *BotInfo `json:"bot_info"` } func (entity *UserFullInfo) MarshalJSON() ([]byte, error) { @@ -4641,49 +4811,6 @@ func (*ChatAdministrators) GetType() string { return TypeChatAdministrators } -// Describes actions that a user is allowed to take in a chat -type ChatPermissions struct { - meta - // True, if the user can send text messages, contacts, locations, and venues - CanSendMessages bool `json:"can_send_messages"` - // True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions - CanSendMediaMessages bool `json:"can_send_media_messages"` - // True, if the user can send polls. Implies can_send_messages permissions - CanSendPolls bool `json:"can_send_polls"` - // True, if the user can send stickers. Implies can_send_messages permissions - CanSendStickers bool `json:"can_send_stickers"` - // True, if the user can send animations. Implies can_send_messages permissions - CanSendAnimations bool `json:"can_send_animations"` - // True, if the user can send games. Implies can_send_messages permissions - CanSendGames bool `json:"can_send_games"` - // True, if the user can use inline bots. Implies can_send_messages permissions - CanUseInlineBots bool `json:"can_use_inline_bots"` - // True, if the user may add a web page preview to their messages. Implies can_send_messages permissions - CanAddWebPagePreviews bool `json:"can_add_web_page_previews"` - // True, if the user can change the chat title, photo, and other settings - CanChangeInfo bool `json:"can_change_info"` - // True, if the user can invite new users to the chat - CanInviteUsers bool `json:"can_invite_users"` - // True, if the user can pin messages - CanPinMessages bool `json:"can_pin_messages"` -} - -func (entity *ChatPermissions) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatPermissions - - return json.Marshal((*stub)(entity)) -} - -func (*ChatPermissions) GetClass() string { - return ClassChatPermissions -} - -func (*ChatPermissions) GetType() string { - return TypeChatPermissions -} - // The user is the owner of the chat and has all the administrator privileges type ChatMemberStatusCreator struct { meta @@ -4722,28 +4849,8 @@ type ChatMemberStatusAdministrator struct { CustomTitle string `json:"custom_title"` // True, if the current user can edit the administrator privileges for the called user CanBeEdited bool `json:"can_be_edited"` - // 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 - CanManageChat bool `json:"can_manage_chat"` - // True, if the administrator can change the chat title, photo, and other settings - CanChangeInfo bool `json:"can_change_info"` - // True, if the administrator can create channel posts; applicable to channels only - CanPostMessages bool `json:"can_post_messages"` - // True, if the administrator can edit messages of other users and pin messages; applicable to channels only - CanEditMessages bool `json:"can_edit_messages"` - // True, if the administrator can delete messages of other users - CanDeleteMessages bool `json:"can_delete_messages"` - // True, if the administrator can invite new users to the chat - CanInviteUsers bool `json:"can_invite_users"` - // True, if the administrator can restrict, ban, or unban chat members; always true for channels - 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 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 - CanManageVideoChats bool `json:"can_manage_video_chats"` - // True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only - IsAnonymous bool `json:"is_anonymous"` + // Rights of the administrator + Rights *ChatAdministratorRights `json:"rights"` } func (entity *ChatMemberStatusAdministrator) MarshalJSON() ([]byte, error) { @@ -6418,7 +6525,7 @@ type MessageReaction struct { TotalCount int32 `json:"total_count"` // True, if the reaction is chosen by the current user IsChosen bool `json:"is_chosen"` - // Identifiers of at most 3 recent message senders, added the reaction; available in private chats, basic groups and supergroups + // Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats RecentSenderIds []MessageSender `json:"recent_sender_ids"` } @@ -6949,7 +7056,7 @@ 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"` - // An internal link to be opened when the sponsored message is clicked; may be null. If null, the sponsor chat needs to be opened instead + // 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 Content MessageContent `json:"content"` @@ -7108,7 +7215,7 @@ func (*NotificationSettingsScopePrivateChats) NotificationSettingsScopeType() st return TypeNotificationSettingsScopePrivateChats } -// Notification settings applied to all basic groups and supergroups when the corresponding chat setting has a default value +// Notification settings applied to all basic group and supergroup chats when the corresponding chat setting has a default value type NotificationSettingsScopeGroupChats struct{ meta } @@ -7133,7 +7240,7 @@ func (*NotificationSettingsScopeGroupChats) NotificationSettingsScopeType() stri return TypeNotificationSettingsScopeGroupChats } -// Notification settings applied to all channels when the corresponding chat setting has a default value +// Notification settings applied to all channel chats when the corresponding chat setting has a default value type NotificationSettingsScopeChannelChats struct{ meta } @@ -7165,10 +7272,10 @@ type ChatNotificationSettings struct { UseDefaultMuteFor bool `json:"use_default_mute_for"` // Time left before notifications will be unmuted, in seconds MuteFor int32 `json:"mute_for"` - // If true, sound is ignored and the value for the relevant type of chat is used instead + // If true, the value for the relevant type of chat is used instead of sound_id UseDefaultSound bool `json:"use_default_sound"` - // The name of an audio file to be used for notification sounds; only applies to iOS applications - Sound string `json:"sound"` + // Identifier of the notification sound to be played; 0 if sound is disabled + SoundId JsonInt64 `json:"sound_id"` // If true, show_preview is ignored and the value for the relevant type of chat is used instead UseDefaultShowPreview bool `json:"use_default_show_preview"` // True, if message content must be displayed in notifications @@ -7204,8 +7311,8 @@ type ScopeNotificationSettings struct { meta // Time left before notifications will be unmuted, in seconds MuteFor int32 `json:"mute_for"` - // The name of an audio file to be used for notification sounds; only applies to iOS applications - Sound string `json:"sound"` + // Identifier of the notification sound to be played; 0 if sound is disabled + SoundId JsonInt64 `json:"sound_id"` // True, if message content must be displayed in notifications ShowPreview bool `json:"show_preview"` // True, if notifications for incoming pinned messages will be created as for an ordinary unread message @@ -7233,7 +7340,7 @@ func (*ScopeNotificationSettings) GetType() string { // Contains information about a message draft type DraftMessage struct { meta - // Identifier of the message to reply to; 0 if none + // Identifier of the replied message; 0 if none ReplyToMessageId int64 `json:"reply_to_message_id"` // Point in time (Unix timestamp) when the draft was created Date int32 `json:"date"` @@ -8364,6 +8471,33 @@ func (*KeyboardButtonTypeRequestPoll) KeyboardButtonTypeType() string { return TypeKeyboardButtonTypeRequestPoll } +// A button that opens a web app by calling getWebAppUrl +type KeyboardButtonTypeWebApp struct { + meta + // An HTTP URL to pass to getWebAppUrl + Url string `json:"url"` +} + +func (entity *KeyboardButtonTypeWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub KeyboardButtonTypeWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*KeyboardButtonTypeWebApp) GetClass() string { + return ClassKeyboardButtonType +} + +func (*KeyboardButtonTypeWebApp) GetType() string { + return TypeKeyboardButtonTypeWebApp +} + +func (*KeyboardButtonTypeWebApp) KeyboardButtonTypeType() string { + return TypeKeyboardButtonTypeWebApp +} + // Represents a single button in a bot keyboard type KeyboardButton struct { meta @@ -8435,10 +8569,10 @@ func (*InlineKeyboardButtonTypeUrl) InlineKeyboardButtonTypeType() string { return TypeInlineKeyboardButtonTypeUrl } -// A button that opens a specified URL and automatically authorize the current user if allowed to do so +// A button that opens a specified URL and automatically authorize the current user by calling getLoginUrlInfo type InlineKeyboardButtonTypeLoginUrl struct { meta - // An HTTP URL to open + // An HTTP URL to pass to getLoginUrlInfo Url string `json:"url"` // Unique button identifier Id int64 `json:"id"` @@ -8466,6 +8600,33 @@ func (*InlineKeyboardButtonTypeLoginUrl) InlineKeyboardButtonTypeType() string { return TypeInlineKeyboardButtonTypeLoginUrl } +// A button that opens a web app by calling openWebApp +type InlineKeyboardButtonTypeWebApp struct { + meta + // An HTTP URL to pass to openWebApp + Url string `json:"url"` +} + +func (entity *InlineKeyboardButtonTypeWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeWebApp) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeWebApp) GetType() string { + return TypeInlineKeyboardButtonTypeWebApp +} + +func (*InlineKeyboardButtonTypeWebApp) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeWebApp +} + // A button that sends a callback query to a bot type InlineKeyboardButtonTypeCallback struct { meta @@ -8850,6 +9011,31 @@ func (*LoginUrlInfoRequestConfirmation) LoginUrlInfoType() string { return TypeLoginUrlInfoRequestConfirmation } +// Contains information about a web app +type WebAppInfo struct { + meta + // Unique identifier for the web app launch + LaunchId JsonInt64 `json:"launch_id"` + // A web app URL to open in a web view + Url string `json:"url"` +} + +func (entity *WebAppInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppInfo + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppInfo) GetClass() string { + return ClassWebAppInfo +} + +func (*WebAppInfo) GetType() string { + return TypeWebAppInfo +} + // Contains information about a message thread type MessageThreadInfo struct { meta @@ -10921,7 +11107,7 @@ type PageBlockChatLink struct { Title string `json:"title"` // Chat photo; may be null Photo *ChatPhotoInfo `json:"photo"` - // Chat username, by which all other information about the chat can be resolved + // Chat username by which all other information about the chat can be resolved Username string `json:"username"` } @@ -11427,6 +11613,39 @@ func (*Address) GetType() string { return TypeAddress } +// Contains parameters of the app theme +type ThemeParameters struct { + meta + // A color of the background in the RGB24 format + BackgroundColor int32 `json:"background_color"` + // A color of text in the RGB24 format + TextColor int32 `json:"text_color"` + // A color of hints in the RGB24 format + HintColor int32 `json:"hint_color"` + // A color of links in the RGB24 format + LinkColor int32 `json:"link_color"` + // A color of the buttons in the RGB24 format + ButtonColor int32 `json:"button_color"` + // A color of text on the buttons in the RGB24 format + ButtonTextColor int32 `json:"button_text_color"` +} + +func (entity *ThemeParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThemeParameters + + return json.Marshal((*stub)(entity)) +} + +func (*ThemeParameters) GetClass() string { + return ClassThemeParameters +} + +func (*ThemeParameters) GetType() string { + return TypeThemeParameters +} + // Portion of the price of a product (e.g., "delivery cost", "tax amount") type LabeledPricePart struct { meta @@ -11717,39 +11936,6 @@ func (*PaymentsProviderStripe) GetType() string { return TypePaymentsProviderStripe } -// Theme colors for a payment form -type PaymentFormTheme struct { - meta - // A color of the payment form background in the RGB24 format - BackgroundColor int32 `json:"background_color"` - // A color of text in the RGB24 format - TextColor int32 `json:"text_color"` - // A color of hints in the RGB24 format - HintColor int32 `json:"hint_color"` - // A color of links in the RGB24 format - LinkColor int32 `json:"link_color"` - // A color of the buttons in the RGB24 format - ButtonColor int32 `json:"button_color"` - // A color of text on the buttons in the RGB24 format - ButtonTextColor int32 `json:"button_text_color"` -} - -func (entity *PaymentFormTheme) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PaymentFormTheme - - return json.Marshal((*stub)(entity)) -} - -func (*PaymentFormTheme) GetClass() string { - return ClassPaymentFormTheme -} - -func (*PaymentFormTheme) GetType() string { - return TypePaymentFormTheme -} - // Contains information about an invoice payment form type PaymentForm struct { meta @@ -15376,7 +15562,63 @@ func (*MessageWebsiteConnected) MessageContentType() string { return TypeMessageWebsiteConnected } -// Telegram Passport data has been sent +// Data from a web app has been sent to a bot +type MessageWebAppDataSent struct { + meta + // Text of the keyboardButtonTypeWebApp button, which opened the web app + ButtonText string `json:"button_text"` +} + +func (entity *MessageWebAppDataSent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageWebAppDataSent + + return json.Marshal((*stub)(entity)) +} + +func (*MessageWebAppDataSent) GetClass() string { + return ClassMessageContent +} + +func (*MessageWebAppDataSent) GetType() string { + return TypeMessageWebAppDataSent +} + +func (*MessageWebAppDataSent) MessageContentType() string { + return TypeMessageWebAppDataSent +} + +// Data from a web app has been received; for bots only +type MessageWebAppDataReceived struct { + meta + // Text of the keyboardButtonTypeWebApp button, which opened the web app + ButtonText string `json:"button_text"` + // Received data + Data string `json:"data"` +} + +func (entity *MessageWebAppDataReceived) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageWebAppDataReceived + + return json.Marshal((*stub)(entity)) +} + +func (*MessageWebAppDataReceived) GetClass() string { + return ClassMessageContent +} + +func (*MessageWebAppDataReceived) GetType() string { + return TypeMessageWebAppDataReceived +} + +func (*MessageWebAppDataReceived) MessageContentType() string { + return TypeMessageWebAppDataReceived +} + +// Telegram Passport data has been sent to a bot type MessagePassportDataSent struct { meta // List of Telegram Passport element types sent @@ -19709,6 +19951,93 @@ func (*ImportedContacts) GetType() string { return TypeImportedContacts } +// Describes a color to highlight a bot added to attachment menu +type AttachmentMenuBotColor struct { + meta + // Color in the RGB24 format for light themes + LightColor int32 `json:"light_color"` + // Color in the RGB24 format for dark themes + DarkColor int32 `json:"dark_color"` +} + +func (entity *AttachmentMenuBotColor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AttachmentMenuBotColor + + return json.Marshal((*stub)(entity)) +} + +func (*AttachmentMenuBotColor) GetClass() string { + return ClassAttachmentMenuBotColor +} + +func (*AttachmentMenuBotColor) GetType() string { + return TypeAttachmentMenuBotColor +} + +// Represents a bot added to attachment menu +type AttachmentMenuBot struct { + meta + // User identifier of the bot added to attachment menu + BotUserId int64 `json:"bot_user_id"` + // Name for the bot in attachment menu + Name string `json:"name"` + // Color to highlight selected name of the bot if appropriate; may be null + NameColor *AttachmentMenuBotColor `json:"name_color"` + // Default attachment menu icon for the bot in SVG format; may be null + DefaultIcon *File `json:"default_icon"` + // Attachment menu icon for the bot in SVG format for the official iOS app; may be null + IosStaticIcon *File `json:"ios_static_icon"` + // Attachment menu icon for the bot in TGS format for the official iOS app; may be null + IosAnimatedIcon *File `json:"ios_animated_icon"` + // Attachment menu icon for the bot in TGS format for the official Android app; may be null + AndroidIcon *File `json:"android_icon"` + // Attachment menu icon for the bot in TGS format for the official native macOS app; may be null + MacosIcon *File `json:"macos_icon"` + // Color to highlight selected icon of the bot if appropriate; may be null + IconColor *AttachmentMenuBotColor `json:"icon_color"` +} + +func (entity *AttachmentMenuBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AttachmentMenuBot + + return json.Marshal((*stub)(entity)) +} + +func (*AttachmentMenuBot) GetClass() string { + return ClassAttachmentMenuBot +} + +func (*AttachmentMenuBot) GetType() string { + return TypeAttachmentMenuBot +} + +// Information about the message sent by answerWebAppQuery +type SentWebAppMessage struct { + meta + // Identifier of the sent inline message, if known + InlineMessageId string `json:"inline_message_id"` +} + +func (entity *SentWebAppMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SentWebAppMessage + + return json.Marshal((*stub)(entity)) +} + +func (*SentWebAppMessage) GetClass() string { + return ClassSentWebAppMessage +} + +func (*SentWebAppMessage) GetType() string { + return TypeSentWebAppMessage +} + // Contains an HTTP URL type HttpUrl struct { meta @@ -24989,6 +25318,62 @@ func (*NotificationGroupTypeCalls) NotificationGroupTypeType() string { return TypeNotificationGroupTypeCalls } +// Describes a notification sound in MP3 format +type NotificationSound struct { + meta + // Unique identifier of the notification sound + Id JsonInt64 `json:"id"` + // Duration of the sound, in seconds + Duration int32 `json:"duration"` + // Point in time (Unix timestamp) when the sound was created + Date int32 `json:"date"` + // Title of the notification sound + Title string `json:"title"` + // Arbitrary data, defined while the sound was uploaded + Data string `json:"data"` + // File containing the sound + Sound *File `json:"sound"` +} + +func (entity *NotificationSound) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationSound + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationSound) GetClass() string { + return ClassNotificationSound +} + +func (*NotificationSound) GetType() string { + return TypeNotificationSound +} + +// Contains a list of notification sounds +type NotificationSounds struct { + meta + // A list of notification sounds + NotificationSounds []*NotificationSound `json:"notification_sounds"` +} + +func (entity *NotificationSounds) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationSounds + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationSounds) GetClass() string { + return ClassNotificationSounds +} + +func (*NotificationSounds) GetType() string { + return TypeNotificationSounds +} + // Contains information about a notification type Notification struct { meta @@ -24996,8 +25381,8 @@ type Notification struct { Id int32 `json:"id"` // Notification date Date int32 `json:"date"` - // True, if the notification was initially silent - IsSilent bool `json:"is_silent"` + // Identifier of the notification sound to be played; 0 if sound is disabled + SoundId JsonInt64 `json:"sound_id"` // Notification type Type NotificationType `json:"type"` } @@ -25022,7 +25407,7 @@ func (notification *Notification) UnmarshalJSON(data []byte) error { var tmp struct { Id int32 `json:"id"` Date int32 `json:"date"` - IsSilent bool `json:"is_silent"` + SoundId JsonInt64 `json:"sound_id"` Type json.RawMessage `json:"type"` } @@ -25033,7 +25418,7 @@ func (notification *Notification) UnmarshalJSON(data []byte) error { notification.Id = tmp.Id notification.Date = tmp.Date - notification.IsSilent = tmp.IsSilent + notification.SoundId = tmp.SoundId fieldType, _ := UnmarshalNotificationType(tmp.Type) notification.Type = fieldType @@ -25992,7 +26377,7 @@ type ConnectedWebsite struct { LastActiveDate int32 `json:"last_active_date"` // IP address from which the user was logged in, in human-readable format Ip string `json:"ip"` - // Human-readable description of a country and a region, from which the user was logged in, based on the IP address + // Human-readable description of a country and a region from which the user was logged in, based on the IP address Location string `json:"location"` } @@ -26310,6 +26695,58 @@ func (*InternalLinkTypeActiveSessions) InternalLinkTypeType() string { return TypeInternalLinkTypeActiveSessions } +// The link is a link to an attachment menu bot to be opened in the specified chat. Process given chat_link to open corresponding chat. Then call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then user needs to confirm adding the bot to attachment menu. If user confirms adding, then use toggleBotIsAddedToAttachmentMenu to add it. If attachment menu bots can't be used in the current chat, show an error to the user. If the bot is added to attachment menu, then use openWebApp with the given URL +type InternalLinkTypeAttachmentMenuBot struct { + meta + // An internal link pointing to a chat; may be null if the current chat needs to be kept + ChatLink InternalLinkType `json:"chat_link"` + // Username of the bot + BotUsername string `json:"bot_username"` + // URL to be passed to openWebApp + Url string `json:"url"` +} + +func (entity *InternalLinkTypeAttachmentMenuBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeAttachmentMenuBot + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeAttachmentMenuBot) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeAttachmentMenuBot) GetType() string { + return TypeInternalLinkTypeAttachmentMenuBot +} + +func (*InternalLinkTypeAttachmentMenuBot) InternalLinkTypeType() string { + return TypeInternalLinkTypeAttachmentMenuBot +} + +func (internalLinkTypeAttachmentMenuBot *InternalLinkTypeAttachmentMenuBot) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatLink json.RawMessage `json:"chat_link"` + BotUsername string `json:"bot_username"` + Url string `json:"url"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + internalLinkTypeAttachmentMenuBot.BotUsername = tmp.BotUsername + internalLinkTypeAttachmentMenuBot.Url = tmp.Url + + fieldChatLink, _ := UnmarshalInternalLinkType(tmp.ChatLink) + internalLinkTypeAttachmentMenuBot.ChatLink = fieldChatLink + + return nil +} + // The link contains an authentication code. Call checkAuthenticationCode with the code if the current authorization state is authorizationStateWaitCode type InternalLinkTypeAuthenticationCode struct { meta @@ -26393,13 +26830,15 @@ func (*InternalLinkTypeBotStart) InternalLinkTypeType() string { return TypeInternalLinkTypeBotStart } -// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a group to add the bot to, and then call sendBotStartMessage with the given start parameter and the chosen group chat. Bots can be added to a public group only by administrators of the group +// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat, otherwise just send /start message with bot's username added to the chat. type InternalLinkTypeBotStartInGroup struct { meta // Username of the bot BotUsername string `json:"bot_username"` // The parameter to be passed to sendBotStartMessage StartParameter string `json:"start_parameter"` + // Expected administrator rights for the bot; may be null + AdministratorRights *ChatAdministratorRights `json:"administrator_rights"` } func (entity *InternalLinkTypeBotStartInGroup) MarshalJSON() ([]byte, error) { @@ -26422,6 +26861,35 @@ func (*InternalLinkTypeBotStartInGroup) InternalLinkTypeType() string { return TypeInternalLinkTypeBotStartInGroup } +// The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, ask the current user to select a channel chat to add the bot to as an administrator. Then call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights +type InternalLinkTypeBotAddToChannel struct { + meta + // Username of the bot + BotUsername string `json:"bot_username"` + // Expected administrator rights for the bot + AdministratorRights *ChatAdministratorRights `json:"administrator_rights"` +} + +func (entity *InternalLinkTypeBotAddToChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeBotAddToChannel + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeBotAddToChannel) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeBotAddToChannel) GetType() string { + return TypeInternalLinkTypeBotAddToChannel +} + +func (*InternalLinkTypeBotAddToChannel) InternalLinkTypeType() string { + return TypeInternalLinkTypeBotAddToChannel +} + // The link is a link to the change phone number section of the app type InternalLinkTypeChangePhoneNumber struct{ meta @@ -27224,6 +27692,31 @@ func (*FileTypeDocument) FileTypeType() string { return TypeFileTypeDocument } +// The file is a notification sound +type FileTypeNotificationSound struct{ + meta +} + +func (entity *FileTypeNotificationSound) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeNotificationSound + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeNotificationSound) GetClass() string { + return ClassFileType +} + +func (*FileTypeNotificationSound) GetType() string { + return TypeFileTypeNotificationSound +} + +func (*FileTypeNotificationSound) FileTypeType() string { + return TypeFileTypeNotificationSound +} + // The file is a photo type FileTypePhoto struct{ meta @@ -31170,8 +31663,8 @@ type UpdateNotificationGroup struct { ChatId int64 `json:"chat_id"` // Chat identifier, which notification settings must be applied to the added notifications NotificationSettingsChatId int64 `json:"notification_settings_chat_id"` - // True, if the notifications must be shown without sound - IsSilent bool `json:"is_silent"` + // Identifier of the notification sound to be played; 0 if sound is disabled + NotificationSoundId JsonInt64 `json:"notification_sound_id"` // Total number of unread notifications in the group, can be bigger than number of active notifications TotalCount int32 `json:"total_count"` // List of added group notifications, sorted by notification ID @@ -31206,7 +31699,7 @@ func (updateNotificationGroup *UpdateNotificationGroup) UnmarshalJSON(data []byt Type json.RawMessage `json:"type"` ChatId int64 `json:"chat_id"` NotificationSettingsChatId int64 `json:"notification_settings_chat_id"` - IsSilent bool `json:"is_silent"` + NotificationSoundId JsonInt64 `json:"notification_sound_id"` TotalCount int32 `json:"total_count"` AddedNotifications []*Notification `json:"added_notifications"` RemovedNotificationIds []int32 `json:"removed_notification_ids"` @@ -31220,7 +31713,7 @@ func (updateNotificationGroup *UpdateNotificationGroup) UnmarshalJSON(data []byt updateNotificationGroup.NotificationGroupId = tmp.NotificationGroupId updateNotificationGroup.ChatId = tmp.ChatId updateNotificationGroup.NotificationSettingsChatId = tmp.NotificationSettingsChatId - updateNotificationGroup.IsSilent = tmp.IsSilent + updateNotificationGroup.NotificationSoundId = tmp.NotificationSoundId updateNotificationGroup.TotalCount = tmp.TotalCount updateNotificationGroup.AddedNotifications = tmp.AddedNotifications updateNotificationGroup.RemovedNotificationIds = tmp.RemovedNotificationIds @@ -32368,6 +32861,33 @@ func (*UpdateSavedAnimations) UpdateType() string { return TypeUpdateSavedAnimations } +// The list of saved notifications sounds was updated. This update may not be sent until information about a notification sound was requested for the first time +type UpdateSavedNotificationSounds struct { + meta + // The new list of identifiers of saved notification sounds + NotificationSoundIds []JsonInt64 `json:"notification_sound_ids"` +} + +func (entity *UpdateSavedNotificationSounds) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSavedNotificationSounds + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSavedNotificationSounds) GetClass() string { + return ClassUpdate +} + +func (*UpdateSavedNotificationSounds) GetType() string { + return TypeUpdateSavedNotificationSounds +} + +func (*UpdateSavedNotificationSounds) UpdateType() string { + return TypeUpdateSavedNotificationSounds +} + // The selected background has changed type UpdateSelectedBackground struct { meta @@ -32554,6 +33074,60 @@ func (*UpdateUsersNearby) UpdateType() string { return TypeUpdateUsersNearby } +// The list of bots added to attachment menu has changed +type UpdateAttachmentMenuBots struct { + meta + // The new list of bots added to attachment menu. The bots must be shown in attachment menu only in private chats. The bots must not be shown on scheduled messages screen + Bots []*AttachmentMenuBot `json:"bots"` +} + +func (entity *UpdateAttachmentMenuBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAttachmentMenuBots + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAttachmentMenuBots) GetClass() string { + return ClassUpdate +} + +func (*UpdateAttachmentMenuBots) GetType() string { + return TypeUpdateAttachmentMenuBots +} + +func (*UpdateAttachmentMenuBots) UpdateType() string { + return TypeUpdateAttachmentMenuBots +} + +// A message was sent by an opened web app, so the web app needs to be closed +type UpdateWebAppMessageSent struct { + meta + // Identifier of web app launch + WebAppLaunchId JsonInt64 `json:"web_app_launch_id"` +} + +func (entity *UpdateWebAppMessageSent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateWebAppMessageSent + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateWebAppMessageSent) GetClass() string { + return ClassUpdate +} + +func (*UpdateWebAppMessageSent) GetType() string { + return TypeUpdateWebAppMessageSent +} + +func (*UpdateWebAppMessageSent) UpdateType() string { + return TypeUpdateWebAppMessageSent +} + // The list of supported reactions has changed type UpdateReactions struct { meta @@ -32726,7 +33300,7 @@ type UpdateNewInlineQuery struct { SenderUserId int64 `json:"sender_user_id"` // User location; may be null UserLocation *Location `json:"user_location"` - // The type of the chat, from which the query originated; may be null if unknown + // The type of the chat from which the query originated; may be null if unknown ChatType ChatType `json:"chat_type"` // Text of the query Query string `json:"query"` @@ -32825,7 +33399,7 @@ type UpdateNewCallbackQuery struct { SenderUserId int64 `json:"sender_user_id"` // Identifier of the chat where the query was sent ChatId int64 `json:"chat_id"` - // Identifier of the message, from which the query originated + // Identifier of the message from which the query originated MessageId int64 `json:"message_id"` // Identifier that uniquely corresponds to the chat to which the message was sent ChatInstance JsonInt64 `json:"chat_instance"` @@ -32887,7 +33461,7 @@ type UpdateNewInlineCallbackQuery struct { Id JsonInt64 `json:"id"` // Identifier of the user who sent the query SenderUserId int64 `json:"sender_user_id"` - // Identifier of the inline message, from which the query originated + // Identifier of the inline message from which the query originated InlineMessageId string `json:"inline_message_id"` // An identifier uniquely corresponding to the chat a message was sent to ChatInstance JsonInt64 `json:"chat_instance"` diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 88a97f2..f1add86 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -938,6 +938,9 @@ func UnmarshalKeyboardButtonType(data json.RawMessage) (KeyboardButtonType, erro case TypeKeyboardButtonTypeRequestPoll: return UnmarshalKeyboardButtonTypeRequestPoll(data) + case TypeKeyboardButtonTypeWebApp: + return UnmarshalKeyboardButtonTypeWebApp(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -972,6 +975,9 @@ func UnmarshalInlineKeyboardButtonType(data json.RawMessage) (InlineKeyboardButt case TypeInlineKeyboardButtonTypeLoginUrl: return UnmarshalInlineKeyboardButtonTypeLoginUrl(data) + case TypeInlineKeyboardButtonTypeWebApp: + return UnmarshalInlineKeyboardButtonTypeWebApp(data) + case TypeInlineKeyboardButtonTypeCallback: return UnmarshalInlineKeyboardButtonTypeCallback(data) @@ -1846,6 +1852,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageWebsiteConnected: return UnmarshalMessageWebsiteConnected(data) + case TypeMessageWebAppDataSent: + return UnmarshalMessageWebAppDataSent(data) + + case TypeMessageWebAppDataReceived: + return UnmarshalMessageWebAppDataReceived(data) + case TypeMessagePassportDataSent: return UnmarshalMessagePassportDataSent(data) @@ -3672,6 +3684,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeActiveSessions: return UnmarshalInternalLinkTypeActiveSessions(data) + case TypeInternalLinkTypeAttachmentMenuBot: + return UnmarshalInternalLinkTypeAttachmentMenuBot(data) + case TypeInternalLinkTypeAuthenticationCode: return UnmarshalInternalLinkTypeAuthenticationCode(data) @@ -3684,6 +3699,9 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(data) + case TypeInternalLinkTypeBotAddToChannel: + return UnmarshalInternalLinkTypeBotAddToChannel(data) + case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) @@ -3790,6 +3808,9 @@ func UnmarshalFileType(data json.RawMessage) (FileType, error) { case TypeFileTypeDocument: return UnmarshalFileTypeDocument(data) + case TypeFileTypeNotificationSound: + return UnmarshalFileTypeNotificationSound(data) + case TypeFileTypePhoto: return UnmarshalFileTypePhoto(data) @@ -4565,6 +4586,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedAnimations: return UnmarshalUpdateSavedAnimations(data) + case TypeUpdateSavedNotificationSounds: + return UnmarshalUpdateSavedNotificationSounds(data) + case TypeUpdateSelectedBackground: return UnmarshalUpdateSelectedBackground(data) @@ -4583,6 +4607,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateUsersNearby: return UnmarshalUpdateUsersNearby(data) + case TypeUpdateAttachmentMenuBots: + return UnmarshalUpdateAttachmentMenuBots(data) + + case TypeUpdateWebAppMessageSent: + return UnmarshalUpdateWebAppMessageSent(data) + case TypeUpdateReactions: return UnmarshalUpdateReactions(data) @@ -5330,6 +5360,14 @@ func UnmarshalBotCommands(data json.RawMessage) (*BotCommands, error) { return &resp, err } +func UnmarshalBotMenuButton(data json.RawMessage) (*BotMenuButton, error) { + var resp BotMenuButton + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatLocation(data json.RawMessage) (*ChatLocation, error) { var resp ChatLocation @@ -5386,6 +5424,22 @@ func UnmarshalInputChatPhotoAnimation(data json.RawMessage) (*InputChatPhotoAnim return &resp, err } +func UnmarshalChatPermissions(data json.RawMessage) (*ChatPermissions, error) { + var resp ChatPermissions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorRights, error) { + var resp ChatAdministratorRights + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUser(data json.RawMessage) (*User, error) { var resp User @@ -5394,6 +5448,14 @@ func UnmarshalUser(data json.RawMessage) (*User, error) { return &resp, err } +func UnmarshalBotInfo(data json.RawMessage) (*BotInfo, error) { + var resp BotInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserFullInfo(data json.RawMessage) (*UserFullInfo, error) { var resp UserFullInfo @@ -5426,14 +5488,6 @@ func UnmarshalChatAdministrators(data json.RawMessage) (*ChatAdministrators, err return &resp, err } -func UnmarshalChatPermissions(data json.RawMessage) (*ChatPermissions, error) { - var resp ChatPermissions - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalChatMemberStatusCreator(data json.RawMessage) (*ChatMemberStatusCreator, error) { var resp ChatMemberStatusCreator @@ -6282,6 +6336,14 @@ func UnmarshalKeyboardButtonTypeRequestPoll(data json.RawMessage) (*KeyboardButt return &resp, err } +func UnmarshalKeyboardButtonTypeWebApp(data json.RawMessage) (*KeyboardButtonTypeWebApp, error) { + var resp KeyboardButtonTypeWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalKeyboardButton(data json.RawMessage) (*KeyboardButton, error) { var resp KeyboardButton @@ -6306,6 +6368,14 @@ func UnmarshalInlineKeyboardButtonTypeLoginUrl(data json.RawMessage) (*InlineKey return &resp, err } +func UnmarshalInlineKeyboardButtonTypeWebApp(data json.RawMessage) (*InlineKeyboardButtonTypeWebApp, error) { + var resp InlineKeyboardButtonTypeWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInlineKeyboardButtonTypeCallback(data json.RawMessage) (*InlineKeyboardButtonTypeCallback, error) { var resp InlineKeyboardButtonTypeCallback @@ -6410,6 +6480,14 @@ func UnmarshalLoginUrlInfoRequestConfirmation(data json.RawMessage) (*LoginUrlIn return &resp, err } +func UnmarshalWebAppInfo(data json.RawMessage) (*WebAppInfo, error) { + var resp WebAppInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageThreadInfo(data json.RawMessage) (*MessageThreadInfo, error) { var resp MessageThreadInfo @@ -6930,6 +7008,14 @@ func UnmarshalAddress(data json.RawMessage) (*Address, error) { return &resp, err } +func UnmarshalThemeParameters(data json.RawMessage) (*ThemeParameters, error) { + var resp ThemeParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLabeledPricePart(data json.RawMessage) (*LabeledPricePart, error) { var resp LabeledPricePart @@ -7010,14 +7096,6 @@ func UnmarshalPaymentsProviderStripe(data json.RawMessage) (*PaymentsProviderStr return &resp, err } -func UnmarshalPaymentFormTheme(data json.RawMessage) (*PaymentFormTheme, error) { - var resp PaymentFormTheme - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalPaymentForm(data json.RawMessage) (*PaymentForm, error) { var resp PaymentForm @@ -7994,6 +8072,22 @@ func UnmarshalMessageWebsiteConnected(data json.RawMessage) (*MessageWebsiteConn return &resp, err } +func UnmarshalMessageWebAppDataSent(data json.RawMessage) (*MessageWebAppDataSent, error) { + var resp MessageWebAppDataSent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageWebAppDataReceived(data json.RawMessage) (*MessageWebAppDataReceived, error) { + var resp MessageWebAppDataReceived + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessagePassportDataSent(data json.RawMessage) (*MessagePassportDataSent, error) { var resp MessagePassportDataSent @@ -9074,6 +9168,30 @@ func UnmarshalImportedContacts(data json.RawMessage) (*ImportedContacts, error) return &resp, err } +func UnmarshalAttachmentMenuBotColor(data json.RawMessage) (*AttachmentMenuBotColor, error) { + var resp AttachmentMenuBotColor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAttachmentMenuBot(data json.RawMessage) (*AttachmentMenuBot, error) { + var resp AttachmentMenuBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSentWebAppMessage(data json.RawMessage) (*SentWebAppMessage, error) { + var resp SentWebAppMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalHttpUrl(data json.RawMessage) (*HttpUrl, error) { var resp HttpUrl @@ -10330,6 +10448,22 @@ func UnmarshalNotificationGroupTypeCalls(data json.RawMessage) (*NotificationGro return &resp, err } +func UnmarshalNotificationSound(data json.RawMessage) (*NotificationSound, error) { + var resp NotificationSound + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationSounds(data json.RawMessage) (*NotificationSounds, error) { + var resp NotificationSounds + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalNotification(data json.RawMessage) (*Notification, error) { var resp Notification @@ -10698,6 +10832,14 @@ func UnmarshalInternalLinkTypeActiveSessions(data json.RawMessage) (*InternalLin return &resp, err } +func UnmarshalInternalLinkTypeAttachmentMenuBot(data json.RawMessage) (*InternalLinkTypeAttachmentMenuBot, error) { + var resp InternalLinkTypeAttachmentMenuBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeAuthenticationCode(data json.RawMessage) (*InternalLinkTypeAuthenticationCode, error) { var resp InternalLinkTypeAuthenticationCode @@ -10730,6 +10872,14 @@ func UnmarshalInternalLinkTypeBotStartInGroup(data json.RawMessage) (*InternalLi return &resp, err } +func UnmarshalInternalLinkTypeBotAddToChannel(data json.RawMessage) (*InternalLinkTypeBotAddToChannel, error) { + var resp InternalLinkTypeBotAddToChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeChangePhoneNumber(data json.RawMessage) (*InternalLinkTypeChangePhoneNumber, error) { var resp InternalLinkTypeChangePhoneNumber @@ -10962,6 +11112,14 @@ func UnmarshalFileTypeDocument(data json.RawMessage) (*FileTypeDocument, error) return &resp, err } +func UnmarshalFileTypeNotificationSound(data json.RawMessage) (*FileTypeNotificationSound, error) { + var resp FileTypeNotificationSound + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFileTypePhoto(data json.RawMessage) (*FileTypePhoto, error) { var resp FileTypePhoto @@ -12258,6 +12416,14 @@ func UnmarshalUpdateSavedAnimations(data json.RawMessage) (*UpdateSavedAnimation return &resp, err } +func UnmarshalUpdateSavedNotificationSounds(data json.RawMessage) (*UpdateSavedNotificationSounds, error) { + var resp UpdateSavedNotificationSounds + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateSelectedBackground(data json.RawMessage) (*UpdateSelectedBackground, error) { var resp UpdateSelectedBackground @@ -12306,6 +12472,22 @@ func UnmarshalUpdateUsersNearby(data json.RawMessage) (*UpdateUsersNearby, error return &resp, err } +func UnmarshalUpdateAttachmentMenuBots(data json.RawMessage) (*UpdateAttachmentMenuBots, error) { + var resp UpdateAttachmentMenuBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateWebAppMessageSent(data json.RawMessage) (*UpdateWebAppMessageSent, error) { + var resp UpdateWebAppMessageSent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateReactions(data json.RawMessage) (*UpdateReactions, error) { var resp UpdateReactions @@ -12795,6 +12977,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBotCommands: return UnmarshalBotCommands(data) + case TypeBotMenuButton: + return UnmarshalBotMenuButton(data) + case TypeChatLocation: return UnmarshalChatLocation(data) @@ -12816,9 +13001,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputChatPhotoAnimation: return UnmarshalInputChatPhotoAnimation(data) + case TypeChatPermissions: + return UnmarshalChatPermissions(data) + + case TypeChatAdministratorRights: + return UnmarshalChatAdministratorRights(data) + case TypeUser: return UnmarshalUser(data) + case TypeBotInfo: + return UnmarshalBotInfo(data) + case TypeUserFullInfo: return UnmarshalUserFullInfo(data) @@ -12831,9 +13025,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministrators: return UnmarshalChatAdministrators(data) - case TypeChatPermissions: - return UnmarshalChatPermissions(data) - case TypeChatMemberStatusCreator: return UnmarshalChatMemberStatusCreator(data) @@ -13152,6 +13343,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeKeyboardButtonTypeRequestPoll: return UnmarshalKeyboardButtonTypeRequestPoll(data) + case TypeKeyboardButtonTypeWebApp: + return UnmarshalKeyboardButtonTypeWebApp(data) + case TypeKeyboardButton: return UnmarshalKeyboardButton(data) @@ -13161,6 +13355,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInlineKeyboardButtonTypeLoginUrl: return UnmarshalInlineKeyboardButtonTypeLoginUrl(data) + case TypeInlineKeyboardButtonTypeWebApp: + return UnmarshalInlineKeyboardButtonTypeWebApp(data) + case TypeInlineKeyboardButtonTypeCallback: return UnmarshalInlineKeyboardButtonTypeCallback(data) @@ -13200,6 +13397,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLoginUrlInfoRequestConfirmation: return UnmarshalLoginUrlInfoRequestConfirmation(data) + case TypeWebAppInfo: + return UnmarshalWebAppInfo(data) + case TypeMessageThreadInfo: return UnmarshalMessageThreadInfo(data) @@ -13395,6 +13595,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAddress: return UnmarshalAddress(data) + case TypeThemeParameters: + return UnmarshalThemeParameters(data) + case TypeLabeledPricePart: return UnmarshalLabeledPricePart(data) @@ -13425,9 +13628,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePaymentsProviderStripe: return UnmarshalPaymentsProviderStripe(data) - case TypePaymentFormTheme: - return UnmarshalPaymentFormTheme(data) - case TypePaymentForm: return UnmarshalPaymentForm(data) @@ -13794,6 +13994,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageWebsiteConnected: return UnmarshalMessageWebsiteConnected(data) + case TypeMessageWebAppDataSent: + return UnmarshalMessageWebAppDataSent(data) + + case TypeMessageWebAppDataReceived: + return UnmarshalMessageWebAppDataReceived(data) + case TypeMessagePassportDataSent: return UnmarshalMessagePassportDataSent(data) @@ -14199,6 +14405,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeImportedContacts: return UnmarshalImportedContacts(data) + case TypeAttachmentMenuBotColor: + return UnmarshalAttachmentMenuBotColor(data) + + case TypeAttachmentMenuBot: + return UnmarshalAttachmentMenuBot(data) + + case TypeSentWebAppMessage: + return UnmarshalSentWebAppMessage(data) + case TypeHttpUrl: return UnmarshalHttpUrl(data) @@ -14670,6 +14885,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeNotificationGroupTypeCalls: return UnmarshalNotificationGroupTypeCalls(data) + case TypeNotificationSound: + return UnmarshalNotificationSound(data) + + case TypeNotificationSounds: + return UnmarshalNotificationSounds(data) + case TypeNotification: return UnmarshalNotification(data) @@ -14808,6 +15029,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeActiveSessions: return UnmarshalInternalLinkTypeActiveSessions(data) + case TypeInternalLinkTypeAttachmentMenuBot: + return UnmarshalInternalLinkTypeAttachmentMenuBot(data) + case TypeInternalLinkTypeAuthenticationCode: return UnmarshalInternalLinkTypeAuthenticationCode(data) @@ -14820,6 +15044,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(data) + case TypeInternalLinkTypeBotAddToChannel: + return UnmarshalInternalLinkTypeBotAddToChannel(data) + case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(data) @@ -14907,6 +15134,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFileTypeDocument: return UnmarshalFileTypeDocument(data) + case TypeFileTypeNotificationSound: + return UnmarshalFileTypeNotificationSound(data) + case TypeFileTypePhoto: return UnmarshalFileTypePhoto(data) @@ -15393,6 +15623,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedAnimations: return UnmarshalUpdateSavedAnimations(data) + case TypeUpdateSavedNotificationSounds: + return UnmarshalUpdateSavedNotificationSounds(data) + case TypeUpdateSelectedBackground: return UnmarshalUpdateSelectedBackground(data) @@ -15411,6 +15644,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateUsersNearby: return UnmarshalUpdateUsersNearby(data) + case TypeUpdateAttachmentMenuBots: + return UnmarshalUpdateAttachmentMenuBots(data) + + case TypeUpdateWebAppMessageSent: + return UnmarshalUpdateWebAppMessageSent(data) + case TypeUpdateReactions: return UnmarshalUpdateReactions(data) diff --git a/data/td_api.tl b/data/td_api.tl index 173a02c..c4479ec 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -367,10 +367,14 @@ userTypeRegular = UserType; //@description A deleted user or deleted bot. No information on the user besides the user identifier is available. It is not possible to perform any active actions on this type of user userTypeDeleted = UserType; -//@description A bot (see https://core.telegram.org/bots) @can_join_groups True, if the bot can be invited to basic group and supergroup chats +//@description A bot (see https://core.telegram.org/bots) +//@can_join_groups True, if the bot can be invited to basic group and supergroup chats //@can_read_all_group_messages True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages -//@is_inline True, if the bot supports inline queries @inline_query_placeholder Placeholder for inline queries (displayed on the application input field) @need_location True, if the location of the user is expected to be sent with every inline query to this bot -userTypeBot can_join_groups:Bool can_read_all_group_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool = UserType; +//@is_inline True, if the bot supports inline queries +//@inline_query_placeholder Placeholder for inline queries (displayed on the application input field) +//@need_location True, if the location of the user is expected to be sent with every inline query to this bot +//@can_be_added_to_attachment_menu True, if the bot can be added to attachment menu +userTypeBot can_join_groups:Bool can_read_all_group_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_be_added_to_attachment_menu:Bool = UserType; //@description No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type userTypeUnknown = UserType; @@ -382,6 +386,9 @@ botCommand command:string description:string = BotCommand; //@description Contains a list of bot commands @bot_user_id Bot's user identifier @commands List of bot commands botCommands bot_user_id:int53 commands:vector = BotCommands; +//@description Describes a button to be shown instead of bot commands menu button @text Text of the button @url URL to be passed to openWebApp +botMenuButton text:string url:string = BotMenuButton; + //@description Represents a location to which a chat is connected @location The location @address Location address; 1-64 characters, as defined by the chat owner chatLocation location:location address:string = ChatLocation; @@ -420,6 +427,35 @@ inputChatPhotoStatic photo:InputFile = InputChatPhoto; inputChatPhotoAnimation animation:InputFile main_frame_timestamp:double = InputChatPhoto; +//@description Describes actions that a user is allowed to take in a chat +//@can_send_messages True, if the user can send text messages, contacts, locations, and venues +//@can_send_media_messages True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions +//@can_send_polls True, if the user can send polls. Implies can_send_messages permissions +//@can_send_stickers True, if the user can send stickers. Implies can_send_messages permissions +//@can_send_animations True, if the user can send animations. Implies can_send_messages permissions +//@can_send_games True, if the user can send games. Implies can_send_messages permissions +//@can_use_inline_bots True, if the user can use inline bots. Implies can_send_messages permissions +//@can_add_web_page_previews True, if the user may add a web page preview to their messages. Implies can_send_messages permissions +//@can_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; + +//@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 +//@can_change_info True, if the administrator can change the chat title, photo, and other settings +//@can_post_messages True, if the administrator can create channel posts; applicable to channels only +//@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only +//@can_delete_messages True, if the administrator can delete messages of other users +//@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_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; + + //@description Represents a user //@id User identifier //@access_hash User access hash @@ -441,6 +477,15 @@ inputChatPhotoAnimation animation:InputFile main_frame_timestamp:double = InputC //@language_code IETF language tag of the user's language; 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 is_contact:Bool is_mutual_contact:Bool is_verified:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool have_access:Bool type:UserType language_code:string = User; +//@description Contains information about a bot +//@share_text The text that is shown on the bot's profile page and is sent together with the link when users share the bot +//@param_description The text shown in the chat with the bot if the chat is empty +//@menu_button Information about a button to show instead of the bot commands menu button; may be null if ordinary bot commands menu must be shown +//@commands List of the bot commands +//@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null +//@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null +botInfo share_text:string description:string 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 //@is_blocked True, if the user is blocked by the current user @@ -450,11 +495,9 @@ user id:int53 access_hash:int64 first_name:string last_name:string username:stri //@has_private_forwards True, if the user can't be linked in forwarded messages due to their privacy settings //@need_phone_number_privacy_exception True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used //@bio A short user bio -//@share_text For bots, the text that is shown on the bot's profile page and is sent together with the link when users share the bot -//@param_description For bots, the text shown in the chat with the bot if the chat is empty //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user -//@commands For bots, list of the bot commands -userFullInfo photo:chatPhoto is_blocked:Bool can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool need_phone_number_privacy_exception:Bool bio:string share_text:string description:string group_in_common_count:int32 commands:vector = UserFullInfo; +//@bot_info For bots, information about the bot; may be null +userFullInfo photo:chatPhoto is_blocked:Bool can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool need_phone_number_privacy_exception:Bool bio:string group_in_common_count:int32 bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -467,20 +510,6 @@ chatAdministrator user_id:int53 custom_title:string is_owner:Bool = ChatAdminist chatAdministrators administrators:vector = ChatAdministrators; -//@description Describes actions that a user is allowed to take in a chat -//@can_send_messages True, if the user can send text messages, contacts, locations, and venues -//@can_send_media_messages True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions -//@can_send_polls True, if the user can send polls. Implies can_send_messages permissions -//@can_send_stickers True, if the user can send stickers. Implies can_send_messages permissions -//@can_send_animations True, if the user can send animations. Implies can_send_messages permissions -//@can_send_games True, if the user can send games. Implies can_send_messages permissions -//@can_use_inline_bots True, if the user can use inline bots. Implies can_send_messages permissions -//@can_add_web_page_previews True, if the user may add a web page preview to their messages. Implies can_send_messages permissions -//@can_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; - //@class ChatMemberStatus @description Provides information about the status of a member in a chat //@description The user is the owner of the chat and has all the administrator privileges @@ -492,18 +521,8 @@ chatMemberStatusCreator custom_title:string is_anonymous:Bool is_member:Bool = C //@description The user is a member of the chat and has some additional privileges. In basic groups, administrators can edit and delete messages sent by others, add new members, ban unprivileged members, and manage video chats. In supergroups and channels, there are more detailed options for administrator privileges //@custom_title A custom title of the administrator; 0-16 characters without emojis; applicable to supergroups only //@can_be_edited True, if the current user can edit the administrator privileges for the called user -//@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 -//@can_change_info True, if the administrator can change the chat title, photo, and other settings -//@can_post_messages True, if the administrator can create channel posts; applicable to channels only -//@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only -//@can_delete_messages True, if the administrator can delete messages of other users -//@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_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 -chatMemberStatusAdministrator custom_title:string can_be_edited:Bool 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 = ChatMemberStatus; +//@rights Rights of the administrator +chatMemberStatusAdministrator custom_title:string can_be_edited:Bool rights:chatAdministratorRights = ChatMemberStatus; //@description The user is a member of the chat, without any additional privileges or restrictions chatMemberStatusMember = ChatMemberStatus; @@ -782,7 +801,7 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector last //@reaction Text representation of the reaction //@total_count Number of times the reaction was added //@is_chosen True, if the reaction is chosen by the current user -//@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private chats, basic groups and supergroups +//@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats messageReaction reaction:string total_count:int32 is_chosen:Bool recent_sender_ids:vector = MessageReaction; //@description Contains information about interactions with a message @@ -873,7 +892,7 @@ messageCalendar total_count:int32 days:vector = MessageCalen //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages //@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 -//@link An internal link to be opened when the sponsored message is clicked; may be null. If null, the sponsor chat needs to be opened instead +//@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 sponsor_chat_id:int53 sponsor_chat_info:chatInviteLinkInfo link:InternalLinkType content:MessageContent = SponsoredMessage; @@ -904,32 +923,32 @@ foundFileDownloads total_counts:downloadedFileCounts files:vector //@description Notification settings applied to all private and secret chats when the corresponding chat setting has a default value notificationSettingsScopePrivateChats = NotificationSettingsScope; -//@description Notification settings applied to all basic groups and supergroups when the corresponding chat setting has a default value +//@description Notification settings applied to all basic group and supergroup chats when the corresponding chat setting has a default value notificationSettingsScopeGroupChats = NotificationSettingsScope; -//@description Notification settings applied to all channels when the corresponding chat setting has a default value +//@description Notification settings applied to all channel chats when the corresponding chat setting has a default value notificationSettingsScopeChannelChats = NotificationSettingsScope; //@description Contains information about notification settings for a chat //@use_default_mute_for If true, mute_for is ignored and the value for the relevant type of chat is used instead @mute_for Time left before notifications will be unmuted, in seconds -//@use_default_sound If true, sound is ignored and the value for the relevant type of chat is used instead @sound The name of an audio file to be used for notification sounds; only applies to iOS applications +//@use_default_sound If true, the value for the relevant type of chat is used instead of sound_id @sound_id Identifier of the notification sound to be played; 0 if sound is disabled //@use_default_show_preview If true, show_preview is ignored and the value for the relevant type of chat is used instead @show_preview True, if message content must be displayed in notifications //@use_default_disable_pinned_message_notifications If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat is used instead @disable_pinned_message_notifications If true, notifications for incoming pinned messages will be created as for an ordinary unread message //@use_default_disable_mention_notifications If true, disable_mention_notifications is ignored and the value for the relevant type of chat is used instead @disable_mention_notifications If true, notifications for messages with mentions will be created as for an ordinary unread message -chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound:string use_default_show_preview:Bool show_preview:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; +chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound_id:int64 use_default_show_preview:Bool show_preview:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; //@description Contains information about notification settings for several chats //@mute_for Time left before notifications will be unmuted, in seconds -//@sound The name of an audio file to be used for notification sounds; only applies to iOS applications +//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled //@show_preview True, if message content must be displayed in notifications //@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message //@disable_mention_notifications True, if notifications for messages with mentions will be created as for an ordinary unread message -scopeNotificationSettings mute_for:int32 sound:string show_preview:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings; +scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings; //@description Contains information about a message draft -//@reply_to_message_id Identifier of the message to reply to; 0 if none +//@reply_to_message_id Identifier of the replied message; 0 if none //@date Point in time (Unix timestamp) when the draft was created //@input_message_text Content of the message draft; must be of the type inputMessageText draftMessage reply_to_message_id:int53 date:int32 input_message_text:InputMessageContent = DraftMessage; @@ -1117,6 +1136,9 @@ keyboardButtonTypeRequestLocation = KeyboardButtonType; //@description A button that allows the user to create and send a poll when pressed; available only in private chats @force_regular If true, only regular polls must be allowed to create @force_quiz If true, only polls in quiz mode must be allowed to create keyboardButtonTypeRequestPoll force_regular:Bool force_quiz:Bool = KeyboardButtonType; +//@description A button that opens a web app by calling getWebAppUrl @url An HTTP URL to pass to getWebAppUrl +keyboardButtonTypeWebApp url:string = KeyboardButtonType; + //@description Represents a single button in a bot keyboard @text Text of the button @type Type of the button keyboardButton text:string type:KeyboardButtonType = KeyboardButton; @@ -1127,9 +1149,12 @@ keyboardButton text:string type:KeyboardButtonType = KeyboardButton; //@description A button that opens a specified URL @url HTTP or tg:// URL to open inlineKeyboardButtonTypeUrl url:string = InlineKeyboardButtonType; -//@description A button that opens a specified URL and automatically authorize the current user if allowed to do so @url An HTTP URL to open @id Unique button identifier @forward_text If non-empty, new text of the button in forwarded messages +//@description A button that opens a specified URL and automatically authorize the current user by calling getLoginUrlInfo @url An HTTP URL to pass to getLoginUrlInfo @id Unique button identifier @forward_text If non-empty, new text of the button in forwarded messages inlineKeyboardButtonTypeLoginUrl url:string id:int53 forward_text:string = InlineKeyboardButtonType; +//@description A button that opens a web app by calling openWebApp @url An HTTP URL to pass to openWebApp +inlineKeyboardButtonTypeWebApp url:string = InlineKeyboardButtonType; + //@description A button that sends a callback query to a bot @data Data to be sent to the bot via a callback query inlineKeyboardButtonTypeCallback data:bytes = InlineKeyboardButtonType; @@ -1187,6 +1212,10 @@ loginUrlInfoOpen url:string skip_confirm:Bool = LoginUrlInfo; loginUrlInfoRequestConfirmation url:string domain:string bot_user_id:int53 request_write_access:Bool = LoginUrlInfo; +//@description Contains information about a web app @launch_id Unique identifier for the web app launch @url A web app URL to open in a web view +webAppInfo launch_id:int64 url:string = WebAppInfo; + + //@description Contains information about a message thread //@chat_id Identifier of the chat to which the message thread belongs //@message_thread_id Message thread identifier, unique within the chat @@ -1365,7 +1394,7 @@ pageBlockCollage page_blocks:vector caption:pageBlockCaption = PageBl //@description A slideshow @page_blocks Slideshow item contents @caption Block caption pageBlockSlideshow page_blocks:vector caption:pageBlockCaption = PageBlock; -//@description A link to a chat @title Chat title @photo Chat photo; may be null @username Chat username, by which all other information about the chat can be resolved +//@description A link to a chat @title Chat title @photo Chat photo; may be null @username Chat username by which all other information about the chat can be resolved pageBlockChatLink title:string photo:chatPhotoInfo username:string = PageBlock; //@description A table @caption Table caption @cells Table cells @is_bordered True, if the table is bordered @is_striped True, if the table is striped @@ -1445,6 +1474,12 @@ bankCardInfo title:string actions:vector = BankCardInfo; address country_code:string state:string city:string street_line1:string street_line2:string postal_code:string = Address; +//@description Contains parameters of the app theme @background_color A color of the background in the RGB24 format @text_color A color of text in the RGB24 format +//@hint_color A color of hints in the RGB24 format @link_color A color of links in the RGB24 format @button_color A color of the buttons in the RGB24 format +//@button_text_color A color of text on the buttons in the RGB24 format +themeParameters background_color:int32 text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; + + //@description Portion of the price of a product (e.g., "delivery cost", "tax amount") @label Label for this portion of the product price @amount Currency amount in the smallest units of the currency labeledPricePart label:string amount:int53 = LabeledPricePart; @@ -1488,11 +1523,6 @@ inputCredentialsGooglePay data:string = InputCredentials; //@description Stripe payment provider @publishable_key Stripe API publishable key @need_country True, if the user country must be provided @need_postal_code True, if the user ZIP/postal code must be provided @need_cardholder_name True, if the cardholder name must be provided paymentsProviderStripe publishable_key:string need_country:Bool need_postal_code:Bool need_cardholder_name:Bool = PaymentsProviderStripe; -//@description Theme colors for a payment form @background_color A color of the payment form background in the RGB24 format @text_color A color of text in the RGB24 format -//@hint_color A color of hints in the RGB24 format @link_color A color of links in the RGB24 format @button_color A color of the buttons in the RGB24 format -//@button_text_color A color of text on the buttons in the RGB24 format -paymentFormTheme background_color:int32 text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = PaymentFormTheme; - //@description Contains information about an invoice payment form //@id The payment form identifier //@invoice Full information of the invoice @@ -1926,7 +1956,13 @@ messageContactRegistered = MessageContent; //@description The current user has connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website messageWebsiteConnected domain_name:string = MessageContent; -//@description Telegram Passport data has been sent @types List of Telegram Passport element types sent +//@description Data from a web app has been sent to a bot @button_text Text of the keyboardButtonTypeWebApp button, which opened the web app +messageWebAppDataSent button_text:string = MessageContent; + +//@description Data from a web app has been received; for bots only @button_text Text of the keyboardButtonTypeWebApp button, which opened the web app @data Received data +messageWebAppDataReceived button_text:string data:string = MessageContent; + +//@description Telegram Passport data has been sent to a bot @types List of Telegram Passport element types sent messagePassportDataSent types:vector = MessageContent; //@description Telegram Passport data has been received; for bots only @elements List of received Telegram Passport elements @credentials Encrypted data credentials @@ -2488,6 +2524,25 @@ diceStickersSlotMachine background:sticker lever:sticker left_reel:sticker cente importedContacts user_ids:vector importer_count:vector = ImportedContacts; +//@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB24 format for light themes @dark_color Color in the RGB24 format for dark themes +attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotColor; + +//@description Represents a bot added to attachment menu +//@bot_user_id User identifier of the bot added to attachment menu +//@name Name for the bot in attachment menu +//@name_color Color to highlight selected name of the bot if appropriate; may be null +//@default_icon Default attachment menu icon for the bot in SVG format; may be null +//@ios_static_icon Attachment menu icon for the bot in SVG format for the official iOS app; may be null +//@ios_animated_icon Attachment menu icon for the bot in TGS format for the official iOS app; may be null +//@android_icon Attachment menu icon for the bot in TGS format for the official Android app; may be null +//@macos_icon Attachment menu icon for the bot in TGS format for the official native macOS app; may be null +//@icon_color Color to highlight selected icon of the bot if appropriate; may be null +attachmentMenuBot bot_user_id:int53 name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file android_icon:file macos_icon:file icon_color:attachmentMenuBotColor = AttachmentMenuBot; + +//@description Information about the message sent by answerWebAppQuery @inline_message_id Identifier of the sent inline message, if known +sentWebAppMessage inline_message_id:string = SentWebAppMessage; + + //@description Contains an HTTP URL @url The URL httpUrl url:string = HttpUrl; @@ -3111,9 +3166,22 @@ notificationGroupTypeSecretChat = NotificationGroupType; notificationGroupTypeCalls = NotificationGroupType; +//@description Describes a notification sound in MP3 format +//@id Unique identifier of the notification sound +//@duration Duration of the sound, in seconds +//@date Point in time (Unix timestamp) when the sound was created +//@title Title of the notification sound +//@data Arbitrary data, defined while the sound was uploaded +//@sound File containing the sound +notificationSound id:int64 duration:int32 date:int32 title:string data:string sound:file = NotificationSound; + +//@description Contains a list of notification sounds @notification_sounds A list of notification sounds +notificationSounds notification_sounds:vector = NotificationSounds; + + //@description Contains information about a notification @id Unique persistent identifier of this notification @date Notification date -//@is_silent True, if the notification was initially silent @type Notification type -notification id:int32 date:int32 is_silent:Bool type:NotificationType = Notification; +//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled @type Notification type +notification id:int32 date:int32 sound_id:int64 type:NotificationType = Notification; //@description Describes a group of notifications @id Unique persistent auto-incremented from 1 identifier of the notification group @type Type of the group //@chat_id Identifier of a chat to which all notifications in the group belong @@ -3246,7 +3314,7 @@ sessions sessions:vector inactive_session_ttl_days:int32 = Sessions; //@log_in_date Point in time (Unix timestamp) when the user was logged in //@last_active_date Point in time (Unix timestamp) when obtained authorization was last used //@ip IP address from which the user was logged in, in human-readable format -//@location Human-readable description of a country and a region, from which the user was logged in, based on the IP address +//@location Human-readable description of a country and a region from which the user was logged in, based on the IP address connectedWebsite id:int64 domain_name:string bot_user_id:int53 browser:string platform:string log_in_date:int32 last_active_date:int32 ip:string location:string = ConnectedWebsite; //@description Contains a list of websites the current user is logged in with Telegram @websites List of connected websites @@ -3291,6 +3359,13 @@ chatReportReasonCustom = ChatReportReason; //@description The link is a link to the active sessions section of the app. Use getActiveSessions to handle the link internalLinkTypeActiveSessions = InternalLinkType; +//@description The link is a link to an attachment menu bot to be opened in the specified chat. Process given chat_link to open corresponding chat. +//-Then call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then use getAttachmentMenuBot to receive information about the bot. +//-If the bot isn't added to attachment menu, then user needs to confirm adding the bot to attachment menu. If user confirms adding, then use toggleBotIsAddedToAttachmentMenu to add it. +//-If attachment menu bots can't be used in the current chat, show an error to the user. If the bot is added to attachment menu, then use openWebApp with the given URL +//@chat_link An internal link pointing to a chat; may be null if the current chat needs to be kept @bot_username Username of the bot @url URL to be passed to openWebApp +internalLinkTypeAttachmentMenuBot chat_link:InternalLinkType bot_username:string url:string = InternalLinkType; + //@description The link contains an authentication code. Call checkAuthenticationCode with the code if the current authorization state is authorizationStateWaitCode @code The authentication code internalLinkTypeAuthenticationCode code:string = InternalLinkType; @@ -3303,9 +3378,19 @@ internalLinkTypeBackground background_name:string = InternalLinkType; internalLinkTypeBotStart bot_username:string start_parameter:string = InternalLinkType; //@description The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, -//-ask the current user to select a group to add the bot to, and then call sendBotStartMessage with the given start parameter and the chosen group chat. Bots can be added to a public group only by administrators of the group -//@bot_username Username of the bot @start_parameter The parameter to be passed to sendBotStartMessage -internalLinkTypeBotStartInGroup bot_username:string start_parameter:string = InternalLinkType; +//-ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. +//-If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, +//-check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, +//-and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. +//-Then if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat, otherwise just send /start message with bot's username added to the chat. +//@bot_username Username of the bot @start_parameter The parameter to be passed to sendBotStartMessage @administrator_rights Expected administrator rights for the bot; may be null +internalLinkTypeBotStartInGroup bot_username:string start_parameter:string administrator_rights:chatAdministratorRights = InternalLinkType; + +//@description The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, +//-ask the current user to select a channel chat to add the bot to as an administrator. Then call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, +//-check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights +//@bot_username Username of the bot @administrator_rights Expected administrator rights for the bot +internalLinkTypeBotAddToChannel bot_username:string administrator_rights:chatAdministratorRights = InternalLinkType; //@description The link is a link to the change phone number section of the app internalLinkTypeChangePhoneNumber = InternalLinkType; @@ -3414,6 +3499,9 @@ fileTypeAudio = FileType; //@description The file is a document fileTypeDocument = FileType; +//@description The file is a notification sound +fileTypeNotificationSound = FileType; + //@description The file is a photo fileTypePhoto = FileType; @@ -3921,10 +4009,10 @@ updateNotification notification_group_id:int32 notification:notification = Updat //@type New type of the notification group //@chat_id Identifier of a chat to which all notifications in the group belong //@notification_settings_chat_id Chat identifier, which notification settings must be applied to the added notifications -//@is_silent True, if the notifications must be shown without sound +//@notification_sound_id Identifier of the notification sound to be played; 0 if sound is disabled //@total_count Total number of unread notifications in the group, can be bigger than number of active notifications //@added_notifications List of added group notifications, sorted by notification ID @removed_notification_ids Identifiers of removed group notifications, sorted by notification ID -updateNotificationGroup notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 is_silent:Bool total_count:int32 added_notifications:vector removed_notification_ids:vector = Update; +updateNotificationGroup notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 notification_sound_id:int64 total_count:int32 added_notifications:vector removed_notification_ids:vector = Update; //@description Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update @groups Lists of active notification groups updateActiveNotifications groups:vector = Update; @@ -4050,6 +4138,9 @@ updateFavoriteStickers sticker_ids:vector = Update; //@description The list of saved animations was updated @animation_ids The new list of file identifiers of saved animations updateSavedAnimations animation_ids:vector = Update; +//@description The list of saved notifications sounds was updated. This update may not be sent until information about a notification sound was requested for the first time @notification_sound_ids The new list of identifiers of saved notification sounds +updateSavedNotificationSounds notification_sound_ids:vector = Update; + //@description The selected background has changed @for_dark_theme True, if background for dark theme has changed @background The new selected background; may be null updateSelectedBackground for_dark_theme:Bool background:background = Update; @@ -4068,6 +4159,12 @@ updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService //@description The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request @users_nearby The new list of users nearby updateUsersNearby users_nearby:vector = Update; +//@description The list of bots added to attachment menu has changed @bots The new list of bots added to attachment menu. The bots must be shown in attachment menu only in private chats. The bots must not be shown on scheduled messages screen +updateAttachmentMenuBots bots:vector = Update; + +//@description A message was sent by an opened web app, so the web app needs to be closed @web_app_launch_id Identifier of web app launch +updateWebAppMessageSent web_app_launch_id:int64 = Update; + //@description The list of supported reactions has changed @reactions The new list of supported reactions updateReactions reactions:vector = Update; @@ -4085,7 +4182,7 @@ updateAnimationSearchParameters provider:string emojis:vector = Update; updateSuggestedActions added_actions:vector removed_actions:vector = Update; //@description A new incoming inline query; for bots only @id Unique query identifier @sender_user_id Identifier of the user who sent the query @user_location User location; may be null -//@chat_type The type of the chat, from which the query originated; may be null if unknown @query Text of the query @offset Offset of the first entry to return +//@chat_type The type of the chat from which the query originated; may be null if unknown @query Text of the query @offset Offset of the first entry to return updateNewInlineQuery id:int64 sender_user_id:int53 user_location:location chat_type:ChatType query:string offset:string = Update; //@description The user has chosen a result of an inline query; for bots only @sender_user_id Identifier of the user who sent the query @user_location User location; may be null @@ -4093,11 +4190,11 @@ updateNewInlineQuery id:int64 sender_user_id:int53 user_location:location chat_t updateNewChosenInlineResult sender_user_id:int53 user_location:location query:string result_id:string inline_message_id:string = Update; //@description A new incoming callback query; for bots only @id Unique query identifier @sender_user_id Identifier of the user who sent the query -//@chat_id Identifier of the chat where the query was sent @message_id Identifier of the message, from which the query originated +//@chat_id Identifier of the chat where the query was sent @message_id Identifier of the message from which the query originated //@chat_instance Identifier that uniquely corresponds to the chat to which the message was sent @payload Query payload updateNewCallbackQuery id:int64 sender_user_id:int53 chat_id:int53 message_id:int53 chat_instance:int64 payload:CallbackQueryPayload = Update; -//@description A new incoming callback query from a message sent via a bot; for bots only @id Unique query identifier @sender_user_id Identifier of the user who sent the query @inline_message_id Identifier of the inline message, from which the query originated +//@description A new incoming callback query from a message sent via a bot; for bots only @id Unique query identifier @sender_user_id Identifier of the user who sent the query @inline_message_id Identifier of the inline message from which the query originated //@chat_instance An identifier uniquely corresponding to the chat a message was sent to @payload Query payload updateNewInlineCallbackQuery id:int64 sender_user_id:int53 inline_message_id:string chat_instance:int64 payload:CallbackQueryPayload = Update; @@ -4428,7 +4525,7 @@ 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; requires owner privileges. For group chats this will release the username and remove all members. Chats with more than 1000 members can't be deleted using this method @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 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 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 @@ -4559,7 +4656,7 @@ setChatMessageSender chat_id:int53 message_sender_id:MessageSender = Ok; //@description Sends a message. Returns the sent message //@chat_id Target chat //@message_thread_id If not 0, a message thread identifier in which the message will be sent -//@reply_to_message_id Identifier of the message to reply to or 0 +//@reply_to_message_id Identifier of the replied message; 0 if none //@options Options to be used to send the message; pass null to use default options //@reply_markup Markup for replying to the message; pass null if none; for bots only //@input_message_content The content of the message to be sent @@ -4568,7 +4665,7 @@ sendMessage chat_id:int53 message_thread_id:int53 reply_to_message_id:int53 opti //@description Sends 2-10 messages grouped together into an album. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages //@chat_id Target chat //@message_thread_id If not 0, a message thread identifier in which the messages will be sent -//@reply_to_message_id Identifier of a message to reply to or 0 +//@reply_to_message_id Identifier of a replied message; 0 if none //@options Options to be used to send the messages; pass null to use default options //@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album //@only_preview Pass true to get fake messages instead of actually sending them @@ -4581,7 +4678,7 @@ sendBotStartMessage bot_user_id:int53 chat_id:int53 parameter:string = Message; //@description Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message //@chat_id Target chat //@message_thread_id If not 0, a message thread identifier in which the message will be sent -//@reply_to_message_id Identifier of a message to reply to or 0 +//@reply_to_message_id Identifier of a replied message; 0 if none //@options Options to be used to send the message; pass null to use default options //@query_id Identifier of the inline query //@result_id Identifier of the inline result @@ -4609,7 +4706,7 @@ sendChatScreenshotTakenNotification chat_id:int53 = Ok; //@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message //@chat_id Target chat //@sender_id Identifier of the sender of the message -//@reply_to_message_id Identifier of the message to reply to or 0 +//@reply_to_message_id Identifier of the replied message; 0 if none //@disable_notification Pass true to disable notification for the message //@input_message_content The content of the message to be added addLocalMessage chat_id:int53 sender_id:MessageSender reply_to_message_id:int53 disable_notification:Bool input_message_content:InputMessageContent = Message; @@ -4753,6 +4850,9 @@ getJsonValue json:string = JsonValue; //@description Converts a JsonValue object to corresponding JSON-serialized string. Can be called synchronously @json_value The JsonValue object getJsonString json_value:JsonValue = Text; +//@description Converts a themeParameters object to corresponding JSON-serialized string. Can be called synchronously @theme Theme parameters to convert to JSON +getThemeParametersJsonString theme:themeParameters = Text; + //@description Changes the user answer to a poll. A poll in quiz mode can be answered only once //@chat_id Identifier of the chat to which the poll belongs @@ -4809,6 +4909,34 @@ getInlineQueryResults bot_user_id:int53 chat_id:int53 user_location:location que answerInlineQuery inline_query_id:int64 is_personal:Bool results:vector cache_time:int32 next_offset:string switch_pm_text:string switch_pm_parameter:string = Ok; +//@description Returns an HTTPS URL of a web app to open after keyboardButtonTypeWebApp button is pressed +//@bot_user_id Identifier of the target bot +//@url The URL from the keyboardButtonTypeWebApp button +//@theme Preferred web app theme; pass null to use the default theme +getWebAppUrl bot_user_id:int53 url:string theme:themeParameters = HttpUrl; + +//@description Sends data received from a keyboardButtonTypeWebApp web app to a bot +//@bot_user_id Identifier of the target bot @button_text Text of the keyboardButtonTypeWebApp button, which opened the web app @data Received data +sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; + +//@description Informs TDLib that a web app is being opened from attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. +//-For each bot, a confirmation alert about data sent to the bot must be shown once +//@chat_id Identifier of the chat in which the web app is opened. Web apps can be opened only in private chats for now +//@bot_user_id Identifier of the bot, providing the web app +//@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, or an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise +//@theme Preferred web app theme; pass null to use the default theme +//@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 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; + +//@description Sets the result of interaction with a web app and sends corresponding message on behalf of the user to the chat from which the query originated; for bots only +//@web_app_query_id Identifier of the web app query +//@result The result of the query +answerWebAppQuery web_app_query_id:string result:InputInlineQueryResult = SentWebAppMessage; + + //@description Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires @chat_id Identifier of the chat with the message @message_id Identifier of the message from which the query originated @payload Query payload getCallbackQueryAnswer chat_id:int53 message_id:int53 payload:CallbackQueryPayload = CallbackQueryAnswer; @@ -4954,8 +5082,8 @@ setChatTitle chat_id:int53 title:string = Ok; setChatPhoto chat_id:int53 photo:InputChatPhoto = Ok; //@description Changes the message TTL in a chat. Requires can_delete_messages administrator right in basic groups, supergroups and channels -//-Message TTL can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram) -//@chat_id Chat identifier @ttl New TTL value, in seconds; must be one of 0, 86400, 7 * 86400, or 31 * 86400 unless the chat is secret +//-Message TTL can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). +//@chat_id Chat identifier @ttl New TTL value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400 setChatMessageTtl chat_id:int53 ttl:int32 = Ok; //@description Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right @@ -5065,6 +5193,19 @@ getChatAdministrators chat_id:int53 = ChatAdministrators; clearAllDraftMessages exclude_secret_chats:Bool = Ok; +//@description Returns saved notification sound by its identifier. Returns a 404 error if there is no saved notification sound with the specified identifier @notification_sound_id Identifier of the notification sound +getSavedNotificationSound notification_sound_id:int64 = NotificationSounds; + +//@description Returns list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used +getSavedNotificationSounds = NotificationSounds; + +//@description Adds a new notification sound to the list of saved notification sounds. The new notification sound is added to the top of the list. If it is already in the list, its position isn't changed @sound Notification sound file to add +addSavedNotificationSound sound:InputFile = NotificationSound; + +//@description Removes a notification sound from the list of saved notification sounds @notification_sound_id Identifier of the notification sound +removeSavedNotificationSound notification_sound_id:int64 = Ok; + + //@description Returns list of chats with non-default notification settings //@scope If specified, only chats from the scope will be returned; pass null to return chats from all scopes //@compare_sound Pass true to include in the response chats with only non-default sound @@ -5076,7 +5217,7 @@ getScopeNotificationSettings scope:NotificationSettingsScope = ScopeNotification //@description Changes notification settings for chats of a given type @scope Types of chats for which to change the notification settings @notification_settings The new notification settings for the given scope setScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Ok; -//@description Resets all notification settings to their default values. By default, all chats are unmuted, the sound is set to "default" and message previews are shown +//@description Resets all notification settings to their default values. By default, all chats are unmuted and message previews are shown resetAllNotificationSettings = Ok; @@ -5088,6 +5229,13 @@ toggleChatIsPinned chat_list:ChatList chat_id:int53 is_pinned:Bool = Ok; setPinnedChats chat_list:ChatList chat_ids:vector = Ok; +//@description Returns information about a bot that can be added to attachment menu @bot_user_id Bot's user identifier +getAttachmentMenuBot bot_user_id:int53 = AttachmentMenuBot; + +//@description Adds or removes a bot to attachment menu. Bot can be added to attachment menu, only if userTypeBot.can_be_added_to_attachment_menu == true @bot_user_id Bot's user identifier @is_added Pass true to add the bot to attachment menu; pass false to remove the bot from attachment menu +toggleBotIsAddedToAttachmentMenu bot_user_id:int53 is_added:Bool = Ok; + + //@description Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates //@file_id Identifier of the file to download //@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile/addFileToDownloads was called will be downloaded first @@ -5291,7 +5439,7 @@ getVideoChatAvailableParticipants chat_id:int53 = MessageSenders; setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSender = Ok; //@description Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats rights -//@chat_id Chat identifier, in which the video chat will be created +//@chat_id Identifier of a chat in which the video chat will be created //@title Group call title; if empty, chat title will be used //@start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future //@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat; requires creator privileges @@ -5610,6 +5758,20 @@ deleteCommands scope:BotCommandScope language_code:string = Ok; //@language_code A two-letter ISO 639-1 language code or an empty string getCommands scope:BotCommandScope language_code:string = BotCommands; +//@description Sets menu button for the given user or for all users; for bots only +//@user_id Identifier of the user or 0 to set menu button for all users +//@menu_button New menu button +setMenuButton user_id:int53 menu_button:botMenuButton = Ok; + +//@description Returns menu button set by the bot for the given user; for bots only @user_id Identifier of the user or 0 to get the default menu button +getMenuButton user_id:int53 = BotMenuButton; + +//@description Sets default administrator rights for adding the bot to basic group and supergroup chats; for bots only @default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null +setDefaultGroupAdministratorRights default_group_administrator_rights:chatAdministratorRights = Ok; + +//@description Sets default administrator rights for adding the bot to channel chats; for bots only @default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null +setDefaultChannelAdministratorRights default_channel_administrator_rights:chatAdministratorRights = Ok; + //@description Returns all active sessions of the current user getActiveSessions = Sessions; @@ -5677,7 +5839,7 @@ getChatEventLog chat_id:int53 query:string from_event_id:int64 limit:int32 filte //@chat_id Chat identifier of the Invoice message //@message_id Message identifier //@theme Preferred payment form theme; pass null to use the default theme -getPaymentForm chat_id:int53 message_id:int53 theme:paymentFormTheme = PaymentForm; +getPaymentForm chat_id:int53 message_id:int53 theme:themeParameters = PaymentForm; //@description Validates the order information provided by a user and returns the available shipping options for a flexible invoice //@chat_id Chat identifier of the Invoice message @@ -5966,7 +6128,7 @@ setStickerPositionInSet sticker:InputFile position:int32 = Ok; removeStickerFromSet sticker:InputFile = Ok; -//@description Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded @location Location of the map center @zoom Map zoom level; 13-20 @width Map width in pixels before applying scale; 16-1024 @height Map height in pixels before applying scale; 16-1024 @scale Map scale; 1-3 @chat_id Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown +//@description Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded @location Location of the map center @zoom Map zoom level; 13-20 @width Map width in pixels before applying scale; 16-1024 @height Map height in pixels before applying scale; 16-1024 @scale Map scale; 1-3 @chat_id Identifier of a chat in which the thumbnail will be shown. Use 0 if unknown getMapThumbnailFile location:location zoom:int32 width:int32 height:int32 scale:int32 chat_id:int53 = File; @@ -6084,7 +6246,7 @@ testSquareInt x:int32 = TestInt; //@description Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization testNetwork = Ok; //@description Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization @server Proxy server IP address @port Proxy server port @type Proxy type -//@dc_id Identifier of a datacenter, with which to test connection @timeout The maximum overall timeout for the request +//@dc_id Identifier of a datacenter with which to test connection @timeout The maximum overall timeout for the request testProxy server:string port:int32 type:ProxyType dc_id:int32 timeout:double = Ok; //@description Forces an updates.getDifference call to the Telegram servers; for testing only testGetDifference = Ok;