From bb283b57fc5fac13f527c1b3da3e55b0a86e46f5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zelenin Date: Tue, 10 Sep 2019 15:36:54 +0300 Subject: [PATCH] update for TDLib v1.5.0 --- Makefile | 2 +- README.md | 61 +-- client/authorization.go | 36 +- client/client.go | 6 + client/function.go | 644 ++++++++++++++++------ client/tdlib.go | 26 - client/type.go | 1095 +++++++++++++++++++++++++++++++++---- client/unmarshaler.go | 440 ++++++++++++++- data/td_api.json | 1147 +++++++++++++++++++++++++++++++-------- data/td_api.tl | 423 +++++++++++---- 10 files changed, 3191 insertions(+), 689 deletions(-) diff --git a/Makefile b/Makefile index 4cfbd8b..411bf9a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -TAG := v1.4.0 +TAG := v1.5.0 schema-update: curl https://raw.githubusercontent.com/tdlib/td/${TAG}/td/generate/scheme/td_api.tl 2>/dev/null > ./data/td_api.tl diff --git a/README.md b/README.md index 74933f2..0c64de9 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,10 @@ # go-tdlib -Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) with full support of TDLib v1.4.0 +Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) with full support of TDLib v1.5.0 ## TDLib installation -### Ubuntu 18-19 / Debian 9 - -#### Manual compilation - -```bash -apt-get update -y -apt-get install -y \ - build-essential \ - ca-certificates \ - ccache \ - cmake \ - git \ - gperf \ - libssl-dev \ - libreadline-dev \ - zlib1g-dev -git clone --depth 1 -b "v1.4.0" "https://github.com/tdlib/td.git" ./tdlib-src -mkdir ./tdlib-src/build -cd ./tdlib-src/build -cmake -DCMAKE_BUILD_TYPE=Release .. -cmake --build . -make install -rm -rf ./../../tdlib-src -``` +Use [TDLib build instructions](https://tdlib.github.io/td/build.html) ## Usage @@ -44,23 +21,16 @@ import ( "github.com/zelenin/go-tdlib/client" ) -func WithLogs() client.Option { - return func(tdlibClient *client.Client) { - tdlibClient.SetLogVerbosityLevel(&client.SetLogVerbosityLevelRequest{ - NewVerbosityLevel: 1, - }) - } -} func main() { // client authorizer authorizer := client.ClientAuthorizer() go client.CliInteractor(authorizer) - + // or bot authorizer - botToken := "000000000:gsVCGG5YbikxYHC7bP5vRvmBqJ7Xz6vG6td" - authorizer := client.BotAuthorizer(botToken) - + // botToken := "000000000:gsVCGG5YbikxYHC7bP5vRvmBqJ7Xz6vG6td" + // authorizer := client.BotAuthorizer(botToken) + const ( apiId = 00000 apiHash = "8pu9yg32qkuukj83ozaqo5zzjwhkxhnk" @@ -84,11 +54,24 @@ func main() { IgnoreFileNames: false, } - tdlibClient, err := client.NewClient(authorizer, WithLogs()) + logVerbosity := client.WithLogVerbosity(&client.SetLogVerbosityLevelRequest{ + NewVerbosityLevel: 0, + }) + + tdlibClient, err := client.NewClient(authorizer, logVerbosity) if err != nil { log.Fatalf("NewClient error: %s", err) } + optionValue, err := tdlibClient.GetOption(&client.GetOptionRequest{ + Name: "version", + }) + if err != nil { + log.Fatalf("GetOption error: %s", err) + } + + log.Printf("TDLib version: %s", optionValue.(*client.OptionValueString).Value) + me, err := tdlibClient.GetMe() if err != nil { log.Fatalf("GetMe error: %s", err) @@ -120,7 +103,7 @@ for update := range listener.Updates { ### Proxy support ```go -proxyOption := client.WithProxy(&client.AddProxyRequest{ +proxy := client.WithProxy(&client.AddProxyRequest{ Server: "1.1.1.1", Port: 1080, Enable: true, @@ -130,7 +113,7 @@ proxyOption := client.WithProxy(&client.AddProxyRequest{ }, }) -tdlibClient, err := client.NewClient(authorizer, proxyOption) +tdlibClient, err := client.NewClient(authorizer, proxy) ``` diff --git a/client/authorization.go b/client/authorization.go index 4652614..85535f0 100644 --- a/client/authorization.go +++ b/client/authorization.go @@ -40,8 +40,6 @@ type clientAuthorizer struct { PhoneNumber chan string Code chan string State chan AuthorizationState - FirstName chan string - LastName chan string Password chan string } @@ -51,8 +49,6 @@ func ClientAuthorizer() *clientAuthorizer { PhoneNumber: make(chan string, 1), Code: make(chan string, 1), State: make(chan AuthorizationState, 10), - FirstName: make(chan string, 1), - LastName: make(chan string, 1), Password: make(chan string, 1), } } @@ -73,20 +69,24 @@ func (stateHandler *clientAuthorizer) Handle(client *Client, state Authorization case TypeAuthorizationStateWaitPhoneNumber: _, err := client.SetAuthenticationPhoneNumber(&SetAuthenticationPhoneNumberRequest{ - PhoneNumber: <-stateHandler.PhoneNumber, - AllowFlashCall: false, - IsCurrentPhoneNumber: false, + PhoneNumber: <-stateHandler.PhoneNumber, + Settings: &PhoneNumberAuthenticationSettings{ + AllowFlashCall: false, + IsCurrentPhoneNumber: false, + AllowSmsRetrieverApi: false, + }, }) return err case TypeAuthorizationStateWaitCode: _, err := client.CheckAuthenticationCode(&CheckAuthenticationCodeRequest{ - Code: <-stateHandler.Code, - FirstName: <-stateHandler.FirstName, - LastName: <-stateHandler.LastName, + Code: <-stateHandler.Code, }) return err + case TypeAuthorizationStateWaitRegistration: + return ErrNotSupportedAuthorizationState + case TypeAuthorizationStateWaitPassword: _, err := client.CheckAuthenticationPassword(&CheckAuthenticationPasswordRequest{ Password: <-stateHandler.Password, @@ -114,8 +114,6 @@ func (stateHandler *clientAuthorizer) Close() { close(stateHandler.PhoneNumber) close(stateHandler.Code) close(stateHandler.State) - close(stateHandler.FirstName) - close(stateHandler.LastName) close(stateHandler.Password) } @@ -137,25 +135,11 @@ func CliInteractor(clientAuthorizer *clientAuthorizer) { case TypeAuthorizationStateWaitCode: var code string - var firstName string - var lastName string fmt.Println("Enter code: ") fmt.Scanln(&code) - if !state.(*AuthorizationStateWaitCode).IsRegistered { - fmt.Println("Phone number is not registered.") - - fmt.Println("Enter first name: ") - fmt.Scanln(&firstName) - - fmt.Println("Enter last name: ") - fmt.Scanln(&lastName) - } - clientAuthorizer.Code <- code - clientAuthorizer.FirstName <- firstName - clientAuthorizer.LastName <- lastName case TypeAuthorizationStateWaitPassword: fmt.Println("Enter password: ") diff --git a/client/client.go b/client/client.go index de8d0b0..9af7a50 100644 --- a/client/client.go +++ b/client/client.go @@ -42,6 +42,12 @@ func WithProxy(req *AddProxyRequest) Option { } } +func WithLogVerbosity(req *SetLogVerbosityLevelRequest) Option { + return func(client *Client) { + client.SetLogVerbosityLevel(req) + } +} + func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...Option) (*Client, error) { catchersListener := make(chan *Response, 1000) diff --git a/client/function.go b/client/function.go index ed48a4e..45cb8e8 100755 --- a/client/function.go +++ b/client/function.go @@ -35,6 +35,9 @@ func (client *Client) GetAuthorizationState() (AuthorizationState, error) { case TypeAuthorizationStateWaitCode: return UnmarshalAuthorizationStateWaitCode(result.Data) + case TypeAuthorizationStateWaitRegistration: + return UnmarshalAuthorizationStateWaitRegistration(result.Data) + case TypeAuthorizationStateWaitPassword: return UnmarshalAuthorizationStateWaitPassword(result.Data) @@ -110,22 +113,19 @@ func (client *Client) CheckDatabaseEncryptionKey(req *CheckDatabaseEncryptionKey type SetAuthenticationPhoneNumberRequest struct { // The phone number of the user, in international format PhoneNumber string `json:"phone_number"` - // Pass true if the authentication code may be sent via flash call to the specified phone number - AllowFlashCall bool `json:"allow_flash_call"` - // Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false - IsCurrentPhoneNumber bool `json:"is_current_phone_number"` + // Settings for the authentication of the user's phone number + Settings *PhoneNumberAuthenticationSettings `json:"settings"` } -// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber +// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode or authorizationStateWaitPassword func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNumberRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "setAuthenticationPhoneNumber", }, Data: map[string]interface{}{ - "phone_number": req.PhoneNumber, - "allow_flash_call": req.AllowFlashCall, - "is_current_phone_number": req.IsCurrentPhoneNumber, + "phone_number": req.PhoneNumber, + "settings": req.Settings, }, }) if err != nil { @@ -161,10 +161,6 @@ func (client *Client) ResendAuthenticationCode() (*Ok, error) { type CheckAuthenticationCodeRequest struct { // The verification code received via SMS, Telegram message, phone call, or flash call Code string `json:"code"` - // If the user is not yet registered, the first name of the user; 1-64 characters. You can also pass an empty string for unregistered user there to check verification code validness. In the latter case PHONE_NUMBER_UNOCCUPIED error will be returned for a valid code - FirstName string `json:"first_name"` - // If the user is not yet registered; the last name of the user; optional; 0-64 characters - LastName string `json:"last_name"` } // Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode @@ -174,7 +170,34 @@ func (client *Client) CheckAuthenticationCode(req *CheckAuthenticationCodeReques Type: "checkAuthenticationCode", }, Data: map[string]interface{}{ - "code": req.Code, + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RegisterUserRequest struct { + // The first name of the user; 1-64 characters + FirstName string `json:"first_name"` + // The last name of the user; 0-64 characters + LastName string `json:"last_name"` +} + +// Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration +func (client *Client) RegisterUser(req *RegisterUserRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "registerUser", + }, + Data: map[string]interface{}{ "first_name": req.FirstName, "last_name": req.LastName, }, @@ -479,7 +502,7 @@ type SetRecoveryEmailAddressRequest struct { NewRecoveryEmailAddress string `json:"new_recovery_email_address"` } -// Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation +// Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed. If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation func (client *Client) SetRecoveryEmailAddress(req *SetRecoveryEmailAddressRequest) (*PasswordState, error) { result, err := client.Send(Request{ meta: meta{ @@ -1072,7 +1095,7 @@ type GetChatsRequest struct { Limit int32 `json:"limit"` } -// Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). For optimal performance the number of returned chats is chosen by the library. +// Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). For optimal performance the number of returned chats is chosen by the library func (client *Client) GetChats(req *GetChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -1381,7 +1404,7 @@ func (client *Client) CheckChatUsername(req *CheckChatUsernameRequest) (CheckCha } } -// Returns a list of public chats created by the user +// Returns a list of public chats with username created by the user func (client *Client) GetCreatedPublicChats() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -1830,7 +1853,7 @@ type GetPublicMessageLinkRequest struct { ForAlbum bool `json:"for_album"` } -// Returns a public HTTPS link to a message. Available only for messages in public supergroups and channels +// Returns a public HTTPS link to a message. Available only for messages in supergroups and channels with username func (client *Client) GetPublicMessageLink(req *GetPublicMessageLinkRequest) (*PublicMessageLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -1882,6 +1905,32 @@ func (client *Client) GetMessageLink(req *GetMessageLinkRequest) (*HttpUrl, erro return UnmarshalHttpUrl(result.Data) } +type GetMessageLinkInfoRequest struct { + // The message link in the format "https://t.me/c/...", or "tg://privatepost?...", or "https://t.me/username/...", or "tg://resolve?..." + Url string `json:"url"` +} + +// Returns information about a public or private message link +func (client *Client) GetMessageLinkInfo(req *GetMessageLinkInfoRequest) (*MessageLinkInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageLinkInfo", + }, + Data: map[string]interface{}{ + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageLinkInfo(result.Data) +} + type SendMessageRequest struct { // Target chat ChatId int64 `json:"chat_id"` @@ -1966,7 +2015,7 @@ type SendBotStartMessageRequest struct { BotUserId int32 `json:"bot_user_id"` // Identifier of the target chat ChatId int64 `json:"chat_id"` - // A hidden parameter sent to the bot for deep linking purposes (https://api.telegram.org/bots#deep-linking) + // A hidden parameter sent to the bot for deep linking purposes (https://core.telegram.org/bots#deep-linking) Parameter string `json:"parameter"` } @@ -2046,10 +2095,14 @@ type ForwardMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // Pass true to disable notification for the message, doesn't work if messages are forwarded to a secret chat DisableNotification bool `json:"disable_notification"` - // Pass true if the message is sent from the background + // Pass true if the messages are sent from the background FromBackground bool `json:"from_background"` // True, if the messages should be grouped into an album after forwarding. For this to work, no more than 10 messages may be forwarded, and all of them must be photo or video messages AsAlbum bool `json:"as_album"` + // True, if content of the messages needs to be copied without links to the original messages. Always true if the messages are forwarded to a secret chat + SendCopy bool `json:"send_copy"` + // True, if media captions of message copies needs to be removed. Ignored if send_copy is false + RemoveCaption bool `json:"remove_caption"` } // Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message @@ -2065,6 +2118,37 @@ func (client *Client) ForwardMessages(req *ForwardMessagesRequest) (*Messages, e "disable_notification": req.DisableNotification, "from_background": req.FromBackground, "as_album": req.AsAlbum, + "send_copy": req.SendCopy, + "remove_caption": req.RemoveCaption, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type ResendMessagesRequest struct { + // Identifier of the chat to send messages + ChatId int64 `json:"chat_id"` + // Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order + MessageIds []int64 `json:"message_ids"` +} + +// Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message +func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_ids": req.MessageIds, }, }) if err != nil { @@ -3633,7 +3717,7 @@ type UpgradeBasicGroupChatToSupergroupChatRequest struct { ChatId int64 `json:"chat_id"` } -// Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom. Deactivates the original basic group +// Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group func (client *Client) UpgradeBasicGroupChatToSupergroupChat(req *UpgradeBasicGroupChatToSupergroupChatRequest) (*Chat, error) { result, err := client.Send(Request{ meta: meta{ @@ -3661,7 +3745,7 @@ type SetChatTitleRequest struct { Title string `json:"title"` } -// Changes the chat title. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The title will not be changed until the request to the server has been completed +// Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info rights. The title will not be changed until the request to the server has been completed func (client *Client) SetChatTitle(req *SetChatTitleRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3690,7 +3774,7 @@ type SetChatPhotoRequest struct { Photo InputFile `json:"photo"` } -// Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The photo will not be changed before request to the server has been completed +// Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info rights. The photo will not be changed before request to the server has been completed func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3712,6 +3796,35 @@ func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SetChatPermissionsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New non-administrator members permissions in the chat + Permissions *ChatPermissions `json:"permissions"` +} + +// Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right +func (client *Client) SetChatPermissions(req *SetChatPermissionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatPermissions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "permissions": req.Permissions, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetChatDraftMessageRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -3886,6 +3999,35 @@ func (client *Client) SetChatClientData(req *SetChatClientDataRequest) (*Ok, err return UnmarshalOk(result.Data) } +type SetChatDescriptionRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // New chat description; 0-255 characters + Description string `json:"description"` +} + +// Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info rights +func (client *Client) SetChatDescription(req *SetChatDescriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatDescription", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "description": req.Description, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type PinChatMessageRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` @@ -3895,7 +4037,7 @@ type PinChatMessageRequest struct { DisableNotification bool `json:"disable_notification"` } -// Pins a message in a chat; requires appropriate administrator rights in the group or channel +// Pins a message in a chat; requires can_pin_messages rights func (client *Client) PinChatMessage(req *PinChatMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3923,7 +4065,7 @@ type UnpinChatMessageRequest struct { ChatId int64 `json:"chat_id"` } -// Removes the pinned message from a chat; requires appropriate administrator rights in the group or channel +// Removes the pinned message from a chat; requires can_pin_messages rights in the group or channel func (client *Client) UnpinChatMessage(req *UnpinChatMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4644,7 +4786,7 @@ type GenerateChatInviteLinkRequest struct { ChatId int64 `json:"chat_id"` } -// Generates a new invite link for a chat; the previously generated link is revoked. Available for basic groups, supergroups, and channels. In basic groups this can be called only by the group's creator; in supergroups and channels this requires appropriate administrator rights +// Generates a new invite link for a chat; the previously generated link is revoked. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right func (client *Client) GenerateChatInviteLink(req *GenerateChatInviteLinkRequest) (*ChatInviteLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -4817,6 +4959,8 @@ type SendCallRatingRequest struct { Rating int32 `json:"rating"` // An optional user comment if the rating is less than 5 Comment string `json:"comment"` + // List of the exact types of problems with the call, specified by the user + Problems []CallProblem `json:"problems"` } // Sends a call rating @@ -4826,9 +4970,10 @@ func (client *Client) SendCallRating(req *SendCallRatingRequest) (*Ok, error) { Type: "sendCallRating", }, Data: map[string]interface{}{ - "call_id": req.CallId, - "rating": req.Rating, - "comment": req.Comment, + "call_id": req.CallId, + "rating": req.Rating, + "comment": req.Comment, + "problems": req.Problems, }, }) if err != nil { @@ -5692,8 +5837,8 @@ type GetStickerEmojisRequest struct { Sticker InputFile `json:"sticker"` } -// Returns emoji corresponding to a sticker -func (client *Client) GetStickerEmojis(req *GetStickerEmojisRequest) (*StickerEmojis, error) { +// Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object +func (client *Client) GetStickerEmojis(req *GetStickerEmojisRequest) (*Emojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getStickerEmojis", @@ -5710,7 +5855,62 @@ func (client *Client) GetStickerEmojis(req *GetStickerEmojisRequest) (*StickerEm return nil, buildResponseError(result.Data) } - return UnmarshalStickerEmojis(result.Data) + return UnmarshalEmojis(result.Data) +} + +type SearchEmojisRequest struct { + // Text to search for + Text string `json:"text"` + // True, if only emojis, which exactly match text needs to be returned + ExactMatch bool `json:"exact_match"` +} + +// Searches for emojis by keywords. Supported only if the file database is enabled +func (client *Client) SearchEmojis(req *SearchEmojisRequest) (*Emojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchEmojis", + }, + Data: map[string]interface{}{ + "text": req.Text, + "exact_match": req.ExactMatch, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojis(result.Data) +} + +type GetEmojiSuggestionsUrlRequest struct { + // Language code for which the emoji replacements will be suggested + LanguageCode string `json:"language_code"` +} + +// Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation +func (client *Client) GetEmojiSuggestionsUrl(req *GetEmojiSuggestionsUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getEmojiSuggestionsUrl", + }, + Data: map[string]interface{}{ + "language_code": req.LanguageCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) } // Returns saved animations @@ -6049,10 +6249,8 @@ func (client *Client) SetUsername(req *SetUsernameRequest) (*Ok, error) { type ChangePhoneNumberRequest struct { // The new phone number of the user in international format PhoneNumber string `json:"phone_number"` - // Pass true if the code can be sent via flash call to the specified phone number - AllowFlashCall bool `json:"allow_flash_call"` - // Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false - IsCurrentPhoneNumber bool `json:"is_current_phone_number"` + // Settings for the authentication of the user's phone number + Settings *PhoneNumberAuthenticationSettings `json:"settings"` } // Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code @@ -6062,9 +6260,8 @@ func (client *Client) ChangePhoneNumber(req *ChangePhoneNumberRequest) (*Authent Type: "changePhoneNumber", }, Data: map[string]interface{}{ - "phone_number": req.PhoneNumber, - "allow_flash_call": req.AllowFlashCall, - "is_current_phone_number": req.IsCurrentPhoneNumber, + "phone_number": req.PhoneNumber, + "settings": req.Settings, }, }) if err != nil { @@ -6251,35 +6448,6 @@ func (client *Client) DisconnectAllWebsites() (*Ok, error) { return UnmarshalOk(result.Data) } -type ToggleBasicGroupAdministratorsRequest struct { - // Identifier of the basic group - BasicGroupId int32 `json:"basic_group_id"` - // New value of everyone_is_administrator - EveryoneIsAdministrator bool `json:"everyone_is_administrator"` -} - -// Toggles the "All members are admins" setting in basic groups; requires creator privileges in the group -func (client *Client) ToggleBasicGroupAdministrators(req *ToggleBasicGroupAdministratorsRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "toggleBasicGroupAdministrators", - }, - Data: map[string]interface{}{ - "basic_group_id": req.BasicGroupId, - "everyone_is_administrator": req.EveryoneIsAdministrator, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type SetSupergroupUsernameRequest struct { // Identifier of the supergroup or channel SupergroupId int32 `json:"supergroup_id"` @@ -6316,7 +6484,7 @@ type SetSupergroupStickerSetRequest struct { StickerSetId JsonInt64 `json:"sticker_set_id"` } -// Changes the sticker set of a supergroup; requires appropriate rights in the supergroup +// Changes the sticker set of a supergroup; requires can_change_info rights func (client *Client) SetSupergroupStickerSet(req *SetSupergroupStickerSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6338,35 +6506,6 @@ func (client *Client) SetSupergroupStickerSet(req *SetSupergroupStickerSetReques return UnmarshalOk(result.Data) } -type ToggleSupergroupInvitesRequest struct { - // Identifier of the supergroup - SupergroupId int32 `json:"supergroup_id"` - // New value of anyone_can_invite - AnyoneCanInvite bool `json:"anyone_can_invite"` -} - -// Toggles whether all members of a supergroup can add new members; requires appropriate administrator rights in the supergroup. -func (client *Client) ToggleSupergroupInvites(req *ToggleSupergroupInvitesRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "toggleSupergroupInvites", - }, - Data: map[string]interface{}{ - "supergroup_id": req.SupergroupId, - "anyone_can_invite": req.AnyoneCanInvite, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type ToggleSupergroupSignMessagesRequest struct { // Identifier of the channel SupergroupId int32 `json:"supergroup_id"` @@ -6374,7 +6513,7 @@ type ToggleSupergroupSignMessagesRequest struct { SignMessages bool `json:"sign_messages"` } -// Toggles sender signatures messages sent in a channel; requires appropriate administrator rights in the channel. +// Toggles sender signatures messages sent in a channel; requires can_change_info rights func (client *Client) ToggleSupergroupSignMessages(req *ToggleSupergroupSignMessagesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6403,7 +6542,7 @@ type ToggleSupergroupIsAllHistoryAvailableRequest struct { IsAllHistoryAvailable bool `json:"is_all_history_available"` } -// Toggles whether the message history of a supergroup is available to new members; requires appropriate administrator rights in the supergroup. +// Toggles whether the message history of a supergroup is available to new members; requires can_change_info rights func (client *Client) ToggleSupergroupIsAllHistoryAvailable(req *ToggleSupergroupIsAllHistoryAvailableRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6425,35 +6564,6 @@ func (client *Client) ToggleSupergroupIsAllHistoryAvailable(req *ToggleSupergrou return UnmarshalOk(result.Data) } -type SetSupergroupDescriptionRequest struct { - // Identifier of the supergroup or channel - SupergroupId int32 `json:"supergroup_id"` - // New supergroup or channel description; 0-255 characters - Description string `json:"description"` -} - -// Changes information about a supergroup or channel; requires appropriate administrator rights -func (client *Client) SetSupergroupDescription(req *SetSupergroupDescriptionRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "setSupergroupDescription", - }, - Data: map[string]interface{}{ - "supergroup_id": req.SupergroupId, - "description": req.Description, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type ReportSupergroupSpamRequest struct { // Supergroup identifier SupergroupId int32 `json:"supergroup_id"` @@ -6821,11 +6931,150 @@ func (client *Client) GetSupportUser() (*User, error) { return UnmarshalUser(result.Data) } -// Returns background wallpapers -func (client *Client) GetWallpapers() (*Wallpapers, error) { +type GetBackgroundsRequest struct { + // True, if the backgrounds needs to be ordered for dark theme + ForDarkTheme bool `json:"for_dark_theme"` +} + +// Returns backgrounds installed by the user +func (client *Client) GetBackgrounds(req *GetBackgroundsRequest) (*Backgrounds, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getWallpapers", + Type: "getBackgrounds", + }, + Data: map[string]interface{}{ + "for_dark_theme": req.ForDarkTheme, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBackgrounds(result.Data) +} + +type GetBackgroundUrlRequest struct { + // Background name + Name string `json:"name"` + // Background type + Type BackgroundType `json:"type"` +} + +// Constructs a persistent HTTP URL for a background +func (client *Client) GetBackgroundUrl(req *GetBackgroundUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBackgroundUrl", + }, + Data: map[string]interface{}{ + "name": req.Name, + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +type SearchBackgroundRequest struct { + // The name of the background + Name string `json:"name"` +} + +// Searches for a background by its name +func (client *Client) SearchBackground(req *SearchBackgroundRequest) (*Background, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchBackground", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBackground(result.Data) +} + +type SetBackgroundRequest struct { + // The input background to use, null for solid backgrounds + Background InputBackground `json:"background"` + // Background type; null for default background. The method will return error 404 if type is null + Type BackgroundType `json:"type"` + // True, if the background is chosen for dark theme + ForDarkTheme bool `json:"for_dark_theme"` +} + +// Changes the background selected by the user; adds background to the list of installed backgrounds +func (client *Client) SetBackground(req *SetBackgroundRequest) (*Background, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBackground", + }, + Data: map[string]interface{}{ + "background": req.Background, + "type": req.Type, + "for_dark_theme": req.ForDarkTheme, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBackground(result.Data) +} + +type RemoveBackgroundRequest struct { + // The background indentifier + BackgroundId JsonInt64 `json:"background_id"` +} + +// Removes background from the list of installed backgrounds +func (client *Client) RemoveBackground(req *RemoveBackgroundRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeBackground", + }, + Data: map[string]interface{}{ + "background_id": req.BackgroundId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Resets list of installed backgrounds to its default value +func (client *Client) ResetBackgrounds() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resetBackgrounds", }, Data: map[string]interface{}{}, }) @@ -6837,7 +7086,7 @@ func (client *Client) GetWallpapers() (*Wallpapers, error) { return nil, buildResponseError(result.Data) } - return UnmarshalWallpapers(result.Data) + return UnmarshalOk(result.Data) } type GetLocalizationTargetInfoRequest struct { @@ -7482,7 +7731,7 @@ type GetChatStatisticsUrlRequest struct { IsDark bool `json:"is_dark"` } -// Returns URL with the chat statistics. Currently this method can be used only for channels +// Returns an HTTP URL with the chat statistics. Currently this method can be used only for channels func (client *Client) GetChatStatisticsUrl(req *GetChatStatisticsUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -7713,6 +7962,54 @@ func (client *Client) ResetNetworkStatistics() (*Ok, error) { return UnmarshalOk(result.Data) } +// Returns auto-download settings presets for the currently logged in user +func (client *Client) GetAutoDownloadSettingsPresets() (*AutoDownloadSettingsPresets, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAutoDownloadSettingsPresets", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAutoDownloadSettingsPresets(result.Data) +} + +type SetAutoDownloadSettingsRequest struct { + // New user auto-download settings + Settings *AutoDownloadSettings `json:"settings"` + // Type of the network for which the new settings are applied + Type NetworkType `json:"type"` +} + +// Sets auto-download settings +func (client *Client) SetAutoDownloadSettings(req *SetAutoDownloadSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAutoDownloadSettings", + }, + Data: map[string]interface{}{ + "settings": req.Settings, + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetPassportElementRequest struct { // Telegram Passport element type Type PassportElementType `json:"type"` @@ -7965,10 +8262,8 @@ func (client *Client) GetPreferredCountryLanguage(req *GetPreferredCountryLangua type SendPhoneNumberVerificationCodeRequest struct { // The phone number of the user, in international format PhoneNumber string `json:"phone_number"` - // Pass true if the authentication code may be sent via flash call to the specified phone number - AllowFlashCall bool `json:"allow_flash_call"` - // Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false - IsCurrentPhoneNumber bool `json:"is_current_phone_number"` + // Settings for the authentication of the user's phone number + Settings *PhoneNumberAuthenticationSettings `json:"settings"` } // Sends a code to verify a phone number to be added to a user's Telegram Passport @@ -7978,9 +8273,8 @@ func (client *Client) SendPhoneNumberVerificationCode(req *SendPhoneNumberVerifi Type: "sendPhoneNumberVerificationCode", }, Data: map[string]interface{}{ - "phone_number": req.PhoneNumber, - "allow_flash_call": req.AllowFlashCall, - "is_current_phone_number": req.IsCurrentPhoneNumber, + "phone_number": req.PhoneNumber, + "settings": req.Settings, }, }) if err != nil { @@ -8208,10 +8502,8 @@ type SendPhoneNumberConfirmationCodeRequest struct { Hash string `json:"hash"` // Value of the "phone" parameter from the link PhoneNumber string `json:"phone_number"` - // Pass true if the authentication code may be sent via flash call to the specified phone number - AllowFlashCall bool `json:"allow_flash_call"` - // Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false - IsCurrentPhoneNumber bool `json:"is_current_phone_number"` + // Settings for the authentication of the user's phone number + Settings *PhoneNumberAuthenticationSettings `json:"settings"` } // Sends phone number confirmation code. Should be called when user presses "https://t.me/confirmphone?phone=*******&hash=**********" or "tg://confirmphone?phone=*******&hash=**********" link @@ -8221,10 +8513,9 @@ func (client *Client) SendPhoneNumberConfirmationCode(req *SendPhoneNumberConfir Type: "sendPhoneNumberConfirmationCode", }, Data: map[string]interface{}{ - "hash": req.Hash, - "phone_number": req.PhoneNumber, - "allow_flash_call": req.AllowFlashCall, - "is_current_phone_number": req.IsCurrentPhoneNumber, + "hash": req.Hash, + "phone_number": req.PhoneNumber, + "settings": req.Settings, }, }) if err != nil { @@ -8617,7 +8908,7 @@ func (client *Client) SetAlarm(req *SetAlarmRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -// Uses current user IP to found his country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization +// Uses current user IP to found their country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization func (client *Client) GetCountryCode() (*Text, error) { result, err := client.Send(Request{ meta: meta{ @@ -9393,6 +9684,38 @@ func (client *Client) TestNetwork() (*Ok, error) { return UnmarshalOk(result.Data) } +type TestProxyRequest struct { + // Proxy server IP address + Server string `json:"server"` + // Proxy server port + Port int32 `json:"port"` + // Proxy type + Type ProxyType `json:"type"` +} + +// Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization +func (client *Client) TestProxy(req *TestProxyRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testProxy", + }, + Data: map[string]interface{}{ + "server": req.Server, + "port": req.Port, + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Forces an updates.getDifference call to the Telegram servers; for testing only func (client *Client) TestGetDifference() (*Ok, error) { result, err := client.Send(Request{ @@ -9468,6 +9791,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(result.Data) + case TypeUpdateChatPermissions: + return UnmarshalUpdateChatPermissions(result.Data) + case TypeUpdateChatLastMessage: return UnmarshalUpdateChatLastMessage(result.Data) @@ -9597,6 +9923,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedAnimations: return UnmarshalUpdateSavedAnimations(result.Data) + case TypeUpdateSelectedBackground: + return UnmarshalUpdateSelectedBackground(result.Data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(result.Data) @@ -9638,13 +9967,20 @@ func (client *Client) TestUseUpdate() (Update, error) { } } -// Does nothing and ensures that the Error object is used; for testing only. This is an offline method. Can be called before authorization -func (client *Client) TestUseError() (*Error, error) { - result, err := client.Send(Request{ +type TestReturnErrorRequest struct { + // The error to be returned + Error *Error `json:"error"` +} + +// Returns the specified error and ensures that the Error object is used; for testing only. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) TestReturnError(req *TestReturnErrorRequest) (*Error, error) { + result, err := client.jsonClient.Execute(Request{ meta: meta{ - Type: "testUseError", + Type: "testReturnError", + }, + Data: map[string]interface{}{ + "error": req.Error, }, - Data: map[string]interface{}{}, }) if err != nil { return nil, err diff --git a/client/tdlib.go b/client/tdlib.go index 9cc8e28..fe27fb9 100644 --- a/client/tdlib.go +++ b/client/tdlib.go @@ -3,7 +3,6 @@ package client /* #include #include -#include */ import "C" @@ -94,31 +93,6 @@ func (jsonClient *JsonClient) Destroy() { C.td_json_client_destroy(jsonClient.jsonClient) } -// Sets the path to the file where the internal TDLib log will be written. -// By default TDLib writes logs to stderr or an OS specific log. -// Use this method to write the log to a file instead. -// Deprecated -func SetLogFilePath(filePath string) { - query := C.CString(filePath) - defer C.free(unsafe.Pointer(query)) - - C.td_set_log_file_path(query) -} - -// Sets maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated. -// Unused if log is not written to a file. Defaults to 10 MB. -// Deprecated -func SetLogMaxFileSize(maxFileSize int64) { - C.td_set_log_max_file_size(C.longlong(maxFileSize)) -} - -// Sets the verbosity level of the internal logging of TDLib. -// By default the TDLib uses a log verbosity level of 5 -// Deprecated -func SetLogVerbosityLevel(newVerbosityLevel int) { - C.td_set_log_verbosity_level(C.int(newVerbosityLevel)) -} - type meta struct { Type string `json:"@type"` Extra string `json:"@extra"` diff --git a/client/type.go b/client/type.go index cdbd110..f27775d 100755 --- a/client/type.go +++ b/client/type.go @@ -42,12 +42,15 @@ const ( ClassUserStatus = "UserStatus" ClassCallDiscardReason = "CallDiscardReason" ClassCallState = "CallState" + ClassCallProblem = "CallProblem" ClassInputInlineQueryResult = "InputInlineQueryResult" ClassInlineQueryResult = "InlineQueryResult" ClassCallbackQueryPayload = "CallbackQueryPayload" ClassChatEventAction = "ChatEventAction" ClassLanguagePackStringValue = "LanguagePackStringValue" ClassDeviceToken = "DeviceToken" + ClassBackgroundType = "BackgroundType" + ClassInputBackground = "InputBackground" ClassCheckChatUsernameResult = "CheckChatUsernameResult" ClassPushMessageContent = "PushMessageContent" ClassNotificationType = "NotificationType" @@ -83,6 +86,7 @@ const ( ClassRemoteFile = "RemoteFile" ClassFile = "File" ClassPhotoSize = "PhotoSize" + ClassMinithumbnail = "Minithumbnail" ClassMaskPosition = "MaskPosition" ClassPollOption = "PollOption" ClassAnimation = "Animation" @@ -107,6 +111,7 @@ const ( ClassUserProfilePhoto = "UserProfilePhoto" ClassUserProfilePhotos = "UserProfilePhotos" ClassUsers = "Users" + ClassChatPermissions = "ChatPermissions" ClassChatMember = "ChatMember" ClassChatMembers = "ChatMembers" ClassBasicGroup = "BasicGroup" @@ -162,7 +167,7 @@ const ( ClassInputPassportElementError = "InputPassportElementError" ClassInputThumbnail = "InputThumbnail" ClassStickers = "Stickers" - ClassStickerEmojis = "StickerEmojis" + ClassEmojis = "Emojis" ClassStickerSet = "StickerSet" ClassStickerSetInfo = "StickerSetInfo" ClassStickerSets = "StickerSets" @@ -170,6 +175,7 @@ const ( ClassCallConnection = "CallConnection" ClassCallId = "CallId" ClassCall = "Call" + ClassPhoneNumberAuthenticationSettings = "PhoneNumberAuthenticationSettings" ClassAnimations = "Animations" ClassImportedContacts = "ImportedContacts" ClassHttpUrl = "HttpUrl" @@ -186,8 +192,8 @@ const ( ClassLanguagePackInfo = "LanguagePackInfo" ClassLocalizationTargetInfo = "LocalizationTargetInfo" ClassPushReceiverId = "PushReceiverId" - ClassWallpaper = "Wallpaper" - ClassWallpapers = "Wallpapers" + ClassBackground = "Background" + ClassBackgrounds = "Backgrounds" ClassHashtags = "Hashtags" ClassNotification = "Notification" ClassNotificationGroup = "NotificationGroup" @@ -200,6 +206,7 @@ const ( ClassConnectedWebsites = "ConnectedWebsites" ClassChatReportSpamState = "ChatReportSpamState" ClassPublicMessageLink = "PublicMessageLink" + ClassMessageLinkInfo = "MessageLinkInfo" ClassFilePart = "FilePart" ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" ClassStorageStatisticsByChat = "StorageStatisticsByChat" @@ -207,6 +214,8 @@ const ( ClassStorageStatisticsFast = "StorageStatisticsFast" ClassDatabaseStatistics = "DatabaseStatistics" ClassNetworkStatistics = "NetworkStatistics" + ClassAutoDownloadSettings = "AutoDownloadSettings" + ClassAutoDownloadSettingsPresets = "AutoDownloadSettingsPresets" ClassTMeUrl = "TMeUrl" ClassTMeUrls = "TMeUrls" ClassCount = "Count" @@ -246,6 +255,7 @@ const ( TypeAuthorizationStateWaitEncryptionKey = "authorizationStateWaitEncryptionKey" TypeAuthorizationStateWaitPhoneNumber = "authorizationStateWaitPhoneNumber" TypeAuthorizationStateWaitCode = "authorizationStateWaitCode" + TypeAuthorizationStateWaitRegistration = "authorizationStateWaitRegistration" TypeAuthorizationStateWaitPassword = "authorizationStateWaitPassword" TypeAuthorizationStateReady = "authorizationStateReady" TypeAuthorizationStateLoggingOut = "authorizationStateLoggingOut" @@ -262,6 +272,7 @@ const ( TypeInputFileLocal = "inputFileLocal" TypeInputFileGenerated = "inputFileGenerated" TypePhotoSize = "photoSize" + TypeMinithumbnail = "minithumbnail" TypeMaskPointForehead = "maskPointForehead" TypeMaskPointEyes = "maskPointEyes" TypeMaskPointMouth = "maskPointMouth" @@ -297,6 +308,7 @@ const ( TypeUserProfilePhoto = "userProfilePhoto" TypeUserProfilePhotos = "userProfilePhotos" TypeUsers = "users" + TypeChatPermissions = "chatPermissions" TypeChatMemberStatusCreator = "chatMemberStatusCreator" TypeChatMemberStatusAdministrator = "chatMemberStatusAdministrator" TypeChatMemberStatusMember = "chatMemberStatusMember" @@ -305,12 +317,14 @@ const ( TypeChatMemberStatusBanned = "chatMemberStatusBanned" TypeChatMember = "chatMember" TypeChatMembers = "chatMembers" + TypeChatMembersFilterContacts = "chatMembersFilterContacts" TypeChatMembersFilterAdministrators = "chatMembersFilterAdministrators" TypeChatMembersFilterMembers = "chatMembersFilterMembers" TypeChatMembersFilterRestricted = "chatMembersFilterRestricted" TypeChatMembersFilterBanned = "chatMembersFilterBanned" TypeChatMembersFilterBots = "chatMembersFilterBots" TypeSupergroupMembersFilterRecent = "supergroupMembersFilterRecent" + TypeSupergroupMembersFilterContacts = "supergroupMembersFilterContacts" TypeSupergroupMembersFilterAdministrators = "supergroupMembersFilterAdministrators" TypeSupergroupMembersFilterSearch = "supergroupMembersFilterSearch" TypeSupergroupMembersFilterRestricted = "supergroupMembersFilterRestricted" @@ -352,6 +366,7 @@ const ( TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation" TypeKeyboardButton = "keyboardButton" TypeInlineKeyboardButtonTypeUrl = "inlineKeyboardButtonTypeUrl" + TypeInlineKeyboardButtonTypeLoginUrl = "inlineKeyboardButtonTypeLoginUrl" TypeInlineKeyboardButtonTypeCallback = "inlineKeyboardButtonTypeCallback" TypeInlineKeyboardButtonTypeCallbackGame = "inlineKeyboardButtonTypeCallbackGame" TypeInlineKeyboardButtonTypeSwitchInline = "inlineKeyboardButtonTypeSwitchInline" @@ -611,7 +626,7 @@ const ( TypeUserStatusLastWeek = "userStatusLastWeek" TypeUserStatusLastMonth = "userStatusLastMonth" TypeStickers = "stickers" - TypeStickerEmojis = "stickerEmojis" + TypeEmojis = "emojis" TypeStickerSet = "stickerSet" TypeStickerSetInfo = "stickerSetInfo" TypeStickerSets = "stickerSets" @@ -629,7 +644,15 @@ const ( TypeCallStateHangingUp = "callStateHangingUp" TypeCallStateDiscarded = "callStateDiscarded" TypeCallStateError = "callStateError" + TypeCallProblemEcho = "callProblemEcho" + TypeCallProblemNoise = "callProblemNoise" + TypeCallProblemInterruptions = "callProblemInterruptions" + TypeCallProblemDistortedSpeech = "callProblemDistortedSpeech" + TypeCallProblemSilentLocal = "callProblemSilentLocal" + TypeCallProblemSilentRemote = "callProblemSilentRemote" + TypeCallProblemDropped = "callProblemDropped" TypeCall = "call" + TypePhoneNumberAuthenticationSettings = "phoneNumberAuthenticationSettings" TypeAnimations = "animations" TypeImportedContacts = "importedContacts" TypeHttpUrl = "httpUrl" @@ -667,6 +690,7 @@ const ( TypeGameHighScores = "gameHighScores" TypeChatEventMessageEdited = "chatEventMessageEdited" TypeChatEventMessageDeleted = "chatEventMessageDeleted" + TypeChatEventPollStopped = "chatEventPollStopped" TypeChatEventMessagePinned = "chatEventMessagePinned" TypeChatEventMessageUnpinned = "chatEventMessageUnpinned" TypeChatEventMemberJoined = "chatEventMemberJoined" @@ -675,6 +699,7 @@ const ( TypeChatEventMemberPromoted = "chatEventMemberPromoted" TypeChatEventMemberRestricted = "chatEventMemberRestricted" TypeChatEventTitleChanged = "chatEventTitleChanged" + TypeChatEventPermissionsChanged = "chatEventPermissionsChanged" TypeChatEventDescriptionChanged = "chatEventDescriptionChanged" TypeChatEventUsernameChanged = "chatEventUsernameChanged" TypeChatEventPhotoChanged = "chatEventPhotoChanged" @@ -704,8 +729,13 @@ const ( TypeDeviceTokenBlackBerryPush = "deviceTokenBlackBerryPush" TypeDeviceTokenTizenPush = "deviceTokenTizenPush" TypePushReceiverId = "pushReceiverId" - TypeWallpaper = "wallpaper" - TypeWallpapers = "wallpapers" + TypeBackgroundTypeWallpaper = "backgroundTypeWallpaper" + TypeBackgroundTypePattern = "backgroundTypePattern" + TypeBackgroundTypeSolid = "backgroundTypeSolid" + TypeBackground = "background" + TypeBackgrounds = "backgrounds" + TypeInputBackgroundLocal = "inputBackgroundLocal" + TypeInputBackgroundRemote = "inputBackgroundRemote" TypeHashtags = "hashtags" TypeCheckChatUsernameResultOk = "checkChatUsernameResultOk" TypeCheckChatUsernameResultUsernameInvalid = "checkChatUsernameResultUsernameInvalid" @@ -767,6 +797,8 @@ const ( TypeUserPrivacySettingRuleRestrictUsers = "userPrivacySettingRuleRestrictUsers" TypeUserPrivacySettingRules = "userPrivacySettingRules" TypeUserPrivacySettingShowStatus = "userPrivacySettingShowStatus" + TypeUserPrivacySettingShowProfilePhoto = "userPrivacySettingShowProfilePhoto" + TypeUserPrivacySettingShowLinkInForwardedMessages = "userPrivacySettingShowLinkInForwardedMessages" TypeUserPrivacySettingAllowChatInvites = "userPrivacySettingAllowChatInvites" TypeUserPrivacySettingAllowCalls = "userPrivacySettingAllowCalls" TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls" @@ -783,6 +815,7 @@ const ( TypeChatReportReasonCopyright = "chatReportReasonCopyright" TypeChatReportReasonCustom = "chatReportReasonCustom" TypePublicMessageLink = "publicMessageLink" + TypeMessageLinkInfo = "messageLinkInfo" TypeFilePart = "filePart" TypeFileTypeNone = "fileTypeNone" TypeFileTypeAnimation = "fileTypeAnimation" @@ -813,6 +846,8 @@ const ( TypeNetworkStatisticsEntryFile = "networkStatisticsEntryFile" TypeNetworkStatisticsEntryCall = "networkStatisticsEntryCall" TypeNetworkStatistics = "networkStatistics" + TypeAutoDownloadSettings = "autoDownloadSettings" + TypeAutoDownloadSettingsPresets = "autoDownloadSettingsPresets" TypeConnectionStateWaitingForNetwork = "connectionStateWaitingForNetwork" TypeConnectionStateConnectingToProxy = "connectionStateConnectingToProxy" TypeConnectionStateConnecting = "connectionStateConnecting" @@ -855,6 +890,7 @@ const ( TypeUpdateNewChat = "updateNewChat" TypeUpdateChatTitle = "updateChatTitle" TypeUpdateChatPhoto = "updateChatPhoto" + TypeUpdateChatPermissions = "updateChatPermissions" TypeUpdateChatLastMessage = "updateChatLastMessage" TypeUpdateChatOrder = "updateChatOrder" TypeUpdateChatIsPinned = "updateChatIsPinned" @@ -898,6 +934,7 @@ const ( TypeUpdateRecentStickers = "updateRecentStickers" TypeUpdateFavoriteStickers = "updateFavoriteStickers" TypeUpdateSavedAnimations = "updateSavedAnimations" + TypeUpdateSelectedBackground = "updateSelectedBackground" TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" TypeUpdateTermsOfService = "updateTermsOfService" @@ -1100,6 +1137,11 @@ type CallState interface { CallStateType() string } +// Describes the exact type of a problem with a call +type CallProblem interface { + CallProblemType() string +} + // Represents a single result of an inline query; for bots only type InputInlineQueryResult interface { InputInlineQueryResultType() string @@ -1130,6 +1172,16 @@ type DeviceToken interface { DeviceTokenType() string } +// Describes a type of a background +type BackgroundType interface { + BackgroundTypeType() string +} + +// Contains information about background to set +type InputBackground interface { + InputBackgroundType() string +} + // Represents result of checking whether a username can be set for a chat type CheckChatUsernameResult interface { CheckChatUsernameResultType() string @@ -1610,7 +1662,7 @@ type TermsOfService struct { meta // Text of the terms of service Text *FormattedText `json:"text"` - // Mininum age of a user to be able to accept the terms; 0 if any + // Minimum age of a user to be able to accept the terms; 0 if any MinUserAge int32 `json:"min_user_age"` // True, if a blocking popup with terms of service must be shown to the user ShowPopup bool `json:"show_popup"` @@ -1709,13 +1761,9 @@ func (*AuthorizationStateWaitPhoneNumber) AuthorizationStateType() string { return TypeAuthorizationStateWaitPhoneNumber } -// TDLib needs the user's authentication code to finalize authorization +// TDLib needs the user's authentication code to authorize type AuthorizationStateWaitCode struct { meta - // True, if the user is already registered - IsRegistered bool `json:"is_registered"` - // Telegram terms of service, which should be accepted before user can continue registration; may be null - TermsOfService *TermsOfService `json:"terms_of_service"` // Information about the authorization code that was sent CodeInfo *AuthenticationCodeInfo `json:"code_info"` } @@ -1740,12 +1788,39 @@ func (*AuthorizationStateWaitCode) AuthorizationStateType() string { return TypeAuthorizationStateWaitCode } +// The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration +type AuthorizationStateWaitRegistration struct { + meta + // Telegram terms of service + TermsOfService *TermsOfService `json:"terms_of_service"` +} + +func (entity *AuthorizationStateWaitRegistration) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateWaitRegistration + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateWaitRegistration) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateWaitRegistration) GetType() string { + return TypeAuthorizationStateWaitRegistration +} + +func (*AuthorizationStateWaitRegistration) AuthorizationStateType() string { + return TypeAuthorizationStateWaitRegistration +} + // The user has been authorized, but needs to enter a password to start using the application type AuthorizationStateWaitPassword struct { meta // Hint for the password; may be empty PasswordHint string `json:"password_hint"` - // True if a recovery email address has been set up + // True, if a recovery email address has been set up HasRecoveryEmailAddress bool `json:"has_recovery_email_address"` // Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent RecoveryEmailAddressPattern string `json:"recovery_email_address_pattern"` @@ -2188,6 +2263,33 @@ func (*PhotoSize) GetType() string { return TypePhotoSize } +// Thumbnail image of a very poor quality and low resolution +type Minithumbnail struct { + meta + // Thumbnail width, usually doesn't exceed 40 + Width int32 `json:"width"` + // Thumbnail height, usually doesn't exceed 40 + Height int32 `json:"height"` + // The thumbnail in JPEG format + Data []byte `json:"data"` +} + +func (entity *Minithumbnail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Minithumbnail + + return json.Marshal((*stub)(entity)) +} + +func (*Minithumbnail) GetClass() string { + return ClassMinithumbnail +} + +func (*Minithumbnail) GetType() string { + return TypeMinithumbnail +} + // A mask should be placed relatively to the forehead type MaskPointForehead struct { meta @@ -2384,6 +2486,8 @@ type Animation struct { FileName string `json:"file_name"` // MIME type of the file, usually "image/gif" or "video/mp4" MimeType string `json:"mime_type"` + // Animation minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` // Animation thumbnail; may be null Thumbnail *PhotoSize `json:"thumbnail"` // File containing the animation @@ -2419,6 +2523,8 @@ type Audio struct { FileName string `json:"file_name"` // The MIME type of the file; as defined by the sender MimeType string `json:"mime_type"` + // The minithumbnail of the album cover; may be null + AlbumCoverMinithumbnail *Minithumbnail `json:"album_cover_minithumbnail"` // The thumbnail of the album cover; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null AlbumCoverThumbnail *PhotoSize `json:"album_cover_thumbnail"` // File containing the audio @@ -2448,7 +2554,9 @@ type Document struct { FileName string `json:"file_name"` // MIME type of the file; as defined by the sender MimeType string `json:"mime_type"` - // Document thumbnail; as defined by the sender; may be null + // Document minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Document thumbnail in JPEG or PNG format (PNG will be used only for background patterns); as defined by the sender; may be null Thumbnail *PhotoSize `json:"thumbnail"` // File containing the document Document *File `json:"document"` @@ -2475,6 +2583,8 @@ type Photo struct { meta // True, if stickers were added to the photo HasStickers bool `json:"has_stickers"` + // Photo minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` // Available variants of the photo, in different sizes Sizes []*PhotoSize `json:"sizes"` } @@ -2506,6 +2616,8 @@ type Sticker struct { Height int32 `json:"height"` // Emoji corresponding to the sticker Emoji string `json:"emoji"` + // True, if the sticker is an animated sticker in TGS format + IsAnimated bool `json:"is_animated"` // True, if the sticker is a mask IsMask bool `json:"is_mask"` // Position where the mask should be placed; may be null @@ -2549,6 +2661,8 @@ type Video struct { HasStickers bool `json:"has_stickers"` // True, if the video should be tried to be streamed SupportsStreaming bool `json:"supports_streaming"` + // Video minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` // Video thumbnail; as defined by the sender; may be null Thumbnail *PhotoSize `json:"thumbnail"` // File containing the video @@ -2578,6 +2692,8 @@ type VideoNote struct { Duration int32 `json:"duration"` // Video width and height; as defined by the sender Length int32 `json:"length"` + // Video minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` // Video thumbnail; as defined by the sender; may be null Thumbnail *PhotoSize `json:"thumbnail"` // File containing the video @@ -2789,9 +2905,9 @@ type ProfilePhoto struct { meta // Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of userProfilePhotos Id JsonInt64 `json:"id"` - // A small (160x160) user profile photo + // A small (160x160) user profile photo. The file can be downloaded only before the photo is changed Small *File `json:"small"` - // A big (640x640) user profile photo + // A big (640x640) user profile photo. The file can be downloaded only before the photo is changed Big *File `json:"big"` } @@ -2814,9 +2930,9 @@ func (*ProfilePhoto) GetType() string { // Describes the photo of a chat type ChatPhoto struct { meta - // A small (160x160) chat photo + // A small (160x160) chat photo. The file can be downloaded only before the photo is changed Small *File `json:"small"` - // A big (640x640) chat photo + // A big (640x640) chat photo. The file can be downloaded only before the photo is changed Big *File `json:"big"` } @@ -3098,6 +3214,8 @@ type User struct { IsSupport bool `json:"is_support"` // If non-empty, it contains the reason why access to this user must be restricted. The format of the string is "{type}: {description}". {type} contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user) RestrictionReason string `json:"restriction_reason"` + // True, if many users reported this user as a scam + IsScam bool `json:"is_scam"` // If false, the user is inaccessible, and the only information known about the user is inside this class. It can't be passed to any method except GetUser HaveAccess bool `json:"have_access"` // Type of the user @@ -3136,6 +3254,7 @@ func (user *User) UnmarshalJSON(data []byte) error { IsVerified bool `json:"is_verified"` IsSupport bool `json:"is_support"` RestrictionReason string `json:"restriction_reason"` + IsScam bool `json:"is_scam"` HaveAccess bool `json:"have_access"` Type json.RawMessage `json:"type"` LanguageCode string `json:"language_code"` @@ -3155,6 +3274,7 @@ func (user *User) UnmarshalJSON(data []byte) error { user.IsVerified = tmp.IsVerified user.IsSupport = tmp.IsSupport user.RestrictionReason = tmp.RestrictionReason + user.IsScam = tmp.IsScam user.HaveAccess = tmp.HaveAccess user.LanguageCode = tmp.LanguageCode @@ -3285,6 +3405,43 @@ func (*Users) GetType() string { return TypeUsers } +// 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 animations, games, and stickers and use inline bots. Implies can_send_messages permissions + CanSendOtherMessages bool `json:"can_send_other_messages"` + // 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 creator of a chat and has all the administrator privileges type ChatMemberStatusCreator struct { meta @@ -3331,7 +3488,7 @@ type ChatMemberStatusAdministrator struct { CanRestrictMembers bool `json:"can_restrict_members"` // True, if the administrator can pin messages; applicable to groups only CanPinMessages bool `json:"can_pin_messages"` - // True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that were directly or indirectly promoted by him + // 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 him CanPromoteMembers bool `json:"can_promote_members"` } @@ -3387,14 +3544,8 @@ type ChatMemberStatusRestricted struct { IsMember bool `json:"is_member"` // Point in time (Unix timestamp) when restrictions will be lifted from the user; 0 if never. If the user is restricted for more than 366 days or for less than 30 seconds from the current time, the user is considered to be restricted forever RestrictedUntilDate int32 `json:"restricted_until_date"` - // 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 animations, games, and stickers and use inline bots. Implies can_send_media_messages permissions - CanSendOtherMessages bool `json:"can_send_other_messages"` - // True, if the user may add a web page preview to his messages. Implies can_send_messages permissions - CanAddWebPagePreviews bool `json:"can_add_web_page_previews"` + // User permissions in the chat + Permissions *ChatPermissions `json:"permissions"` } func (entity *ChatMemberStatusRestricted) MarshalJSON() ([]byte, error) { @@ -3550,6 +3701,31 @@ func (*ChatMembers) GetType() string { return TypeChatMembers } +// Returns contacts of the user +type ChatMembersFilterContacts struct { + meta +} + +func (entity *ChatMembersFilterContacts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMembersFilterContacts + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMembersFilterContacts) GetClass() string { + return ClassChatMembersFilter +} + +func (*ChatMembersFilterContacts) GetType() string { + return TypeChatMembersFilterContacts +} + +func (*ChatMembersFilterContacts) ChatMembersFilterType() string { + return TypeChatMembersFilterContacts +} + // Returns the creator and administrators type ChatMembersFilterAdministrators struct { meta @@ -3700,6 +3876,33 @@ func (*SupergroupMembersFilterRecent) SupergroupMembersFilterType() string { return TypeSupergroupMembersFilterRecent } +// Returns contacts of the user, which are members of the supergroup or channel +type SupergroupMembersFilterContacts struct { + meta + // Query to search for + Query string `json:"query"` +} + +func (entity *SupergroupMembersFilterContacts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SupergroupMembersFilterContacts + + return json.Marshal((*stub)(entity)) +} + +func (*SupergroupMembersFilterContacts) GetClass() string { + return ClassSupergroupMembersFilter +} + +func (*SupergroupMembersFilterContacts) GetType() string { + return TypeSupergroupMembersFilterContacts +} + +func (*SupergroupMembersFilterContacts) SupergroupMembersFilterType() string { + return TypeSupergroupMembersFilterContacts +} + // Returns the creator and administrators type SupergroupMembersFilterAdministrators struct { meta @@ -3840,8 +4043,6 @@ type BasicGroup struct { MemberCount int32 `json:"member_count"` // Status of the current user in the group Status ChatMemberStatus `json:"status"` - // True, if all members have been granted administrator rights in the group - EveryoneIsAdministrator bool `json:"everyone_is_administrator"` // True, if the group is active IsActive bool `json:"is_active"` // Identifier of the supergroup to which this group was upgraded; 0 if none @@ -3866,12 +4067,11 @@ func (*BasicGroup) GetType() string { func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { var tmp struct { - Id int32 `json:"id"` - MemberCount int32 `json:"member_count"` - Status json.RawMessage `json:"status"` - EveryoneIsAdministrator bool `json:"everyone_is_administrator"` - IsActive bool `json:"is_active"` - UpgradedToSupergroupId int32 `json:"upgraded_to_supergroup_id"` + Id int32 `json:"id"` + MemberCount int32 `json:"member_count"` + Status json.RawMessage `json:"status"` + IsActive bool `json:"is_active"` + UpgradedToSupergroupId int32 `json:"upgraded_to_supergroup_id"` } err := json.Unmarshal(data, &tmp) @@ -3881,7 +4081,6 @@ func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { basicGroup.Id = tmp.Id basicGroup.MemberCount = tmp.MemberCount - basicGroup.EveryoneIsAdministrator = tmp.EveryoneIsAdministrator basicGroup.IsActive = tmp.IsActive basicGroup.UpgradedToSupergroupId = tmp.UpgradedToSupergroupId @@ -3894,6 +4093,8 @@ func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { // Contains full information about a basic group type BasicGroupFullInfo struct { meta + // Group description + Description string `json:"description"` // User identifier of the creator of the group; 0 if unknown CreatorUserId int32 `json:"creator_user_id"` // Group members @@ -3931,8 +4132,6 @@ type Supergroup struct { Status ChatMemberStatus `json:"status"` // Member count; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was found through SearchPublicChats MemberCount int32 `json:"member_count"` - // True, if any member of the supergroup can invite other members. This field has no meaning for channels - AnyoneCanInvite bool `json:"anyone_can_invite"` // True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels SignMessages bool `json:"sign_messages"` // True, if the supergroup is a channel @@ -3941,6 +4140,8 @@ type Supergroup struct { IsVerified bool `json:"is_verified"` // If non-empty, contains the reason why access to this supergroup or channel must be restricted. Format of the string is "{type}: {description}". {type} Contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user) RestrictionReason string `json:"restriction_reason"` + // True, if many users reported this supergroup as a scam + IsScam bool `json:"is_scam"` } func (entity *Supergroup) MarshalJSON() ([]byte, error) { @@ -3966,11 +4167,11 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { Date int32 `json:"date"` Status json.RawMessage `json:"status"` MemberCount int32 `json:"member_count"` - AnyoneCanInvite bool `json:"anyone_can_invite"` SignMessages bool `json:"sign_messages"` IsChannel bool `json:"is_channel"` IsVerified bool `json:"is_verified"` RestrictionReason string `json:"restriction_reason"` + IsScam bool `json:"is_scam"` } err := json.Unmarshal(data, &tmp) @@ -3982,11 +4183,11 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.Username = tmp.Username supergroup.Date = tmp.Date supergroup.MemberCount = tmp.MemberCount - supergroup.AnyoneCanInvite = tmp.AnyoneCanInvite supergroup.SignMessages = tmp.SignMessages supergroup.IsChannel = tmp.IsChannel supergroup.IsVerified = tmp.IsVerified supergroup.RestrictionReason = tmp.RestrictionReason + supergroup.IsScam = tmp.IsScam fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) supergroup.Status = fieldStatus @@ -4209,7 +4410,7 @@ func (*MessageForwardOriginUser) MessageForwardOriginType() string { return TypeMessageForwardOriginUser } -// The message was originally written by a user, which is hidden by his privacy settings +// The message was originally written by a user, which is hidden by their privacy settings type MessageForwardOriginHiddenUser struct { meta // Name of the sender @@ -4274,9 +4475,9 @@ type MessageForwardInfo struct { Origin MessageForwardOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was originally sent Date int32 `json:"date"` - // For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded last time; 0 if unknown + // For messages forwarded to the chat with the current user (saved messages) or to the channel discussion supergroup, the identifier of the chat from which the message was forwarded last time; 0 if unknown FromChatId int64 `json:"from_chat_id"` - // For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded last time; 0 if unknown + // For messages forwarded to the chat with the current user (saved messages) or to the channel discussion supergroup, the identifier of the original message from which the new message was forwarded last time; 0 if unknown FromMessageId int64 `json:"from_message_id"` } @@ -4347,6 +4548,14 @@ func (*MessageSendingStatePending) MessageSendingStateType() string { // The message failed to be sent type MessageSendingStateFailed struct { meta + // An error code; 0 if unknown + ErrorCode int32 `json:"error_code"` + // Error message + ErrorMessage string `json:"error_message"` + // True, if the message can be re-sent + CanRetry bool `json:"can_retry"` + // Time left before the message can be re-sent, in seconds. No update is sent when this field changes + RetryAfter float64 `json:"retry_after"` } func (entity *MessageSendingStateFailed) MarshalJSON() ([]byte, error) { @@ -4374,7 +4583,7 @@ type Message struct { meta // Message identifier, unique for the chat to which the message belongs Id int64 `json:"id"` - // Identifier of the user who sent the message; 0 if unknown. It is unknown for channel posts + // Identifier of the user who sent the message; 0 if unknown. Currently, it is unknown for channel posts and for channel posts automatically forwarded to discussion group SenderUserId int32 `json:"sender_user_id"` // Chat identifier ChatId int64 `json:"chat_id"` @@ -4865,6 +5074,8 @@ type Chat struct { Title string `json:"title"` // Chat photo; may be null Photo *ChatPhoto `json:"photo"` + // Actions that non-administrator chat members are allowed to take in the chat + Permissions *ChatPermissions `json:"permissions"` // Last message in the chat; may be null LastMessage *Message `json:"last_message"` // Descending parameter by which chats are sorted in the main chat list. If the order number of two chats is the same, they must be sorted in descending order by ID. If 0, the position of the chat in the list is undetermined @@ -4925,6 +5136,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { Type json.RawMessage `json:"type"` Title string `json:"title"` Photo *ChatPhoto `json:"photo"` + Permissions *ChatPermissions `json:"permissions"` LastMessage *Message `json:"last_message"` Order JsonInt64 `json:"order"` IsPinned bool `json:"is_pinned"` @@ -4953,6 +5165,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.Id = tmp.Id chat.Title = tmp.Title chat.Photo = tmp.Photo + chat.Permissions = tmp.Permissions chat.LastMessage = tmp.LastMessage chat.Order = tmp.Order chat.IsPinned = tmp.IsPinned @@ -5039,7 +5252,7 @@ type ChatInviteLinkInfo struct { MemberCount int32 `json:"member_count"` // User identifiers of some chat members that may be known to the current user MemberUserIds []int32 `json:"member_user_ids"` - // True, if the chat is a public supergroup or channel with a username + // True, if the chat is a public supergroup or a channel with a username IsPublic bool `json:"is_public"` } @@ -5234,6 +5447,37 @@ func (*InlineKeyboardButtonTypeUrl) InlineKeyboardButtonTypeType() string { return TypeInlineKeyboardButtonTypeUrl } +// A button that opens a specified URL and automatically logs in in current user if they allowed to do that +type InlineKeyboardButtonTypeLoginUrl struct { + meta + // HTTP URL to open + Url string `json:"url"` + // Unique button identifier + Id int32 `json:"id"` + // If non-empty, new text of the button in forwarded messages + ForwardText string `json:"forward_text"` +} + +func (entity *InlineKeyboardButtonTypeLoginUrl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeLoginUrl + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeLoginUrl) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeLoginUrl) GetType() string { + return TypeInlineKeyboardButtonTypeLoginUrl +} + +func (*InlineKeyboardButtonTypeLoginUrl) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeLoginUrl +} + // A button that sends a special callback query to a bot type InlineKeyboardButtonTypeCallback struct { meta @@ -6018,9 +6262,9 @@ type RichTextIcon struct { meta // The image represented as a document. The image can be in GIF, JPEG or PNG format Document *Document `json:"document"` - // Width of a bounding box in which the image should be shown, 0 if unknown + // Width of a bounding box in which the image should be shown; 0 if unknown Width int32 `json:"width"` - // Height of a bounding box in which the image should be shown, 0 if unknown + // Height of a bounding box in which the image should be shown; 0 if unknown Height int32 `json:"height"` } @@ -7186,9 +7430,9 @@ type PageBlockEmbedded struct { Html string `json:"html"` // Poster photo, if available; may be null PosterPhoto *Photo `json:"poster_photo"` - // Block width, 0 if unknown + // Block width; 0 if unknown Width int32 `json:"width"` - // Block height, 0 if unknown + // Block height; 0 if unknown Height int32 `json:"height"` // Block caption Caption *PageBlockCaption `json:"caption"` @@ -7225,7 +7469,7 @@ type PageBlockEmbeddedPost struct { Url string `json:"url"` // Post author Author string `json:"author"` - // Post author photo + // Post author photo; may be null AuthorPhoto *Photo `json:"author_photo"` // Point in time (Unix timestamp) when the post was created; 0 if unknown Date int32 `json:"date"` @@ -12443,6 +12687,10 @@ type InputMessageForwarded struct { MessageId int64 `json:"message_id"` // True, if a game message should be shared within a launched game; applies only to game messages InGameShare bool `json:"in_game_share"` + // True, if content of the message needs to be copied without a link to the original message. Always true if the message is forwarded to a secret chat + SendCopy bool `json:"send_copy"` + // True, if media caption of the message copy needs to be removed. Ignored if send_copy is false + RemoveCaption bool `json:"remove_caption"` } func (entity *InputMessageForwarded) MarshalJSON() ([]byte, error) { @@ -13377,27 +13625,27 @@ func (*Stickers) GetType() string { return TypeStickers } -// Represents a list of all emoji corresponding to a sticker in a sticker set. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -type StickerEmojis struct { +// Represents a list of emoji +type Emojis struct { meta // List of emojis Emojis []string `json:"emojis"` } -func (entity *StickerEmojis) MarshalJSON() ([]byte, error) { +func (entity *Emojis) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StickerEmojis + type stub Emojis return json.Marshal((*stub)(entity)) } -func (*StickerEmojis) GetClass() string { - return ClassStickerEmojis +func (*Emojis) GetClass() string { + return ClassEmojis } -func (*StickerEmojis) GetType() string { - return TypeStickerEmojis +func (*Emojis) GetType() string { + return TypeEmojis } // Represents a sticker set @@ -13409,20 +13657,24 @@ type StickerSet struct { Title string `json:"title"` // Name of the sticker set Name string `json:"name"` + // Sticker set thumbnail in WEBP format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed + Thumbnail *PhotoSize `json:"thumbnail"` // True, if the sticker set has been installed by the current user IsInstalled bool `json:"is_installed"` // True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously IsArchived bool `json:"is_archived"` // True, if the sticker set is official IsOfficial bool `json:"is_official"` + // True, is the stickers in the set are animated + IsAnimated bool `json:"is_animated"` // True, if the stickers in the set are masks IsMasks bool `json:"is_masks"` // True for already viewed trending sticker sets IsViewed bool `json:"is_viewed"` // List of stickers in this set Stickers []*Sticker `json:"stickers"` - // A list of emoji corresponding to the stickers in the same order - Emojis []*StickerEmojis `json:"emojis"` + // A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object + Emojis []*Emojis `json:"emojis"` } func (entity *StickerSet) MarshalJSON() ([]byte, error) { @@ -13450,12 +13702,16 @@ type StickerSetInfo struct { Title string `json:"title"` // Name of the sticker set Name string `json:"name"` + // Sticker set thumbnail in WEBP format with width and height 100; may be null + Thumbnail *PhotoSize `json:"thumbnail"` // True, if the sticker set has been installed by current user IsInstalled bool `json:"is_installed"` // True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously IsArchived bool `json:"is_archived"` // True, if the sticker set is official IsOfficial bool `json:"is_official"` + // True, is the stickers in the set are animated + IsAnimated bool `json:"is_animated"` // True, if the stickers in the set are masks IsMasks bool `json:"is_masks"` // True for already viewed trending sticker sets @@ -13910,6 +14166,181 @@ func (*CallStateError) CallStateType() string { return TypeCallStateError } +// The user heard their own voice +type CallProblemEcho struct { + meta +} + +func (entity *CallProblemEcho) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallProblemEcho + + return json.Marshal((*stub)(entity)) +} + +func (*CallProblemEcho) GetClass() string { + return ClassCallProblem +} + +func (*CallProblemEcho) GetType() string { + return TypeCallProblemEcho +} + +func (*CallProblemEcho) CallProblemType() string { + return TypeCallProblemEcho +} + +// The user heard background noise +type CallProblemNoise struct { + meta +} + +func (entity *CallProblemNoise) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallProblemNoise + + return json.Marshal((*stub)(entity)) +} + +func (*CallProblemNoise) GetClass() string { + return ClassCallProblem +} + +func (*CallProblemNoise) GetType() string { + return TypeCallProblemNoise +} + +func (*CallProblemNoise) CallProblemType() string { + return TypeCallProblemNoise +} + +// The other side kept disappearing +type CallProblemInterruptions struct { + meta +} + +func (entity *CallProblemInterruptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallProblemInterruptions + + return json.Marshal((*stub)(entity)) +} + +func (*CallProblemInterruptions) GetClass() string { + return ClassCallProblem +} + +func (*CallProblemInterruptions) GetType() string { + return TypeCallProblemInterruptions +} + +func (*CallProblemInterruptions) CallProblemType() string { + return TypeCallProblemInterruptions +} + +// The speech was distorted +type CallProblemDistortedSpeech struct { + meta +} + +func (entity *CallProblemDistortedSpeech) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallProblemDistortedSpeech + + return json.Marshal((*stub)(entity)) +} + +func (*CallProblemDistortedSpeech) GetClass() string { + return ClassCallProblem +} + +func (*CallProblemDistortedSpeech) GetType() string { + return TypeCallProblemDistortedSpeech +} + +func (*CallProblemDistortedSpeech) CallProblemType() string { + return TypeCallProblemDistortedSpeech +} + +// The user couldn't hear the other side +type CallProblemSilentLocal struct { + meta +} + +func (entity *CallProblemSilentLocal) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallProblemSilentLocal + + return json.Marshal((*stub)(entity)) +} + +func (*CallProblemSilentLocal) GetClass() string { + return ClassCallProblem +} + +func (*CallProblemSilentLocal) GetType() string { + return TypeCallProblemSilentLocal +} + +func (*CallProblemSilentLocal) CallProblemType() string { + return TypeCallProblemSilentLocal +} + +// The other side couldn't hear the user +type CallProblemSilentRemote struct { + meta +} + +func (entity *CallProblemSilentRemote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallProblemSilentRemote + + return json.Marshal((*stub)(entity)) +} + +func (*CallProblemSilentRemote) GetClass() string { + return ClassCallProblem +} + +func (*CallProblemSilentRemote) GetType() string { + return TypeCallProblemSilentRemote +} + +func (*CallProblemSilentRemote) CallProblemType() string { + return TypeCallProblemSilentRemote +} + +// The call ended unexpectedly +type CallProblemDropped struct { + meta +} + +func (entity *CallProblemDropped) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallProblemDropped + + return json.Marshal((*stub)(entity)) +} + +func (*CallProblemDropped) GetClass() string { + return ClassCallProblem +} + +func (*CallProblemDropped) GetType() string { + return TypeCallProblemDropped +} + +func (*CallProblemDropped) CallProblemType() string { + return TypeCallProblemDropped +} + // Describes a call type Call struct { meta @@ -13962,6 +14393,33 @@ func (call *Call) UnmarshalJSON(data []byte) error { return nil } +// Contains settings for the authentication of the user's phone number +type PhoneNumberAuthenticationSettings struct { + meta + // Pass true if the authentication code may be sent via flash call to the specified phone number + AllowFlashCall bool `json:"allow_flash_call"` + // Pass true if the authenticated phone number is used on the current device + IsCurrentPhoneNumber bool `json:"is_current_phone_number"` + // For official applications only. True, if the app can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details + AllowSmsRetrieverApi bool `json:"allow_sms_retriever_api"` +} + +func (entity *PhoneNumberAuthenticationSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PhoneNumberAuthenticationSettings + + return json.Marshal((*stub)(entity)) +} + +func (*PhoneNumberAuthenticationSettings) GetClass() string { + return ClassPhoneNumberAuthenticationSettings +} + +func (*PhoneNumberAuthenticationSettings) GetType() string { + return TypePhoneNumberAuthenticationSettings +} + // Represents a list of animations type Animations struct { meta @@ -14701,14 +15159,14 @@ func (inputInlineQueryResultPhoto *InputInlineQueryResultPhoto) UnmarshalJSON(da return nil } -// Represents a link to a WEBP sticker +// Represents a link to a WEBP or a TGS sticker type InputInlineQueryResultSticker struct { meta // Unique identifier of the query result Id string `json:"id"` // URL of the sticker thumbnail, if it exists ThumbnailUrl string `json:"thumbnail_url"` - // The URL of the WEBP sticker (sticker file size must not exceed 5MB) + // The URL of the WEBP or a TGS sticker (sticker file size must not exceed 5MB) StickerUrl string `json:"sticker_url"` // Width of the sticker StickerWidth int32 `json:"sticker_width"` @@ -15614,6 +16072,33 @@ func (*ChatEventMessageDeleted) ChatEventActionType() string { return TypeChatEventMessageDeleted } +// A poll in a message was stopped +type ChatEventPollStopped struct { + meta + // The message with the poll + Message *Message `json:"message"` +} + +func (entity *ChatEventPollStopped) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventPollStopped + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventPollStopped) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventPollStopped) GetType() string { + return TypeChatEventPollStopped +} + +func (*ChatEventPollStopped) ChatEventActionType() string { + return TypeChatEventPollStopped +} + // A message was pinned type ChatEventMessagePinned struct { meta @@ -15901,6 +16386,35 @@ func (*ChatEventTitleChanged) ChatEventActionType() string { return TypeChatEventTitleChanged } +// The chat permissions was changed +type ChatEventPermissionsChanged struct { + meta + // Previous chat permissions + OldPermissions *ChatPermissions `json:"old_permissions"` + // New chat permissions + NewPermissions *ChatPermissions `json:"new_permissions"` +} + +func (entity *ChatEventPermissionsChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventPermissionsChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventPermissionsChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventPermissionsChanged) GetType() string { + return TypeChatEventPermissionsChanged +} + +func (*ChatEventPermissionsChanged) ChatEventActionType() string { + return TypeChatEventPermissionsChanged +} + // The chat description was changed type ChatEventDescriptionChanged struct { meta @@ -15963,9 +16477,9 @@ func (*ChatEventUsernameChanged) ChatEventActionType() string { type ChatEventPhotoChanged struct { meta // Previous chat photo value; may be null - OldPhoto *ChatPhoto `json:"old_photo"` + OldPhoto *Photo `json:"old_photo"` // New chat photo value; may be null - NewPhoto *ChatPhoto `json:"new_photo"` + NewPhoto *Photo `json:"new_photo"` } func (entity *ChatEventPhotoChanged) MarshalJSON() ([]byte, error) { @@ -15988,11 +16502,11 @@ func (*ChatEventPhotoChanged) ChatEventActionType() string { return TypeChatEventPhotoChanged } -// The anyone_can_invite setting of a supergroup chat was toggled +// The can_invite_users permission of a supergroup chat was toggled type ChatEventInvitesToggled struct { meta - // New value of anyone_can_invite - AnyoneCanInvite bool `json:"anyone_can_invite"` + // New value of can_invite_users permission + CanInviteUsers bool `json:"can_invite_users"` } func (entity *ChatEventInvitesToggled) MarshalJSON() ([]byte, error) { @@ -16772,54 +17286,244 @@ func (*PushReceiverId) GetType() string { return TypePushReceiverId } -// Contains information about a wallpaper -type Wallpaper struct { +// A wallpaper in JPEG format +type BackgroundTypeWallpaper struct { meta - // Unique persistent wallpaper identifier - Id int32 `json:"id"` - // Available variants of the wallpaper in different sizes. These photos can only be downloaded; they can't be sent in a message - Sizes []*PhotoSize `json:"sizes"` - // Main color of the wallpaper in RGB24 format; should be treated as background color if no photos are specified + // True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12 + IsBlurred bool `json:"is_blurred"` + // True, if the background needs to be slightly moved when device is rotated + IsMoving bool `json:"is_moving"` +} + +func (entity *BackgroundTypeWallpaper) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BackgroundTypeWallpaper + + return json.Marshal((*stub)(entity)) +} + +func (*BackgroundTypeWallpaper) GetClass() string { + return ClassBackgroundType +} + +func (*BackgroundTypeWallpaper) GetType() string { + return TypeBackgroundTypeWallpaper +} + +func (*BackgroundTypeWallpaper) BackgroundTypeType() string { + return TypeBackgroundTypeWallpaper +} + +// A PNG pattern to be combined with the color chosen by the user +type BackgroundTypePattern struct { + meta + // True, if the background needs to be slightly moved when device is rotated + IsMoving bool `json:"is_moving"` + // Main color of the background in RGB24 format + Color int32 `json:"color"` + // Intensity of the pattern when it is shown above the main background color, 0-100 + Intensity int32 `json:"intensity"` +} + +func (entity *BackgroundTypePattern) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BackgroundTypePattern + + return json.Marshal((*stub)(entity)) +} + +func (*BackgroundTypePattern) GetClass() string { + return ClassBackgroundType +} + +func (*BackgroundTypePattern) GetType() string { + return TypeBackgroundTypePattern +} + +func (*BackgroundTypePattern) BackgroundTypeType() string { + return TypeBackgroundTypePattern +} + +// A solid background +type BackgroundTypeSolid struct { + meta + // A color of the background in RGB24 format Color int32 `json:"color"` } -func (entity *Wallpaper) MarshalJSON() ([]byte, error) { +func (entity *BackgroundTypeSolid) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub Wallpaper + type stub BackgroundTypeSolid return json.Marshal((*stub)(entity)) } -func (*Wallpaper) GetClass() string { - return ClassWallpaper +func (*BackgroundTypeSolid) GetClass() string { + return ClassBackgroundType } -func (*Wallpaper) GetType() string { - return TypeWallpaper +func (*BackgroundTypeSolid) GetType() string { + return TypeBackgroundTypeSolid } -// Contains a list of wallpapers -type Wallpapers struct { +func (*BackgroundTypeSolid) BackgroundTypeType() string { + return TypeBackgroundTypeSolid +} + +// Describes a chat background +type Background struct { meta - // A list of wallpapers - Wallpapers []*Wallpaper `json:"wallpapers"` + // Unique background identifier + Id JsonInt64 `json:"id"` + // True, if this is one of default backgrounds + IsDefault bool `json:"is_default"` + // True, if the background is dark and is recommended to be used with dark theme + IsDark bool `json:"is_dark"` + // Unique background name + Name string `json:"name"` + // Document with the background; may be null. Null only for solid backgrounds + Document *Document `json:"document"` + // Type of the background + Type BackgroundType `json:"type"` } -func (entity *Wallpapers) MarshalJSON() ([]byte, error) { +func (entity *Background) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub Wallpapers + type stub Background return json.Marshal((*stub)(entity)) } -func (*Wallpapers) GetClass() string { - return ClassWallpapers +func (*Background) GetClass() string { + return ClassBackground } -func (*Wallpapers) GetType() string { - return TypeWallpapers +func (*Background) GetType() string { + return TypeBackground +} + +func (background *Background) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + IsDefault bool `json:"is_default"` + IsDark bool `json:"is_dark"` + Name string `json:"name"` + Document *Document `json:"document"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + background.Id = tmp.Id + background.IsDefault = tmp.IsDefault + background.IsDark = tmp.IsDark + background.Name = tmp.Name + background.Document = tmp.Document + + fieldType, _ := UnmarshalBackgroundType(tmp.Type) + background.Type = fieldType + + return nil +} + +// Contains a list of backgrounds +type Backgrounds struct { + meta + // A list of backgrounds + Backgrounds []*Background `json:"backgrounds"` +} + +func (entity *Backgrounds) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Backgrounds + + return json.Marshal((*stub)(entity)) +} + +func (*Backgrounds) GetClass() string { + return ClassBackgrounds +} + +func (*Backgrounds) GetType() string { + return TypeBackgrounds +} + +// A background from a local file +type InputBackgroundLocal struct { + meta + // Background file to use. Only inputFileLocal and inputFileGenerated are supported. The file nust be in JPEG format for wallpapers and in PNG format for patterns + Background InputFile `json:"background"` +} + +func (entity *InputBackgroundLocal) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputBackgroundLocal + + return json.Marshal((*stub)(entity)) +} + +func (*InputBackgroundLocal) GetClass() string { + return ClassInputBackground +} + +func (*InputBackgroundLocal) GetType() string { + return TypeInputBackgroundLocal +} + +func (*InputBackgroundLocal) InputBackgroundType() string { + return TypeInputBackgroundLocal +} + +func (inputBackgroundLocal *InputBackgroundLocal) UnmarshalJSON(data []byte) error { + var tmp struct { + Background json.RawMessage `json:"background"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldBackground, _ := UnmarshalInputFile(tmp.Background) + inputBackgroundLocal.Background = fieldBackground + + return nil +} + +// A background from the server +type InputBackgroundRemote struct { + meta + // The background identifier + BackgroundId JsonInt64 `json:"background_id"` +} + +func (entity *InputBackgroundRemote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputBackgroundRemote + + return json.Marshal((*stub)(entity)) +} + +func (*InputBackgroundRemote) GetClass() string { + return ClassInputBackground +} + +func (*InputBackgroundRemote) GetType() string { + return TypeInputBackgroundRemote +} + +func (*InputBackgroundRemote) InputBackgroundType() string { + return TypeInputBackgroundRemote } // Contains a list of hashtags @@ -16920,7 +17624,7 @@ func (*CheckChatUsernameResultUsernameOccupied) CheckChatUsernameResultType() st return TypeCheckChatUsernameResultUsernameOccupied } -// The user has too much public chats, one of them should be made private first +// The user has too much chats with username, one of them should be made private first type CheckChatUsernameResultPublicChatsTooMuch struct { meta } @@ -16997,7 +17701,7 @@ func (*PushMessageContentHidden) PushMessageContentType() string { return TypePushMessageContentHidden } -// An animation message (GIF-style) +// An animation message (GIF-style). type PushMessageContentAnimation struct { meta // Message content; may be null @@ -18565,6 +19269,56 @@ func (*UserPrivacySettingShowStatus) UserPrivacySettingType() string { return TypeUserPrivacySettingShowStatus } +// A privacy setting for managing whether the user's profile photo is visible +type UserPrivacySettingShowProfilePhoto struct { + meta +} + +func (entity *UserPrivacySettingShowProfilePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingShowProfilePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingShowProfilePhoto) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingShowProfilePhoto) GetType() string { + return TypeUserPrivacySettingShowProfilePhoto +} + +func (*UserPrivacySettingShowProfilePhoto) UserPrivacySettingType() string { + return TypeUserPrivacySettingShowProfilePhoto +} + +// A privacy setting for managing whether a link to the user's account is included in forwarded messages +type UserPrivacySettingShowLinkInForwardedMessages struct { + meta +} + +func (entity *UserPrivacySettingShowLinkInForwardedMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingShowLinkInForwardedMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingShowLinkInForwardedMessages) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingShowLinkInForwardedMessages) GetType() string { + return TypeUserPrivacySettingShowLinkInForwardedMessages +} + +func (*UserPrivacySettingShowLinkInForwardedMessages) UserPrivacySettingType() string { + return TypeUserPrivacySettingShowLinkInForwardedMessages +} + // A privacy setting for managing whether the user can be invited to chats type UserPrivacySettingAllowChatInvites struct { meta @@ -18974,7 +19728,7 @@ func (*ChatReportReasonCustom) ChatReportReasonType() string { return TypeChatReportReasonCustom } -// Contains a public HTTPS link to a message in a public supergroup or channel +// Contains a public HTTPS link to a message in a public supergroup or channel with a username type PublicMessageLink struct { meta // Message link @@ -18999,6 +19753,35 @@ func (*PublicMessageLink) GetType() string { return TypePublicMessageLink } +// Contains information about a link to a message in a chat +type MessageLinkInfo struct { + meta + // True, if the link is a public link for a message in a chat + IsPublic bool `json:"is_public"` + // If found, identifier of the chat to which the message belongs, 0 otherwise + ChatId int64 `json:"chat_id"` + // If found, the linked message; may be null + Message *Message `json:"message"` + // True, if the whole media album to which the message belongs is linked + ForAlbum bool `json:"for_album"` +} + +func (entity *MessageLinkInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageLinkInfo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageLinkInfo) GetClass() string { + return ClassMessageLinkInfo +} + +func (*MessageLinkInfo) GetType() string { + return TypeMessageLinkInfo +} + // Contains a part of a file type FilePart struct { meta @@ -19397,7 +20180,7 @@ func (*FileTypeVoiceNote) FileTypeType() string { return TypeFileTypeVoiceNote } -// The file is a wallpaper +// The file is a wallpaper or a background pattern type FileTypeWallpaper struct { meta } @@ -19844,7 +20627,69 @@ func (*NetworkStatistics) GetType() string { return TypeNetworkStatistics } -// Currently waiting for the network to become available. Use SetNetworkType to change the available network type +// Contains auto-download settings +type AutoDownloadSettings struct { + meta + // True, if the auto-download is enabled + IsAutoDownloadEnabled bool `json:"is_auto_download_enabled"` + // Maximum size of a photo file to be auto-downloaded + MaxPhotoFileSize int32 `json:"max_photo_file_size"` + // Maximum size of a video file to be auto-downloaded + MaxVideoFileSize int32 `json:"max_video_file_size"` + // Maximum size of other file types to be auto-downloaded + MaxOtherFileSize int32 `json:"max_other_file_size"` + // True, if the beginning of videos needs to be preloaded for instant playback + PreloadLargeVideos bool `json:"preload_large_videos"` + // True, if the next audio track needs to be preloaded while the user is listening to an audio file + PreloadNextAudio bool `json:"preload_next_audio"` + // True, if "use less data for calls" option needs to be enabled + UseLessDataForCalls bool `json:"use_less_data_for_calls"` +} + +func (entity *AutoDownloadSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AutoDownloadSettings + + return json.Marshal((*stub)(entity)) +} + +func (*AutoDownloadSettings) GetClass() string { + return ClassAutoDownloadSettings +} + +func (*AutoDownloadSettings) GetType() string { + return TypeAutoDownloadSettings +} + +// Contains auto-download settings presets for the user +type AutoDownloadSettingsPresets struct { + meta + // Preset with lowest settings; supposed to be used by default when roaming + Low *AutoDownloadSettings `json:"low"` + // Preset with medium settings; supposed to be used by default when using mobile data + Medium *AutoDownloadSettings `json:"medium"` + // Preset with highest settings; supposed to be used by default when connected on Wi-Fi + High *AutoDownloadSettings `json:"high"` +} + +func (entity *AutoDownloadSettingsPresets) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AutoDownloadSettingsPresets + + return json.Marshal((*stub)(entity)) +} + +func (*AutoDownloadSettingsPresets) GetClass() string { + return ClassAutoDownloadSettingsPresets +} + +func (*AutoDownloadSettingsPresets) GetType() string { + return TypeAutoDownloadSettingsPresets +} + +// Currently waiting for the network to become available. Use setNetworkType to change the available network type type ConnectionStateWaitingForNetwork struct { meta } @@ -20787,7 +21632,7 @@ func (*UpdateMessageSendSucceeded) UpdateType() string { // A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update type UpdateMessageSendFailed struct { meta - // Contains information about the message that failed to send + // Contains information about the message which failed to send Message *Message `json:"message"` // The previous temporary message identifier OldMessageId int64 `json:"old_message_id"` @@ -21101,6 +21946,35 @@ func (*UpdateChatPhoto) UpdateType() string { return TypeUpdateChatPhoto } +// Chat permissions was changed +type UpdateChatPermissions struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new chat permissions + Permissions *ChatPermissions `json:"permissions"` +} + +func (entity *UpdateChatPermissions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatPermissions + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatPermissions) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatPermissions) GetType() string { + return TypeUpdateChatPermissions +} + +func (*UpdateChatPermissions) UpdateType() string { + return TypeUpdateChatPermissions +} + // The last message of a chat was changed. If last_message is null then the last message in the chat became unknown. Some new unknown messages might be added to the chat in this case type UpdateChatLastMessage struct { meta @@ -22509,6 +23383,35 @@ func (*UpdateSavedAnimations) UpdateType() string { return TypeUpdateSavedAnimations } +// The selected background has changed +type UpdateSelectedBackground struct { + meta + // True, if background for dark theme has changed + ForDarkTheme bool `json:"for_dark_theme"` + // The new selected background; may be null + Background *Background `json:"background"` +} + +func (entity *UpdateSelectedBackground) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSelectedBackground + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSelectedBackground) GetClass() string { + return ClassUpdate +} + +func (*UpdateSelectedBackground) GetType() string { + return TypeUpdateSelectedBackground +} + +func (*UpdateSelectedBackground) UpdateType() string { + return TypeUpdateSelectedBackground +} + // Some language pack strings have been updated type UpdateLanguagePackStrings struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 8468a11..be755c0 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -54,6 +54,9 @@ func UnmarshalAuthorizationState(data json.RawMessage) (AuthorizationState, erro case TypeAuthorizationStateWaitCode: return UnmarshalAuthorizationStateWaitCode(data) + case TypeAuthorizationStateWaitRegistration: + return UnmarshalAuthorizationStateWaitRegistration(data) + case TypeAuthorizationStateWaitPassword: return UnmarshalAuthorizationStateWaitPassword(data) @@ -216,6 +219,9 @@ func UnmarshalChatMembersFilter(data json.RawMessage) (ChatMembersFilter, error) } switch meta.Type { + case TypeChatMembersFilterContacts: + return UnmarshalChatMembersFilterContacts(data) + case TypeChatMembersFilterAdministrators: return UnmarshalChatMembersFilterAdministrators(data) @@ -248,6 +254,9 @@ func UnmarshalSupergroupMembersFilter(data json.RawMessage) (SupergroupMembersFi case TypeSupergroupMembersFilterRecent: return UnmarshalSupergroupMembersFilterRecent(data) + case TypeSupergroupMembersFilterContacts: + return UnmarshalSupergroupMembersFilterContacts(data) + case TypeSupergroupMembersFilterAdministrators: return UnmarshalSupergroupMembersFilterAdministrators(data) @@ -418,6 +427,9 @@ func UnmarshalInlineKeyboardButtonType(data json.RawMessage) (InlineKeyboardButt case TypeInlineKeyboardButtonTypeUrl: return UnmarshalInlineKeyboardButtonTypeUrl(data) + case TypeInlineKeyboardButtonTypeLoginUrl: + return UnmarshalInlineKeyboardButtonTypeLoginUrl(data) + case TypeInlineKeyboardButtonTypeCallback: return UnmarshalInlineKeyboardButtonTypeCallback(data) @@ -1391,6 +1403,41 @@ func UnmarshalCallState(data json.RawMessage) (CallState, error) { } } +func UnmarshalCallProblem(data json.RawMessage) (CallProblem, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCallProblemEcho: + return UnmarshalCallProblemEcho(data) + + case TypeCallProblemNoise: + return UnmarshalCallProblemNoise(data) + + case TypeCallProblemInterruptions: + return UnmarshalCallProblemInterruptions(data) + + case TypeCallProblemDistortedSpeech: + return UnmarshalCallProblemDistortedSpeech(data) + + case TypeCallProblemSilentLocal: + return UnmarshalCallProblemSilentLocal(data) + + case TypeCallProblemSilentRemote: + return UnmarshalCallProblemSilentRemote(data) + + case TypeCallProblemDropped: + return UnmarshalCallProblemDropped(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + func UnmarshalInputInlineQueryResult(data json.RawMessage) (InputInlineQueryResult, error) { var meta meta @@ -1529,6 +1576,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventMessageDeleted: return UnmarshalChatEventMessageDeleted(data) + case TypeChatEventPollStopped: + return UnmarshalChatEventPollStopped(data) + case TypeChatEventMessagePinned: return UnmarshalChatEventMessagePinned(data) @@ -1553,6 +1603,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventTitleChanged: return UnmarshalChatEventTitleChanged(data) + case TypeChatEventPermissionsChanged: + return UnmarshalChatEventPermissionsChanged(data) + case TypeChatEventDescriptionChanged: return UnmarshalChatEventDescriptionChanged(data) @@ -1649,6 +1702,49 @@ func UnmarshalDeviceToken(data json.RawMessage) (DeviceToken, error) { } } +func UnmarshalBackgroundType(data json.RawMessage) (BackgroundType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBackgroundTypeWallpaper: + return UnmarshalBackgroundTypeWallpaper(data) + + case TypeBackgroundTypePattern: + return UnmarshalBackgroundTypePattern(data) + + case TypeBackgroundTypeSolid: + return UnmarshalBackgroundTypeSolid(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalInputBackground(data json.RawMessage) (InputBackground, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputBackgroundLocal: + return UnmarshalInputBackgroundLocal(data) + + case TypeInputBackgroundRemote: + return UnmarshalInputBackgroundRemote(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + func UnmarshalCheckChatUsernameResult(data json.RawMessage) (CheckChatUsernameResult, error) { var meta meta @@ -1924,6 +2020,12 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro case TypeUserPrivacySettingShowStatus: return UnmarshalUserPrivacySettingShowStatus(data) + case TypeUserPrivacySettingShowProfilePhoto: + return UnmarshalUserPrivacySettingShowProfilePhoto(data) + + case TypeUserPrivacySettingShowLinkInForwardedMessages: + return UnmarshalUserPrivacySettingShowLinkInForwardedMessages(data) + case TypeUserPrivacySettingAllowChatInvites: return UnmarshalUserPrivacySettingAllowChatInvites(data) @@ -2259,6 +2361,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(data) + case TypeUpdateChatPermissions: + return UnmarshalUpdateChatPermissions(data) + case TypeUpdateChatLastMessage: return UnmarshalUpdateChatLastMessage(data) @@ -2388,6 +2493,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedAnimations: return UnmarshalUpdateSavedAnimations(data) + case TypeUpdateSelectedBackground: + return UnmarshalUpdateSelectedBackground(data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(data) @@ -2588,6 +2696,14 @@ func UnmarshalAuthorizationStateWaitCode(data json.RawMessage) (*AuthorizationSt return &resp, err } +func UnmarshalAuthorizationStateWaitRegistration(data json.RawMessage) (*AuthorizationStateWaitRegistration, error) { + var resp AuthorizationStateWaitRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAuthorizationStateWaitPassword(data json.RawMessage) (*AuthorizationStateWaitPassword, error) { var resp AuthorizationStateWaitPassword @@ -2716,6 +2832,14 @@ func UnmarshalPhotoSize(data json.RawMessage) (*PhotoSize, error) { return &resp, err } +func UnmarshalMinithumbnail(data json.RawMessage) (*Minithumbnail, error) { + var resp Minithumbnail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMaskPointForehead(data json.RawMessage) (*MaskPointForehead, error) { var resp MaskPointForehead @@ -2996,6 +3120,14 @@ func UnmarshalUsers(data json.RawMessage) (*Users, error) { 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 @@ -3060,6 +3192,14 @@ func UnmarshalChatMembers(data json.RawMessage) (*ChatMembers, error) { return &resp, err } +func UnmarshalChatMembersFilterContacts(data json.RawMessage) (*ChatMembersFilterContacts, error) { + var resp ChatMembersFilterContacts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatMembersFilterAdministrators(data json.RawMessage) (*ChatMembersFilterAdministrators, error) { var resp ChatMembersFilterAdministrators @@ -3108,6 +3248,14 @@ func UnmarshalSupergroupMembersFilterRecent(data json.RawMessage) (*SupergroupMe return &resp, err } +func UnmarshalSupergroupMembersFilterContacts(data json.RawMessage) (*SupergroupMembersFilterContacts, error) { + var resp SupergroupMembersFilterContacts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSupergroupMembersFilterAdministrators(data json.RawMessage) (*SupergroupMembersFilterAdministrators, error) { var resp SupergroupMembersFilterAdministrators @@ -3436,6 +3584,14 @@ func UnmarshalInlineKeyboardButtonTypeUrl(data json.RawMessage) (*InlineKeyboard return &resp, err } +func UnmarshalInlineKeyboardButtonTypeLoginUrl(data json.RawMessage) (*InlineKeyboardButtonTypeLoginUrl, error) { + var resp InlineKeyboardButtonTypeLoginUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInlineKeyboardButtonTypeCallback(data json.RawMessage) (*InlineKeyboardButtonTypeCallback, error) { var resp InlineKeyboardButtonTypeCallback @@ -5508,8 +5664,8 @@ func UnmarshalStickers(data json.RawMessage) (*Stickers, error) { return &resp, err } -func UnmarshalStickerEmojis(data json.RawMessage) (*StickerEmojis, error) { - var resp StickerEmojis +func UnmarshalEmojis(data json.RawMessage) (*Emojis, error) { + var resp Emojis err := json.Unmarshal(data, &resp) @@ -5652,6 +5808,62 @@ func UnmarshalCallStateError(data json.RawMessage) (*CallStateError, error) { return &resp, err } +func UnmarshalCallProblemEcho(data json.RawMessage) (*CallProblemEcho, error) { + var resp CallProblemEcho + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemNoise(data json.RawMessage) (*CallProblemNoise, error) { + var resp CallProblemNoise + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemInterruptions(data json.RawMessage) (*CallProblemInterruptions, error) { + var resp CallProblemInterruptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemDistortedSpeech(data json.RawMessage) (*CallProblemDistortedSpeech, error) { + var resp CallProblemDistortedSpeech + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemSilentLocal(data json.RawMessage) (*CallProblemSilentLocal, error) { + var resp CallProblemSilentLocal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemSilentRemote(data json.RawMessage) (*CallProblemSilentRemote, error) { + var resp CallProblemSilentRemote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemDropped(data json.RawMessage) (*CallProblemDropped, error) { + var resp CallProblemDropped + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCall(data json.RawMessage) (*Call, error) { var resp Call @@ -5660,6 +5872,14 @@ func UnmarshalCall(data json.RawMessage) (*Call, error) { return &resp, err } +func UnmarshalPhoneNumberAuthenticationSettings(data json.RawMessage) (*PhoneNumberAuthenticationSettings, error) { + var resp PhoneNumberAuthenticationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAnimations(data json.RawMessage) (*Animations, error) { var resp Animations @@ -5956,6 +6176,14 @@ func UnmarshalChatEventMessageDeleted(data json.RawMessage) (*ChatEventMessageDe return &resp, err } +func UnmarshalChatEventPollStopped(data json.RawMessage) (*ChatEventPollStopped, error) { + var resp ChatEventPollStopped + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventMessagePinned(data json.RawMessage) (*ChatEventMessagePinned, error) { var resp ChatEventMessagePinned @@ -6020,6 +6248,14 @@ func UnmarshalChatEventTitleChanged(data json.RawMessage) (*ChatEventTitleChange return &resp, err } +func UnmarshalChatEventPermissionsChanged(data json.RawMessage) (*ChatEventPermissionsChanged, error) { + var resp ChatEventPermissionsChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventDescriptionChanged(data json.RawMessage) (*ChatEventDescriptionChanged, error) { var resp ChatEventDescriptionChanged @@ -6252,16 +6488,56 @@ func UnmarshalPushReceiverId(data json.RawMessage) (*PushReceiverId, error) { return &resp, err } -func UnmarshalWallpaper(data json.RawMessage) (*Wallpaper, error) { - var resp Wallpaper +func UnmarshalBackgroundTypeWallpaper(data json.RawMessage) (*BackgroundTypeWallpaper, error) { + var resp BackgroundTypeWallpaper err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalWallpapers(data json.RawMessage) (*Wallpapers, error) { - var resp Wallpapers +func UnmarshalBackgroundTypePattern(data json.RawMessage) (*BackgroundTypePattern, error) { + var resp BackgroundTypePattern + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBackgroundTypeSolid(data json.RawMessage) (*BackgroundTypeSolid, error) { + var resp BackgroundTypeSolid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBackground(data json.RawMessage) (*Background, error) { + var resp Background + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBackgrounds(data json.RawMessage) (*Backgrounds, error) { + var resp Backgrounds + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputBackgroundLocal(data json.RawMessage) (*InputBackgroundLocal, error) { + var resp InputBackgroundLocal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputBackgroundRemote(data json.RawMessage) (*InputBackgroundRemote, error) { + var resp InputBackgroundRemote err := json.Unmarshal(data, &resp) @@ -6756,6 +7032,22 @@ func UnmarshalUserPrivacySettingShowStatus(data json.RawMessage) (*UserPrivacySe return &resp, err } +func UnmarshalUserPrivacySettingShowProfilePhoto(data json.RawMessage) (*UserPrivacySettingShowProfilePhoto, error) { + var resp UserPrivacySettingShowProfilePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingShowLinkInForwardedMessages(data json.RawMessage) (*UserPrivacySettingShowLinkInForwardedMessages, error) { + var resp UserPrivacySettingShowLinkInForwardedMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingAllowChatInvites(data json.RawMessage) (*UserPrivacySettingAllowChatInvites, error) { var resp UserPrivacySettingAllowChatInvites @@ -6884,6 +7176,14 @@ func UnmarshalPublicMessageLink(data json.RawMessage) (*PublicMessageLink, error return &resp, err } +func UnmarshalMessageLinkInfo(data json.RawMessage) (*MessageLinkInfo, error) { + var resp MessageLinkInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFilePart(data json.RawMessage) (*FilePart, error) { var resp FilePart @@ -7124,6 +7424,22 @@ func UnmarshalNetworkStatistics(data json.RawMessage) (*NetworkStatistics, error return &resp, err } +func UnmarshalAutoDownloadSettings(data json.RawMessage) (*AutoDownloadSettings, error) { + var resp AutoDownloadSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAutoDownloadSettingsPresets(data json.RawMessage) (*AutoDownloadSettingsPresets, error) { + var resp AutoDownloadSettingsPresets + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalConnectionStateWaitingForNetwork(data json.RawMessage) (*ConnectionStateWaitingForNetwork, error) { var resp ConnectionStateWaitingForNetwork @@ -7460,6 +7776,14 @@ func UnmarshalUpdateChatPhoto(data json.RawMessage) (*UpdateChatPhoto, error) { return &resp, err } +func UnmarshalUpdateChatPermissions(data json.RawMessage) (*UpdateChatPermissions, error) { + var resp UpdateChatPermissions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatLastMessage(data json.RawMessage) (*UpdateChatLastMessage, error) { var resp UpdateChatLastMessage @@ -7804,6 +8128,14 @@ func UnmarshalUpdateSavedAnimations(data json.RawMessage) (*UpdateSavedAnimation return &resp, err } +func UnmarshalUpdateSelectedBackground(data json.RawMessage) (*UpdateSelectedBackground, error) { + var resp UpdateSelectedBackground + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateLanguagePackStrings(data json.RawMessage) (*UpdateLanguagePackStrings, error) { var resp UpdateLanguagePackStrings @@ -8064,6 +8396,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAuthorizationStateWaitCode: return UnmarshalAuthorizationStateWaitCode(data) + case TypeAuthorizationStateWaitRegistration: + return UnmarshalAuthorizationStateWaitRegistration(data) + case TypeAuthorizationStateWaitPassword: return UnmarshalAuthorizationStateWaitPassword(data) @@ -8112,6 +8447,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePhotoSize: return UnmarshalPhotoSize(data) + case TypeMinithumbnail: + return UnmarshalMinithumbnail(data) + case TypeMaskPointForehead: return UnmarshalMaskPointForehead(data) @@ -8217,6 +8555,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUsers: return UnmarshalUsers(data) + case TypeChatPermissions: + return UnmarshalChatPermissions(data) + case TypeChatMemberStatusCreator: return UnmarshalChatMemberStatusCreator(data) @@ -8241,6 +8582,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatMembers: return UnmarshalChatMembers(data) + case TypeChatMembersFilterContacts: + return UnmarshalChatMembersFilterContacts(data) + case TypeChatMembersFilterAdministrators: return UnmarshalChatMembersFilterAdministrators(data) @@ -8259,6 +8603,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSupergroupMembersFilterRecent: return UnmarshalSupergroupMembersFilterRecent(data) + case TypeSupergroupMembersFilterContacts: + return UnmarshalSupergroupMembersFilterContacts(data) + case TypeSupergroupMembersFilterAdministrators: return UnmarshalSupergroupMembersFilterAdministrators(data) @@ -8382,6 +8729,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInlineKeyboardButtonTypeUrl: return UnmarshalInlineKeyboardButtonTypeUrl(data) + case TypeInlineKeyboardButtonTypeLoginUrl: + return UnmarshalInlineKeyboardButtonTypeLoginUrl(data) + case TypeInlineKeyboardButtonTypeCallback: return UnmarshalInlineKeyboardButtonTypeCallback(data) @@ -9159,8 +9509,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStickers: return UnmarshalStickers(data) - case TypeStickerEmojis: - return UnmarshalStickerEmojis(data) + case TypeEmojis: + return UnmarshalEmojis(data) case TypeStickerSet: return UnmarshalStickerSet(data) @@ -9213,9 +9563,33 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCallStateError: return UnmarshalCallStateError(data) + case TypeCallProblemEcho: + return UnmarshalCallProblemEcho(data) + + case TypeCallProblemNoise: + return UnmarshalCallProblemNoise(data) + + case TypeCallProblemInterruptions: + return UnmarshalCallProblemInterruptions(data) + + case TypeCallProblemDistortedSpeech: + return UnmarshalCallProblemDistortedSpeech(data) + + case TypeCallProblemSilentLocal: + return UnmarshalCallProblemSilentLocal(data) + + case TypeCallProblemSilentRemote: + return UnmarshalCallProblemSilentRemote(data) + + case TypeCallProblemDropped: + return UnmarshalCallProblemDropped(data) + case TypeCall: return UnmarshalCall(data) + case TypePhoneNumberAuthenticationSettings: + return UnmarshalPhoneNumberAuthenticationSettings(data) + case TypeAnimations: return UnmarshalAnimations(data) @@ -9327,6 +9701,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventMessageDeleted: return UnmarshalChatEventMessageDeleted(data) + case TypeChatEventPollStopped: + return UnmarshalChatEventPollStopped(data) + case TypeChatEventMessagePinned: return UnmarshalChatEventMessagePinned(data) @@ -9351,6 +9728,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventTitleChanged: return UnmarshalChatEventTitleChanged(data) + case TypeChatEventPermissionsChanged: + return UnmarshalChatEventPermissionsChanged(data) + case TypeChatEventDescriptionChanged: return UnmarshalChatEventDescriptionChanged(data) @@ -9438,11 +9818,26 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushReceiverId: return UnmarshalPushReceiverId(data) - case TypeWallpaper: - return UnmarshalWallpaper(data) + case TypeBackgroundTypeWallpaper: + return UnmarshalBackgroundTypeWallpaper(data) - case TypeWallpapers: - return UnmarshalWallpapers(data) + case TypeBackgroundTypePattern: + return UnmarshalBackgroundTypePattern(data) + + case TypeBackgroundTypeSolid: + return UnmarshalBackgroundTypeSolid(data) + + case TypeBackground: + return UnmarshalBackground(data) + + case TypeBackgrounds: + return UnmarshalBackgrounds(data) + + case TypeInputBackgroundLocal: + return UnmarshalInputBackgroundLocal(data) + + case TypeInputBackgroundRemote: + return UnmarshalInputBackgroundRemote(data) case TypeHashtags: return UnmarshalHashtags(data) @@ -9627,6 +10022,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingShowStatus: return UnmarshalUserPrivacySettingShowStatus(data) + case TypeUserPrivacySettingShowProfilePhoto: + return UnmarshalUserPrivacySettingShowProfilePhoto(data) + + case TypeUserPrivacySettingShowLinkInForwardedMessages: + return UnmarshalUserPrivacySettingShowLinkInForwardedMessages(data) + case TypeUserPrivacySettingAllowChatInvites: return UnmarshalUserPrivacySettingAllowChatInvites(data) @@ -9675,6 +10076,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePublicMessageLink: return UnmarshalPublicMessageLink(data) + case TypeMessageLinkInfo: + return UnmarshalMessageLinkInfo(data) + case TypeFilePart: return UnmarshalFilePart(data) @@ -9765,6 +10169,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeNetworkStatistics: return UnmarshalNetworkStatistics(data) + case TypeAutoDownloadSettings: + return UnmarshalAutoDownloadSettings(data) + + case TypeAutoDownloadSettingsPresets: + return UnmarshalAutoDownloadSettingsPresets(data) + case TypeConnectionStateWaitingForNetwork: return UnmarshalConnectionStateWaitingForNetwork(data) @@ -9891,6 +10301,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(data) + case TypeUpdateChatPermissions: + return UnmarshalUpdateChatPermissions(data) + case TypeUpdateChatLastMessage: return UnmarshalUpdateChatLastMessage(data) @@ -10020,6 +10433,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedAnimations: return UnmarshalUpdateSavedAnimations(data) + case TypeUpdateSelectedBackground: + return UnmarshalUpdateSelectedBackground(data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(data) diff --git a/data/td_api.json b/data/td_api.json index b7346e4..92705b1 100755 --- a/data/td_api.json +++ b/data/td_api.json @@ -315,7 +315,7 @@ { "name": "min_user_age", "type": "int32", - "description": "Mininum age of a user to be able to accept the terms; 0 if any" + "description": "Minimum age of a user to be able to accept the terms; 0 if any" }, { "name": "show_popup", @@ -350,19 +350,9 @@ }, { "name": "authorizationStateWaitCode", - "description": "TDLib needs the user's authentication code to finalize authorization", + "description": "TDLib needs the user's authentication code to authorize", "class": "AuthorizationState", "properties": [ - { - "name": "is_registered", - "type": "Bool", - "description": "True, if the user is already registered" - }, - { - "name": "terms_of_service", - "type": "termsOfService", - "description": "Telegram terms of service, which should be accepted before user can continue registration; may be null" - }, { "name": "code_info", "type": "authenticationCodeInfo", @@ -370,6 +360,18 @@ } ] }, + { + "name": "authorizationStateWaitRegistration", + "description": "The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration", + "class": "AuthorizationState", + "properties": [ + { + "name": "terms_of_service", + "type": "termsOfService", + "description": "Telegram terms of service" + } + ] + }, { "name": "authorizationStateWaitPassword", "description": "The user has been authorized, but needs to enter a password to start using the application", @@ -383,7 +385,7 @@ { "name": "has_recovery_email_address", "type": "Bool", - "description": "True if a recovery email address has been set up" + "description": "True, if a recovery email address has been set up" }, { "name": "recovery_email_address_pattern", @@ -668,6 +670,28 @@ } ] }, + { + "name": "minithumbnail", + "description": "Thumbnail image of a very poor quality and low resolution", + "class": "Minithumbnail", + "properties": [ + { + "name": "width", + "type": "int32", + "description": "Thumbnail width, usually doesn't exceed 40" + }, + { + "name": "height", + "type": "int32", + "description": "Thumbnail height, usually doesn't exceed 40" + }, + { + "name": "data", + "type": "bytes", + "description": "The thumbnail in JPEG format" + } + ] + }, { "name": "maskPointForehead", "description": "A mask should be placed relatively to the forehead", @@ -781,6 +805,11 @@ "type": "string", "description": "MIME type of the file, usually \"image/gif\" or \"video/mp4\"" }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Animation minithumbnail; may be null" + }, { "name": "thumbnail", "type": "photoSize", @@ -823,6 +852,11 @@ "type": "string", "description": "The MIME type of the file; as defined by the sender" }, + { + "name": "album_cover_minithumbnail", + "type": "minithumbnail", + "description": "The minithumbnail of the album cover; may be null" + }, { "name": "album_cover_thumbnail", "type": "photoSize", @@ -850,10 +884,15 @@ "type": "string", "description": "MIME type of the file; as defined by the sender" }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Document minithumbnail; may be null" + }, { "name": "thumbnail", "type": "photoSize", - "description": "Document thumbnail; as defined by the sender; may be null" + "description": "Document thumbnail in JPEG or PNG format (PNG will be used only for background patterns); as defined by the sender; may be null" }, { "name": "document", @@ -872,6 +911,11 @@ "type": "Bool", "description": "True, if stickers were added to the photo" }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Photo minithumbnail; may be null" + }, { "name": "sizes", "type": "vector\u003cphotoSize\u003e", @@ -904,6 +948,11 @@ "type": "string", "description": "Emoji corresponding to the sticker" }, + { + "name": "is_animated", + "type": "Bool", + "description": "True, if the sticker is an animated sticker in TGS format" + }, { "name": "is_mask", "type": "Bool", @@ -966,6 +1015,11 @@ "type": "Bool", "description": "True, if the video should be tried to be streamed" }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Video minithumbnail; may be null" + }, { "name": "thumbnail", "type": "photoSize", @@ -993,6 +1047,11 @@ "type": "int32", "description": "Video width and height; as defined by the sender" }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Video minithumbnail; may be null" + }, { "name": "thumbnail", "type": "photoSize", @@ -1205,12 +1264,12 @@ { "name": "small", "type": "file", - "description": "A small (160x160) user profile photo" + "description": "A small (160x160) user profile photo. The file can be downloaded only before the photo is changed" }, { "name": "big", "type": "file", - "description": "A big (640x640) user profile photo" + "description": "A big (640x640) user profile photo. The file can be downloaded only before the photo is changed" } ] }, @@ -1222,12 +1281,12 @@ { "name": "small", "type": "file", - "description": "A small (160x160) chat photo" + "description": "A small (160x160) chat photo. The file can be downloaded only before the photo is changed" }, { "name": "big", "type": "file", - "description": "A big (640x640) chat photo" + "description": "A big (640x640) chat photo. The file can be downloaded only before the photo is changed" } ] }, @@ -1398,6 +1457,11 @@ "type": "string", "description": "If non-empty, it contains the reason why access to this user must be restricted. The format of the string is \"{type}: {description}\". {type} contains the type of the restriction and at least one of the suffixes \"-all\", \"-ios\", \"-android\", or \"-wp\", which describe the platforms on which access should be restricted. (For example, \"terms-ios-android\". {description} contains a human-readable description of the restriction, which can be shown to the user)" }, + { + "name": "is_scam", + "type": "Bool", + "description": "True, if many users reported this user as a scam" + }, { "name": "have_access", "type": "Bool", @@ -1513,6 +1577,53 @@ } ] }, + { + "name": "chatPermissions", + "description": "Describes actions that a user is allowed to take in a chat", + "class": "ChatPermissions", + "properties": [ + { + "name": "can_send_messages", + "type": "Bool", + "description": "True, if the user can send text messages, contacts, locations, and venues" + }, + { + "name": "can_send_media_messages", + "type": "Bool", + "description": "True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions" + }, + { + "name": "can_send_polls", + "type": "Bool", + "description": "True, if the user can send polls. Implies can_send_messages permissions" + }, + { + "name": "can_send_other_messages", + "type": "Bool", + "description": "True, if the user can send animations, games, and stickers and use inline bots. Implies can_send_messages permissions" + }, + { + "name": "can_add_web_page_previews", + "type": "Bool", + "description": "True, if the user may add a web page preview to their messages. Implies can_send_messages permissions" + }, + { + "name": "can_change_info", + "type": "Bool", + "description": "True, if the user can change the chat title, photo, and other settings" + }, + { + "name": "can_invite_users", + "type": "Bool", + "description": "True, if the user can invite new users to the chat" + }, + { + "name": "can_pin_messages", + "type": "Bool", + "description": "True, if the user can pin messages" + } + ] + }, { "name": "chatMemberStatusCreator", "description": "The user is the creator of a chat and has all the administrator privileges", @@ -1573,7 +1684,7 @@ { "name": "can_promote_members", "type": "Bool", - "description": "True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that were directly or indirectly promoted by him" + "description": "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 him" } ] }, @@ -1599,24 +1710,9 @@ "description": "Point in time (Unix timestamp) when restrictions will be lifted from the user; 0 if never. If the user is restricted for more than 366 days or for less than 30 seconds from the current time, the user is considered to be restricted forever" }, { - "name": "can_send_messages", - "type": "Bool", - "description": "True, if the user can send text messages, contacts, locations, and venues" - }, - { - "name": "can_send_media_messages", - "type": "Bool", - "description": "True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions" - }, - { - "name": "can_send_other_messages", - "type": "Bool", - "description": "True, if the user can send animations, games, and stickers and use inline bots. Implies can_send_media_messages permissions" - }, - { - "name": "can_add_web_page_previews", - "type": "Bool", - "description": "True, if the user may add a web page preview to his messages. Implies can_send_messages permissions" + "name": "permissions", + "type": "chatPermissions", + "description": "User permissions in the chat" } ] }, @@ -1687,6 +1783,12 @@ } ] }, + { + "name": "chatMembersFilterContacts", + "description": "Returns contacts of the user", + "class": "ChatMembersFilter", + "properties": [] + }, { "name": "chatMembersFilterAdministrators", "description": "Returns the creator and administrators", @@ -1723,6 +1825,18 @@ "class": "SupergroupMembersFilter", "properties": [] }, + { + "name": "supergroupMembersFilterContacts", + "description": "Returns contacts of the user, which are members of the supergroup or channel", + "class": "SupergroupMembersFilter", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for" + } + ] + }, { "name": "supergroupMembersFilterAdministrators", "description": "Returns the creator and administrators", @@ -1791,11 +1905,6 @@ "type": "ChatMemberStatus", "description": "Status of the current user in the group" }, - { - "name": "everyone_is_administrator", - "type": "Bool", - "description": "True, if all members have been granted administrator rights in the group" - }, { "name": "is_active", "type": "Bool", @@ -1813,6 +1922,11 @@ "description": "Contains full information about a basic group", "class": "BasicGroupFullInfo", "properties": [ + { + "name": "description", + "type": "string", + "description": "Group description" + }, { "name": "creator_user_id", "type": "int32", @@ -1860,11 +1974,6 @@ "type": "int32", "description": "Member count; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was found through SearchPublicChats" }, - { - "name": "anyone_can_invite", - "type": "Bool", - "description": "True, if any member of the supergroup can invite other members. This field has no meaning for channels" - }, { "name": "sign_messages", "type": "Bool", @@ -1884,6 +1993,11 @@ "name": "restriction_reason", "type": "string", "description": "If non-empty, contains the reason why access to this supergroup or channel must be restricted. Format of the string is \"{type}: {description}\". {type} Contains the type of the restriction and at least one of the suffixes \"-all\", \"-ios\", \"-android\", or \"-wp\", which describe the platforms on which access should be restricted. (For example, \"terms-ios-android\". {description} contains a human-readable description of the restriction, which can be shown to the user)" + }, + { + "name": "is_scam", + "type": "Bool", + "description": "True, if many users reported this supergroup as a scam" } ] }, @@ -2038,7 +2152,7 @@ }, { "name": "messageForwardOriginHiddenUser", - "description": "The message was originally written by a user, which is hidden by his privacy settings", + "description": "The message was originally written by a user, which is hidden by their privacy settings", "class": "MessageForwardOrigin", "properties": [ { @@ -2088,12 +2202,12 @@ { "name": "from_chat_id", "type": "int53", - "description": "For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded last time; 0 if unknown" + "description": "For messages forwarded to the chat with the current user (saved messages) or to the channel discussion supergroup, the identifier of the chat from which the message was forwarded last time; 0 if unknown" }, { "name": "from_message_id", "type": "int53", - "description": "For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded last time; 0 if unknown" + "description": "For messages forwarded to the chat with the current user (saved messages) or to the channel discussion supergroup, the identifier of the original message from which the new message was forwarded last time; 0 if unknown" } ] }, @@ -2107,7 +2221,28 @@ "name": "messageSendingStateFailed", "description": "The message failed to be sent", "class": "MessageSendingState", - "properties": [] + "properties": [ + { + "name": "error_code", + "type": "int32", + "description": "An error code; 0 if unknown" + }, + { + "name": "error_message", + "type": "string", + "description": "Error message" + }, + { + "name": "can_retry", + "type": "Bool", + "description": "True, if the message can be re-sent" + }, + { + "name": "retry_after", + "type": "double", + "description": "Time left before the message can be re-sent, in seconds. No update is sent when this field changes" + } + ] }, { "name": "message", @@ -2122,7 +2257,7 @@ { "name": "sender_user_id", "type": "int32", - "description": "Identifier of the user who sent the message; 0 if unknown. It is unknown for channel posts" + "description": "Identifier of the user who sent the message; 0 if unknown. Currently, it is unknown for channel posts and for channel posts automatically forwarded to discussion group" }, { "name": "chat_id", @@ -2472,6 +2607,11 @@ "type": "chatPhoto", "description": "Chat photo; may be null" }, + { + "name": "permissions", + "type": "chatPermissions", + "description": "Actions that non-administrator chat members are allowed to take in the chat" + }, { "name": "last_message", "type": "message", @@ -2626,7 +2766,7 @@ { "name": "is_public", "type": "Bool", - "description": "True, if the chat is a public supergroup or channel with a username" + "description": "True, if the chat is a public supergroup or a channel with a username" } ] }, @@ -2677,6 +2817,28 @@ } ] }, + { + "name": "inlineKeyboardButtonTypeLoginUrl", + "description": "A button that opens a specified URL and automatically logs in in current user if they allowed to do that", + "class": "InlineKeyboardButtonType", + "properties": [ + { + "name": "url", + "type": "string", + "description": "HTTP URL to open" + }, + { + "name": "id", + "type": "int32", + "description": "Unique button identifier" + }, + { + "name": "forward_text", + "type": "string", + "description": "If non-empty, new text of the button in forwarded messages" + } + ] + }, { "name": "inlineKeyboardButtonTypeCallback", "description": "A button that sends a special callback query to a bot", @@ -2970,12 +3132,12 @@ { "name": "width", "type": "int32", - "description": "Width of a bounding box in which the image should be shown, 0 if unknown" + "description": "Width of a bounding box in which the image should be shown; 0 if unknown" }, { "name": "height", "type": "int32", - "description": "Height of a bounding box in which the image should be shown, 0 if unknown" + "description": "Height of a bounding box in which the image should be shown; 0 if unknown" } ] }, @@ -3457,12 +3619,12 @@ { "name": "width", "type": "int32", - "description": "Block width, 0 if unknown" + "description": "Block width; 0 if unknown" }, { "name": "height", "type": "int32", - "description": "Block height, 0 if unknown" + "description": "Block height; 0 if unknown" }, { "name": "caption", @@ -3499,7 +3661,7 @@ { "name": "author_photo", "type": "photo", - "description": "Post author photo" + "description": "Post author photo; may be null" }, { "name": "date", @@ -6374,6 +6536,16 @@ "name": "in_game_share", "type": "Bool", "description": "True, if a game message should be shared within a launched game; applies only to game messages" + }, + { + "name": "send_copy", + "type": "Bool", + "description": "True, if content of the message needs to be copied without a link to the original message. Always true if the message is forwarded to a secret chat" + }, + { + "name": "remove_caption", + "type": "Bool", + "description": "True, if media caption of the message copy needs to be removed. Ignored if send_copy is false" } ] }, @@ -6642,9 +6814,9 @@ ] }, { - "name": "stickerEmojis", - "description": "Represents a list of all emoji corresponding to a sticker in a sticker set. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object", - "class": "StickerEmojis", + "name": "emojis", + "description": "Represents a list of emoji", + "class": "Emojis", "properties": [ { "name": "emojis", @@ -6673,6 +6845,11 @@ "type": "string", "description": "Name of the sticker set" }, + { + "name": "thumbnail", + "type": "photoSize", + "description": "Sticker set thumbnail in WEBP format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed" + }, { "name": "is_installed", "type": "Bool", @@ -6688,6 +6865,11 @@ "type": "Bool", "description": "True, if the sticker set is official" }, + { + "name": "is_animated", + "type": "Bool", + "description": "True, is the stickers in the set are animated" + }, { "name": "is_masks", "type": "Bool", @@ -6705,8 +6887,8 @@ }, { "name": "emojis", - "type": "vector\u003cstickerEmojis\u003e", - "description": "A list of emoji corresponding to the stickers in the same order" + "type": "vector\u003cemojis\u003e", + "description": "A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object" } ] }, @@ -6730,6 +6912,11 @@ "type": "string", "description": "Name of the sticker set" }, + { + "name": "thumbnail", + "type": "photoSize", + "description": "Sticker set thumbnail in WEBP format with width and height 100; may be null" + }, { "name": "is_installed", "type": "Bool", @@ -6745,6 +6932,11 @@ "type": "Bool", "description": "True, if the sticker set is official" }, + { + "name": "is_animated", + "type": "Bool", + "description": "True, is the stickers in the set are animated" + }, { "name": "is_masks", "type": "Bool", @@ -6985,6 +7177,48 @@ } ] }, + { + "name": "callProblemEcho", + "description": "The user heard their own voice", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemNoise", + "description": "The user heard background noise", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemInterruptions", + "description": "The other side kept disappearing", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemDistortedSpeech", + "description": "The speech was distorted", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemSilentLocal", + "description": "The user couldn't hear the other side", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemSilentRemote", + "description": "The other side couldn't hear the user", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemDropped", + "description": "The call ended unexpectedly", + "class": "CallProblem", + "properties": [] + }, { "name": "call", "description": "Describes a call", @@ -7012,6 +7246,28 @@ } ] }, + { + "name": "phoneNumberAuthenticationSettings", + "description": "Contains settings for the authentication of the user's phone number", + "class": "PhoneNumberAuthenticationSettings", + "properties": [ + { + "name": "allow_flash_call", + "type": "Bool", + "description": "Pass true if the authentication code may be sent via flash call to the specified phone number" + }, + { + "name": "is_current_phone_number", + "type": "Bool", + "description": "Pass true if the authenticated phone number is used on the current device" + }, + { + "name": "allow_sms_retriever_api", + "type": "Bool", + "description": "For official applications only. True, if the app can use Android SMS Retriever API (requires Google Play Services \u003e= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details" + } + ] + }, { "name": "animations", "description": "Represents a list of animations", @@ -7483,7 +7739,7 @@ }, { "name": "inputInlineQueryResultSticker", - "description": "Represents a link to a WEBP sticker", + "description": "Represents a link to a WEBP or a TGS sticker", "class": "InputInlineQueryResult", "properties": [ { @@ -7499,7 +7755,7 @@ { "name": "sticker_url", "type": "string", - "description": "The URL of the WEBP sticker (sticker file size must not exceed 5MB)" + "description": "The URL of the WEBP or a TGS sticker (sticker file size must not exceed 5MB)" }, { "name": "sticker_width", @@ -8101,6 +8357,18 @@ } ] }, + { + "name": "chatEventPollStopped", + "description": "A poll in a message was stopped", + "class": "ChatEventAction", + "properties": [ + { + "name": "message", + "type": "message", + "description": "The message with the poll" + } + ] + }, { "name": "chatEventMessagePinned", "description": "A message was pinned", @@ -8209,6 +8477,23 @@ } ] }, + { + "name": "chatEventPermissionsChanged", + "description": "The chat permissions was changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_permissions", + "type": "chatPermissions", + "description": "Previous chat permissions" + }, + { + "name": "new_permissions", + "type": "chatPermissions", + "description": "New chat permissions" + } + ] + }, { "name": "chatEventDescriptionChanged", "description": "The chat description was changed", @@ -8250,25 +8535,25 @@ "properties": [ { "name": "old_photo", - "type": "chatPhoto", + "type": "photo", "description": "Previous chat photo value; may be null" }, { "name": "new_photo", - "type": "chatPhoto", + "type": "photo", "description": "New chat photo value; may be null" } ] }, { "name": "chatEventInvitesToggled", - "description": "The anyone_can_invite setting of a supergroup chat was toggled", + "description": "The can_invite_users permission of a supergroup chat was toggled", "class": "ChatEventAction", "properties": [ { - "name": "anyone_can_invite", + "name": "can_invite_users", "type": "Bool", - "description": "New value of anyone_can_invite" + "description": "New value of can_invite_users permission" } ] }, @@ -8752,36 +9037,126 @@ ] }, { - "name": "wallpaper", - "description": "Contains information about a wallpaper", - "class": "Wallpaper", + "name": "backgroundTypeWallpaper", + "description": "A wallpaper in JPEG format", + "class": "BackgroundType", "properties": [ { - "name": "id", - "type": "int32", - "description": "Unique persistent wallpaper identifier" + "name": "is_blurred", + "type": "Bool", + "description": "True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12" }, { - "name": "sizes", - "type": "vector\u003cphotoSize\u003e", - "description": "Available variants of the wallpaper in different sizes. These photos can only be downloaded; they can't be sent in a message" - }, - { - "name": "color", - "type": "int32", - "description": "Main color of the wallpaper in RGB24 format; should be treated as background color if no photos are specified" + "name": "is_moving", + "type": "Bool", + "description": "True, if the background needs to be slightly moved when device is rotated" } ] }, { - "name": "wallpapers", - "description": "Contains a list of wallpapers", - "class": "Wallpapers", + "name": "backgroundTypePattern", + "description": "A PNG pattern to be combined with the color chosen by the user", + "class": "BackgroundType", "properties": [ { - "name": "wallpapers", - "type": "vector\u003cwallpaper\u003e", - "description": "A list of wallpapers" + "name": "is_moving", + "type": "Bool", + "description": "True, if the background needs to be slightly moved when device is rotated" + }, + { + "name": "color", + "type": "int32", + "description": "Main color of the background in RGB24 format" + }, + { + "name": "intensity", + "type": "int32", + "description": "Intensity of the pattern when it is shown above the main background color, 0-100" + } + ] + }, + { + "name": "backgroundTypeSolid", + "description": "A solid background", + "class": "BackgroundType", + "properties": [ + { + "name": "color", + "type": "int32", + "description": "A color of the background in RGB24 format" + } + ] + }, + { + "name": "background", + "description": "Describes a chat background", + "class": "Background", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique background identifier" + }, + { + "name": "is_default", + "type": "Bool", + "description": "True, if this is one of default backgrounds" + }, + { + "name": "is_dark", + "type": "Bool", + "description": "True, if the background is dark and is recommended to be used with dark theme" + }, + { + "name": "name", + "type": "string", + "description": "Unique background name" + }, + { + "name": "document", + "type": "document", + "description": "Document with the background; may be null. Null only for solid backgrounds" + }, + { + "name": "type", + "type": "BackgroundType", + "description": "Type of the background" + } + ] + }, + { + "name": "backgrounds", + "description": "Contains a list of backgrounds", + "class": "Backgrounds", + "properties": [ + { + "name": "backgrounds", + "type": "vector\u003cbackground\u003e", + "description": "A list of backgrounds" + } + ] + }, + { + "name": "inputBackgroundLocal", + "description": "A background from a local file", + "class": "InputBackground", + "properties": [ + { + "name": "background", + "type": "InputFile", + "description": "Background file to use. Only inputFileLocal and inputFileGenerated are supported. The file nust be in JPEG format for wallpapers and in PNG format for patterns" + } + ] + }, + { + "name": "inputBackgroundRemote", + "description": "A background from the server", + "class": "InputBackground", + "properties": [ + { + "name": "background_id", + "type": "int64", + "description": "The background identifier" } ] }, @@ -8817,7 +9192,7 @@ }, { "name": "checkChatUsernameResultPublicChatsTooMuch", - "description": "The user has too much public chats, one of them should be made private first", + "description": "The user has too much chats with username, one of them should be made private first", "class": "CheckChatUsernameResult", "properties": [] }, @@ -8841,7 +9216,7 @@ }, { "name": "pushMessageContentAnimation", - "description": "An animation message (GIF-style)", + "description": "An animation message (GIF-style).", "class": "PushMessageContent", "properties": [ { @@ -9570,6 +9945,18 @@ "class": "UserPrivacySetting", "properties": [] }, + { + "name": "userPrivacySettingShowProfilePhoto", + "description": "A privacy setting for managing whether the user's profile photo is visible", + "class": "UserPrivacySetting", + "properties": [] + }, + { + "name": "userPrivacySettingShowLinkInForwardedMessages", + "description": "A privacy setting for managing whether a link to the user's account is included in forwarded messages", + "class": "UserPrivacySetting", + "properties": [] + }, { "name": "userPrivacySettingAllowChatInvites", "description": "A privacy setting for managing whether the user can be invited to chats", @@ -9814,7 +10201,7 @@ }, { "name": "publicMessageLink", - "description": "Contains a public HTTPS link to a message in a public supergroup or channel", + "description": "Contains a public HTTPS link to a message in a public supergroup or channel with a username", "class": "PublicMessageLink", "properties": [ { @@ -9829,6 +10216,33 @@ } ] }, + { + "name": "messageLinkInfo", + "description": "Contains information about a link to a message in a chat", + "class": "MessageLinkInfo", + "properties": [ + { + "name": "is_public", + "type": "Bool", + "description": "True, if the link is a public link for a message in a chat" + }, + { + "name": "chat_id", + "type": "int53", + "description": "If found, identifier of the chat to which the message belongs, 0 otherwise" + }, + { + "name": "message", + "type": "message", + "description": "If found, the linked message; may be null" + }, + { + "name": "for_album", + "type": "Bool", + "description": "True, if the whole media album to which the message belongs is linked" + } + ] + }, { "name": "filePart", "description": "Contains a part of a file", @@ -9933,7 +10347,7 @@ }, { "name": "fileTypeWallpaper", - "description": "The file is a wallpaper", + "description": "The file is a wallpaper or a background pattern", "class": "FileType", "properties": [] }, @@ -10153,9 +10567,73 @@ } ] }, + { + "name": "autoDownloadSettings", + "description": "Contains auto-download settings", + "class": "AutoDownloadSettings", + "properties": [ + { + "name": "is_auto_download_enabled", + "type": "Bool", + "description": "True, if the auto-download is enabled" + }, + { + "name": "max_photo_file_size", + "type": "int32", + "description": "Maximum size of a photo file to be auto-downloaded" + }, + { + "name": "max_video_file_size", + "type": "int32", + "description": "Maximum size of a video file to be auto-downloaded" + }, + { + "name": "max_other_file_size", + "type": "int32", + "description": "Maximum size of other file types to be auto-downloaded" + }, + { + "name": "preload_large_videos", + "type": "Bool", + "description": "True, if the beginning of videos needs to be preloaded for instant playback" + }, + { + "name": "preload_next_audio", + "type": "Bool", + "description": "True, if the next audio track needs to be preloaded while the user is listening to an audio file" + }, + { + "name": "use_less_data_for_calls", + "type": "Bool", + "description": "True, if \"use less data for calls\" option needs to be enabled" + } + ] + }, + { + "name": "autoDownloadSettingsPresets", + "description": "Contains auto-download settings presets for the user", + "class": "AutoDownloadSettingsPresets", + "properties": [ + { + "name": "low", + "type": "autoDownloadSettings", + "description": "Preset with lowest settings; supposed to be used by default when roaming" + }, + { + "name": "medium", + "type": "autoDownloadSettings", + "description": "Preset with medium settings; supposed to be used by default when using mobile data" + }, + { + "name": "high", + "type": "autoDownloadSettings", + "description": "Preset with highest settings; supposed to be used by default when connected on Wi-Fi" + } + ] + }, { "name": "connectionStateWaitingForNetwork", - "description": "Currently waiting for the network to become available. Use SetNetworkType to change the available network type", + "description": "Currently waiting for the network to become available. Use setNetworkType to change the available network type", "class": "ConnectionState", "properties": [] }, @@ -10549,7 +11027,7 @@ { "name": "message", "type": "message", - "description": "Contains information about the message that failed to send" + "description": "Contains information about the message which failed to send" }, { "name": "old_message_id", @@ -10724,6 +11202,23 @@ } ] }, + { + "name": "updateChatPermissions", + "description": "Chat permissions was changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "permissions", + "type": "chatPermissions", + "description": "The new chat permissions" + } + ] + }, { "name": "updateChatLastMessage", "description": "The last message of a chat was changed. If last_message is null then the last message in the chat became unknown. Some new unknown messages might be added to the chat in this case", @@ -11490,6 +11985,23 @@ } ] }, + { + "name": "updateSelectedBackground", + "description": "The selected background has changed", + "class": "Update", + "properties": [ + { + "name": "for_dark_theme", + "type": "Bool", + "description": "True, if background for dark theme has changed" + }, + { + "name": "background", + "type": "background", + "description": "The new selected background; may be null" + } + ] + }, { "name": "updateLanguagePackStrings", "description": "Some language pack strings have been updated", @@ -12080,6 +12592,10 @@ "name": "CallState", "description": "Describes the current call state" }, + { + "name": "CallProblem", + "description": "Describes the exact type of a problem with a call" + }, { "name": "InputInlineQueryResult", "description": "Represents a single result of an inline query; for bots only" @@ -12104,6 +12620,14 @@ "name": "DeviceToken", "description": "Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, you must specify the correct application platform and upload valid server authentication data at https://my.telegram.org" }, + { + "name": "BackgroundType", + "description": "Describes a type of a background" + }, + { + "name": "InputBackground", + "description": "Contains information about background to set" + }, { "name": "CheckChatUsernameResult", "description": "Represents result of checking whether a username can be set for a chat" @@ -12220,7 +12744,7 @@ }, { "name": "setAuthenticationPhoneNumber", - "description": "Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber", + "description": "Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode or authorizationStateWaitPassword", "class": "Ok", "properties": [ { @@ -12229,14 +12753,9 @@ "description": "The phone number of the user, in international format" }, { - "name": "allow_flash_call", - "type": "Bool", - "description": "Pass true if the authentication code may be sent via flash call to the specified phone number" - }, - { - "name": "is_current_phone_number", - "type": "Bool", - "description": "Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false" + "name": "settings", + "type": "phoneNumberAuthenticationSettings", + "description": "Settings for the authentication of the user's phone number" } ], "is_synchronous": false, @@ -12259,16 +12778,25 @@ "name": "code", "type": "string", "description": "The verification code received via SMS, Telegram message, phone call, or flash call" - }, + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "registerUser", + "description": "Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration", + "class": "Ok", + "properties": [ { "name": "first_name", "type": "string", - "description": "If the user is not yet registered, the first name of the user; 1-64 characters. You can also pass an empty string for unregistered user there to check verification code validness. In the latter case PHONE_NUMBER_UNOCCUPIED error will be returned for a valid code" + "description": "The first name of the user; 1-64 characters" }, { "name": "last_name", "type": "string", - "description": "If the user is not yet registered; the last name of the user; optional; 0-64 characters" + "description": "The last name of the user; 0-64 characters" } ], "is_synchronous": false, @@ -12428,7 +12956,7 @@ }, { "name": "setRecoveryEmailAddress", - "description": "Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation", + "description": "Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed. If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation", "class": "PasswordState", "properties": [ { @@ -12761,7 +13289,7 @@ }, { "name": "getChats", - "description": "Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). For optimal performance the number of returned chats is chosen by the library.", + "description": "Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). For optimal performance the number of returned chats is chosen by the library", "class": "Chats", "properties": [ { @@ -12944,7 +13472,7 @@ }, { "name": "getCreatedPublicChats", - "description": "Returns a list of public chats created by the user", + "description": "Returns a list of public chats with username created by the user", "class": "Chats", "properties": [], "is_synchronous": false, @@ -13278,7 +13806,7 @@ }, { "name": "getPublicMessageLink", - "description": "Returns a public HTTPS link to a message. Available only for messages in public supergroups and channels", + "description": "Returns a public HTTPS link to a message. Available only for messages in supergroups and channels with username", "class": "PublicMessageLink", "properties": [ { @@ -13319,6 +13847,20 @@ "is_synchronous": false, "type": 2 }, + { + "name": "getMessageLinkInfo", + "description": "Returns information about a public or private message link", + "class": "MessageLinkInfo", + "properties": [ + { + "name": "url", + "type": "string", + "description": "The message link in the format \"https://t.me/c/...\", or \"tg://privatepost?...\", or \"https://t.me/username/...\", or \"tg://resolve?...\"" + } + ], + "is_synchronous": false, + "type": 1 + }, { "name": "sendMessage", "description": "Sends a message. Returns the sent message", @@ -13410,7 +13952,7 @@ { "name": "parameter", "type": "string", - "description": "A hidden parameter sent to the bot for deep linking purposes (https://api.telegram.org/bots#deep-linking)" + "description": "A hidden parameter sent to the bot for deep linking purposes (https://core.telegram.org/bots#deep-linking)" } ], "is_synchronous": false, @@ -13488,12 +14030,41 @@ { "name": "from_background", "type": "Bool", - "description": "Pass true if the message is sent from the background" + "description": "Pass true if the messages are sent from the background" }, { "name": "as_album", "type": "Bool", "description": "True, if the messages should be grouped into an album after forwarding. For this to work, no more than 10 messages may be forwarded, and all of them must be photo or video messages" + }, + { + "name": "send_copy", + "type": "Bool", + "description": "True, if content of the messages needs to be copied without links to the original messages. Always true if the messages are forwarded to a secret chat" + }, + { + "name": "remove_caption", + "type": "Bool", + "description": "True, if media captions of message copies needs to be removed. Ignored if send_copy is false" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "resendMessages", + "description": "Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message", + "class": "Messages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to send messages" + }, + { + "name": "message_ids", + "type": "vector\u003cint53\u003e", + "description": "Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order" } ], "is_synchronous": false, @@ -14592,7 +15163,7 @@ }, { "name": "upgradeBasicGroupChatToSupergroupChat", - "description": "Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom. Deactivates the original basic group", + "description": "Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group", "class": "Chat", "properties": [ { @@ -14606,7 +15177,7 @@ }, { "name": "setChatTitle", - "description": "Changes the chat title. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The title will not be changed until the request to the server has been completed", + "description": "Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info rights. The title will not be changed until the request to the server has been completed", "class": "Ok", "properties": [ { @@ -14625,7 +15196,7 @@ }, { "name": "setChatPhoto", - "description": "Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The photo will not be changed before request to the server has been completed", + "description": "Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info rights. The photo will not be changed before request to the server has been completed", "class": "Ok", "properties": [ { @@ -14642,6 +15213,25 @@ "is_synchronous": false, "type": 1 }, + { + "name": "setChatPermissions", + "description": "Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "permissions", + "type": "chatPermissions", + "description": "New non-administrator members permissions in the chat" + } + ], + "is_synchronous": false, + "type": 1 + }, { "name": "setChatDraftMessage", "description": "Changes the draft message in a chat", @@ -14756,9 +15346,28 @@ "is_synchronous": false, "type": 1 }, + { + "name": "setChatDescription", + "description": "Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info rights", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat" + }, + { + "name": "description", + "type": "string", + "description": "New chat description; 0-255 characters" + } + ], + "is_synchronous": false, + "type": 1 + }, { "name": "pinChatMessage", - "description": "Pins a message in a chat; requires appropriate administrator rights in the group or channel", + "description": "Pins a message in a chat; requires can_pin_messages rights", "class": "Ok", "properties": [ { @@ -14782,7 +15391,7 @@ }, { "name": "unpinChatMessage", - "description": "Removes the pinned message from a chat; requires appropriate administrator rights in the group or channel", + "description": "Removes the pinned message from a chat; requires can_pin_messages rights in the group or channel", "class": "Ok", "properties": [ { @@ -15256,7 +15865,7 @@ }, { "name": "generateChatInviteLink", - "description": "Generates a new invite link for a chat; the previously generated link is revoked. Available for basic groups, supergroups, and channels. In basic groups this can be called only by the group's creator; in supergroups and channels this requires appropriate administrator rights", + "description": "Generates a new invite link for a chat; the previously generated link is revoked. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right", "class": "ChatInviteLink", "properties": [ { @@ -15382,6 +15991,11 @@ "name": "comment", "type": "string", "description": "An optional user comment if the rating is less than 5" + }, + { + "name": "problems", + "type": "vector\u003cCallProblem\u003e", + "description": "List of the exact types of problems with the call, specified by the user" } ], "is_synchronous": false, @@ -15887,8 +16501,8 @@ }, { "name": "getStickerEmojis", - "description": "Returns emoji corresponding to a sticker", - "class": "StickerEmojis", + "description": "Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object", + "class": "Emojis", "properties": [ { "name": "sticker", @@ -15899,6 +16513,39 @@ "is_synchronous": false, "type": 2 }, + { + "name": "searchEmojis", + "description": "Searches for emojis by keywords. Supported only if the file database is enabled", + "class": "Emojis", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Text to search for" + }, + { + "name": "exact_match", + "type": "Bool", + "description": "True, if only emojis, which exactly match text needs to be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getEmojiSuggestionsUrl", + "description": "Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation", + "class": "HttpUrl", + "properties": [ + { + "name": "language_code", + "type": "string", + "description": "Language code for which the emoji replacements will be suggested" + } + ], + "is_synchronous": false, + "type": 2 + }, { "name": "getSavedAnimations", "description": "Returns saved animations", @@ -16095,14 +16742,9 @@ "description": "The new phone number of the user in international format" }, { - "name": "allow_flash_call", - "type": "Bool", - "description": "Pass true if the code can be sent via flash call to the specified phone number" - }, - { - "name": "is_current_phone_number", - "type": "Bool", - "description": "Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false" + "name": "settings", + "type": "phoneNumberAuthenticationSettings", + "description": "Settings for the authentication of the user's phone number" } ], "is_synchronous": false, @@ -16190,25 +16832,6 @@ "is_synchronous": false, "type": 2 }, - { - "name": "toggleBasicGroupAdministrators", - "description": "Toggles the \"All members are admins\" setting in basic groups; requires creator privileges in the group", - "class": "Ok", - "properties": [ - { - "name": "basic_group_id", - "type": "int32", - "description": "Identifier of the basic group" - }, - { - "name": "everyone_is_administrator", - "type": "Bool", - "description": "New value of everyone_is_administrator" - } - ], - "is_synchronous": false, - "type": 2 - }, { "name": "setSupergroupUsername", "description": "Changes the username of a supergroup or channel, requires creator privileges in the supergroup or channel", @@ -16230,7 +16853,7 @@ }, { "name": "setSupergroupStickerSet", - "description": "Changes the sticker set of a supergroup; requires appropriate rights in the supergroup", + "description": "Changes the sticker set of a supergroup; requires can_change_info rights", "class": "Ok", "properties": [ { @@ -16247,28 +16870,9 @@ "is_synchronous": false, "type": 1 }, - { - "name": "toggleSupergroupInvites", - "description": "Toggles whether all members of a supergroup can add new members; requires appropriate administrator rights in the supergroup.", - "class": "Ok", - "properties": [ - { - "name": "supergroup_id", - "type": "int32", - "description": "Identifier of the supergroup" - }, - { - "name": "anyone_can_invite", - "type": "Bool", - "description": "New value of anyone_can_invite" - } - ], - "is_synchronous": false, - "type": 2 - }, { "name": "toggleSupergroupSignMessages", - "description": "Toggles sender signatures messages sent in a channel; requires appropriate administrator rights in the channel.", + "description": "Toggles sender signatures messages sent in a channel; requires can_change_info rights", "class": "Ok", "properties": [ { @@ -16287,7 +16891,7 @@ }, { "name": "toggleSupergroupIsAllHistoryAvailable", - "description": "Toggles whether the message history of a supergroup is available to new members; requires appropriate administrator rights in the supergroup.", + "description": "Toggles whether the message history of a supergroup is available to new members; requires can_change_info rights", "class": "Ok", "properties": [ { @@ -16304,25 +16908,6 @@ "is_synchronous": false, "type": 2 }, - { - "name": "setSupergroupDescription", - "description": "Changes information about a supergroup or channel; requires appropriate administrator rights", - "class": "Ok", - "properties": [ - { - "name": "supergroup_id", - "type": "int32", - "description": "Identifier of the supergroup or channel" - }, - { - "name": "description", - "type": "string", - "description": "New supergroup or channel description; 0-255 characters" - } - ], - "is_synchronous": false, - "type": 1 - }, { "name": "reportSupergroupSpam", "description": "Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup", @@ -16577,9 +17162,94 @@ "type": 2 }, { - "name": "getWallpapers", - "description": "Returns background wallpapers", - "class": "Wallpapers", + "name": "getBackgrounds", + "description": "Returns backgrounds installed by the user", + "class": "Backgrounds", + "properties": [ + { + "name": "for_dark_theme", + "type": "Bool", + "description": "True, if the backgrounds needs to be ordered for dark theme" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getBackgroundUrl", + "description": "Constructs a persistent HTTP URL for a background", + "class": "HttpUrl", + "properties": [ + { + "name": "name", + "type": "string", + "description": "Background name" + }, + { + "name": "type", + "type": "BackgroundType", + "description": "Background type" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchBackground", + "description": "Searches for a background by its name", + "class": "Background", + "properties": [ + { + "name": "name", + "type": "string", + "description": "The name of the background" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setBackground", + "description": "Changes the background selected by the user; adds background to the list of installed backgrounds", + "class": "Background", + "properties": [ + { + "name": "background", + "type": "InputBackground", + "description": "The input background to use, null for solid backgrounds" + }, + { + "name": "type", + "type": "BackgroundType", + "description": "Background type; null for default background. The method will return error 404 if type is null" + }, + { + "name": "for_dark_theme", + "type": "Bool", + "description": "True, if the background is chosen for dark theme" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeBackground", + "description": "Removes background from the list of installed backgrounds", + "class": "Ok", + "properties": [ + { + "name": "background_id", + "type": "int64", + "description": "The background indentifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "resetBackgrounds", + "description": "Resets list of installed backgrounds to its default value", + "class": "Ok", "properties": [], "is_synchronous": false, "type": 2 @@ -16947,7 +17617,7 @@ }, { "name": "getChatStatisticsUrl", - "description": "Returns URL with the chat statistics. Currently this method can be used only for channels", + "description": "Returns an HTTP URL with the chat statistics. Currently this method can be used only for channels", "class": "HttpUrl", "properties": [ { @@ -17098,6 +17768,33 @@ "is_synchronous": false, "type": 1 }, + { + "name": "getAutoDownloadSettingsPresets", + "description": "Returns auto-download settings presets for the currently logged in user", + "class": "AutoDownloadSettingsPresets", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setAutoDownloadSettings", + "description": "Sets auto-download settings", + "class": "Ok", + "properties": [ + { + "name": "settings", + "type": "autoDownloadSettings", + "description": "New user auto-download settings" + }, + { + "name": "type", + "type": "NetworkType", + "description": "Type of the network for which the new settings are applied" + } + ], + "is_synchronous": false, + "type": 2 + }, { "name": "getPassportElement", "description": "Returns one of the available Telegram Passport elements", @@ -17208,14 +17905,9 @@ "description": "The phone number of the user, in international format" }, { - "name": "allow_flash_call", - "type": "Bool", - "description": "Pass true if the authentication code may be sent via flash call to the specified phone number" - }, - { - "name": "is_current_phone_number", - "type": "Bool", - "description": "Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false" + "name": "settings", + "type": "phoneNumberAuthenticationSettings", + "description": "Settings for the authentication of the user's phone number" } ], "is_synchronous": false, @@ -17362,14 +18054,9 @@ "description": "Value of the \"phone\" parameter from the link" }, { - "name": "allow_flash_call", - "type": "Bool", - "description": "Pass true if the authentication code may be sent via flash call to the specified phone number" - }, - { - "name": "is_current_phone_number", - "type": "Bool", - "description": "Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false" + "name": "settings", + "type": "phoneNumberAuthenticationSettings", + "description": "Settings for the authentication of the user's phone number" } ], "is_synchronous": false, @@ -17633,7 +18320,7 @@ }, { "name": "getCountryCode", - "description": "Uses current user IP to found his country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization", + "description": "Uses current user IP to found their country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization", "class": "Text", "properties": [], "is_synchronous": false, @@ -18046,6 +18733,30 @@ "is_synchronous": false, "type": 1 }, + { + "name": "testProxy", + "description": "Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "server", + "type": "string", + "description": "Proxy server IP address" + }, + { + "name": "port", + "type": "int32", + "description": "Proxy server port" + }, + { + "name": "type", + "type": "ProxyType", + "description": "Proxy type" + } + ], + "is_synchronous": false, + "type": 1 + }, { "name": "testGetDifference", "description": "Forces an updates.getDifference call to the Telegram servers; for testing only", @@ -18063,11 +18774,17 @@ "type": 1 }, { - "name": "testUseError", - "description": "Does nothing and ensures that the Error object is used; for testing only. This is an offline method. Can be called before authorization", + "name": "testReturnError", + "description": "Returns the specified error and ensures that the Error object is used; for testing only. This is an offline method. Can be called before authorization. Can be called synchronously", "class": "Error", - "properties": [], - "is_synchronous": false, + "properties": [ + { + "name": "error", + "type": "error", + "description": "The error to be returned" + } + ], + "is_synchronous": true, "type": 1 } ] diff --git a/data/td_api.tl b/data/td_api.tl index c758b8e..1ef5a6b 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -73,7 +73,7 @@ textEntities entities:vector = TextEntities; formattedText text:string entities:vector = FormattedText; -//@description Contains Telegram terms of service @text Text of the terms of service @min_user_age Mininum age of a user to be able to accept the terms; 0 if any @show_popup True, if a blocking popup with terms of service must be shown to the user +//@description Contains Telegram terms of service @text Text of the terms of service @min_user_age Minimum age of a user to be able to accept the terms; 0 if any @show_popup True, if a blocking popup with terms of service must be shown to the user termsOfService text:formattedText min_user_age:int32 show_popup:Bool = TermsOfService; @@ -88,10 +88,13 @@ authorizationStateWaitEncryptionKey is_encrypted:Bool = AuthorizationState; //@description TDLib needs the user's phone number to authorize authorizationStateWaitPhoneNumber = AuthorizationState; -//@description TDLib needs the user's authentication code to finalize authorization @is_registered True, if the user is already registered @terms_of_service Telegram terms of service, which should be accepted before user can continue registration; may be null @code_info Information about the authorization code that was sent -authorizationStateWaitCode is_registered:Bool terms_of_service:termsOfService code_info:authenticationCodeInfo = AuthorizationState; +//@description TDLib needs the user's authentication code to authorize @code_info Information about the authorization code that was sent +authorizationStateWaitCode code_info:authenticationCodeInfo = AuthorizationState; -//@description The user has been authorized, but needs to enter a password to start using the application @password_hint Hint for the password; may be empty @has_recovery_email_address True if a recovery email address has been set up +//@description The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration @terms_of_service Telegram terms of service +authorizationStateWaitRegistration terms_of_service:termsOfService = AuthorizationState; + +//@description The user has been authorized, but needs to enter a password to start using the application @password_hint Hint for the password; may be empty @has_recovery_email_address True, if a recovery email address has been set up //@recovery_email_address_pattern Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent authorizationStateWaitPassword password_hint:string has_recovery_email_address:Bool recovery_email_address_pattern:string = AuthorizationState; @@ -170,6 +173,9 @@ inputFileGenerated original_path:string conversion:string expected_size:int32 = //@description Photo description @type Thumbnail type (see https://core.telegram.org/constructor/photoSize) @photo Information about the photo file @width Photo width @height Photo height photoSize type:string photo:file width:int32 height:int32 = PhotoSize; +//@description Thumbnail image of a very poor quality and low resolution @width Thumbnail width, usually doesn't exceed 40 @height Thumbnail height, usually doesn't exceed 40 @data The thumbnail in JPEG format +minithumbnail width:int32 height:int32 data:bytes = Minithumbnail; + //@class MaskPoint @description Part of the face, relative to which a mask should be placed @@ -198,31 +204,32 @@ pollOption text:string voter_count:int32 vote_percentage:int32 is_chosen:Bool is //@description Describes an animation file. The animation must be encoded in GIF or MPEG4 format @duration Duration of the animation, in seconds; as defined by the sender @width Width of the animation @height Height of the animation -//@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file, usually "image/gif" or "video/mp4" @thumbnail Animation thumbnail; may be null @animation File containing the animation -animation duration:int32 width:int32 height:int32 file_name:string mime_type:string thumbnail:photoSize animation:file = Animation; +//@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file, usually "image/gif" or "video/mp4" +//@minithumbnail Animation minithumbnail; may be null @thumbnail Animation thumbnail; may be null @animation File containing the animation +animation duration:int32 width:int32 height:int32 file_name:string mime_type:string minithumbnail:minithumbnail thumbnail:photoSize animation:file = Animation; //@description Describes an audio file. Audio is usually in MP3 format @duration Duration of the audio, in seconds; as defined by the sender @title Title of the audio; as defined by the sender @performer Performer of the audio; as defined by the sender -//@file_name Original name of the file; as defined by the sender @mime_type The MIME type of the file; as defined by the sender @album_cover_thumbnail The thumbnail of the album cover; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null @audio File containing the audio -audio duration:int32 title:string performer:string file_name:string mime_type:string album_cover_thumbnail:photoSize audio:file = Audio; +//@file_name Original name of the file; as defined by the sender @mime_type The MIME type of the file; as defined by the sender @album_cover_minithumbnail The minithumbnail of the album cover; may be null @album_cover_thumbnail The thumbnail of the album cover; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null @audio File containing the audio +audio duration:int32 title:string performer:string file_name:string mime_type:string album_cover_minithumbnail:minithumbnail album_cover_thumbnail:photoSize audio:file = Audio; //@description Describes a document of any type @file_name Original name of the file; as defined by the sender @mime_type MIME type of the file; as defined by the sender -//@thumbnail Document thumbnail; as defined by the sender; may be null @document File containing the document -document file_name:string mime_type:string thumbnail:photoSize document:file = Document; +//@minithumbnail Document minithumbnail; may be null @thumbnail Document thumbnail in JPEG or PNG format (PNG will be used only for background patterns); as defined by the sender; may be null @document File containing the document +document file_name:string mime_type:string minithumbnail:minithumbnail thumbnail:photoSize document:file = Document; -//@description Describes a photo @has_stickers True, if stickers were added to the photo @sizes Available variants of the photo, in different sizes -photo has_stickers:Bool sizes:vector = Photo; +//@description Describes a photo @has_stickers True, if stickers were added to the photo @minithumbnail Photo minithumbnail; may be null @sizes Available variants of the photo, in different sizes +photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Photo; //@description Describes a sticker @set_id The identifier of the sticker set to which the sticker belongs; 0 if none @width Sticker width; as defined by the sender @height Sticker height; as defined by the sender -//@emoji Emoji corresponding to the sticker @is_mask True, if the sticker is a mask @mask_position Position where the mask should be placed; may be null @thumbnail Sticker thumbnail in WEBP or JPEG format; may be null @sticker File containing the sticker -sticker set_id:int64 width:int32 height:int32 emoji:string is_mask:Bool mask_position:maskPosition thumbnail:photoSize sticker:file = Sticker; +//@emoji Emoji corresponding to the sticker @is_animated True, if the sticker is an animated sticker in TGS format @is_mask True, if the sticker is a mask @mask_position Position where the mask should be placed; may be null @thumbnail Sticker thumbnail in WEBP or JPEG format; may be null @sticker File containing the sticker +sticker set_id:int64 width:int32 height:int32 emoji:string is_animated:Bool is_mask:Bool mask_position:maskPosition thumbnail:photoSize sticker:file = Sticker; //@description Describes a video file @duration Duration of the video, in seconds; as defined by the sender @width Video width; as defined by the sender @height Video height; as defined by the sender //@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file; as defined by the sender @has_stickers True, if stickers were added to the photo -//@supports_streaming True, if the video should be tried to be streamed @thumbnail Video thumbnail; as defined by the sender; may be null @video File containing the video -video duration:int32 width:int32 height:int32 file_name:string mime_type:string has_stickers:Bool supports_streaming:Bool thumbnail:photoSize video:file = Video; +//@supports_streaming True, if the video should be tried to be streamed @minithumbnail Video minithumbnail; may be null @thumbnail Video thumbnail; as defined by the sender; may be null @video File containing the video +video duration:int32 width:int32 height:int32 file_name:string mime_type:string has_stickers:Bool supports_streaming:Bool minithumbnail:minithumbnail thumbnail:photoSize video:file = Video; -//@description Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format @duration Duration of the video, in seconds; as defined by the sender @length Video width and height; as defined by the sender @thumbnail Video thumbnail; as defined by the sender; may be null @video File containing the video -videoNote duration:int32 length:int32 thumbnail:photoSize video:file = VideoNote; +//@description Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format @duration Duration of the video, in seconds; as defined by the sender @length Video width and height; as defined by the sender @minithumbnail Video minithumbnail; may be null @thumbnail Video thumbnail; as defined by the sender; may be null @video File containing the video +videoNote duration:int32 length:int32 minithumbnail:minithumbnail thumbnail:photoSize video:file = VideoNote; //@description Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel @duration Duration of the voice note, in seconds; as defined by the sender //@waveform A waveform representation of the voice note in 5-bit format @mime_type MIME type of the file; as defined by the sender @voice File containing the voice note @@ -247,10 +254,10 @@ poll id:int64 question:string options:vector total_voter_count:int32 //@description Describes a user profile photo @id Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of userProfilePhotos -//@small A small (160x160) user profile photo @big A big (640x640) user profile photo +//@small A small (160x160) user profile photo. The file can be downloaded only before the photo is changed @big A big (640x640) user profile photo. The file can be downloaded only before the photo is changed profilePhoto id:int64 small:file big:file = ProfilePhoto; -//@description Describes the photo of a chat @small A small (160x160) chat photo @big A big (640x640) chat photo +//@description Describes the photo of a chat @small A small (160x160) chat photo. The file can be downloaded only before the photo is changed @big A big (640x640) chat photo. The file can be downloaded only before the photo is changed chatPhoto small:file big:file = ChatPhoto; @@ -296,8 +303,9 @@ botInfo description:string commands:vector = BotInfo; //@is_verified True, if the user is verified @is_support True, if the user is Telegram support account //@restriction_reason If non-empty, it contains the reason why access to this user must be restricted. The format of the string is "{type}: {description}". //-{type} contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user) +//@is_scam True, if many users reported this user as a scam //@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. It can't be passed to any method except GetUser @type Type of the user @language_code IETF language tag of the user's language; only available to bots -user id:int32 first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto outgoing_link:LinkState incoming_link:LinkState is_verified:Bool is_support:Bool restriction_reason:string have_access:Bool type:UserType language_code:string = User; +user id:int32 first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto outgoing_link:LinkState incoming_link:LinkState is_verified:Bool is_support:Bool restriction_reason:string is_scam:Bool have_access:Bool type:UserType language_code:string = User; //@description Contains full information about a user (except the full list of profile photos) @is_blocked True, if the user is blacklisted by the current user @can_be_called True, if the user can be called @has_private_calls True, if the user can't be called due to their privacy settings //@bio A short user bio @share_text For bots, the text that is included with the link when users share the bot @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 @bot_info If the user is a bot, information about the bot; may be null @@ -313,6 +321,18 @@ userProfilePhotos total_count:int32 photos:vector = UserProfil users total_count:int32 user_ids:vector = Users; +//@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_other_messages True, if the user can send animations, games, and stickers and 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_other_messages: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 creator of a chat and has all the administrator privileges @is_member True, if the user is a member of the chat @@ -327,7 +347,7 @@ chatMemberStatusCreator is_member:Bool = ChatMemberStatus; //@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 //@can_pin_messages True, if the administrator can pin messages; applicable to groups only -//@can_promote_members True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that were directly or indirectly promoted by him +//@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 him chatMemberStatusAdministrator can_be_edited: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 = ChatMemberStatus; //@description The user is a member of a chat, without any additional privileges or restrictions @@ -336,11 +356,8 @@ chatMemberStatusMember = ChatMemberStatus; //@description The user is under certain restrictions in the chat. Not supported in basic groups and channels //@is_member True, if the user is a member of the chat //@restricted_until_date Point in time (Unix timestamp) when restrictions will be lifted from the user; 0 if never. If the user is restricted for more than 366 days or for less than 30 seconds from the current time, the user is considered to be restricted forever -//@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_other_messages True, if the user can send animations, games, and stickers and use inline bots. Implies can_send_media_messages permissions -//@can_add_web_page_previews True, if the user may add a web page preview to his messages. Implies can_send_messages permissions -chatMemberStatusRestricted is_member:Bool restricted_until_date:int32 can_send_messages:Bool can_send_media_messages:Bool can_send_other_messages:Bool can_add_web_page_previews:Bool = ChatMemberStatus; +//@permissions User permissions in the chat +chatMemberStatusRestricted is_member:Bool restricted_until_date:int32 permissions:chatPermissions = ChatMemberStatus; //@description The user is not a chat member chatMemberStatusLeft = ChatMemberStatus; @@ -360,6 +377,9 @@ chatMembers total_count:int32 members:vector = ChatMembers; //@class ChatMembersFilter @description Specifies the kind of chat members to return in searchChatMembers +//@description Returns contacts of the user +chatMembersFilterContacts = ChatMembersFilter; + //@description Returns the creator and administrators chatMembersFilterAdministrators = ChatMembersFilter; @@ -381,6 +401,9 @@ chatMembersFilterBots = ChatMembersFilter; //@description Returns recently active users in reverse chronological order supergroupMembersFilterRecent = SupergroupMembersFilter; +//@description Returns contacts of the user, which are members of the supergroup or channel @query Query to search for +supergroupMembersFilterContacts query:string = SupergroupMembersFilter; + //@description Returns the creator and administrators supergroupMembersFilterAdministrators = SupergroupMembersFilter; @@ -401,13 +424,12 @@ supergroupMembersFilterBots = SupergroupMembersFilter; //@id Group identifier //@member_count Number of members in the group //@status Status of the current user in the group -//@everyone_is_administrator True, if all members have been granted administrator rights in the group //@is_active True, if the group is active //@upgraded_to_supergroup_id Identifier of the supergroup to which this group was upgraded; 0 if none -basicGroup id:int32 member_count:int32 status:ChatMemberStatus everyone_is_administrator:Bool is_active:Bool upgraded_to_supergroup_id:int32 = BasicGroup; +basicGroup id:int32 member_count:int32 status:ChatMemberStatus is_active:Bool upgraded_to_supergroup_id:int32 = BasicGroup; -//@description Contains full information about a basic group @creator_user_id User identifier of the creator of the group; 0 if unknown @members Group members @invite_link Invite link for this group; available only for the group creator and only after it has been generated at least once -basicGroupFullInfo creator_user_id:int32 members:vector invite_link:string = BasicGroupFullInfo; +//@description Contains full information about a basic group @param_description Group description @creator_user_id User identifier of the creator of the group; 0 if unknown @members Group members @invite_link Invite link for this group; available only for the group creator and only after it has been generated at least once +basicGroupFullInfo description:string creator_user_id:int32 members:vector invite_link:string = BasicGroupFullInfo; //@description Represents a supergroup or channel with zero or more members (subscribers in the case of channels). From the point of view of the system, a channel is a special kind of a supergroup: only administrators can post and see the list of members, and posts from all administrators use the name and photo of the channel instead of individual names and profile photos. Unlike supergroups, channels can have an unlimited number of subscribers @@ -416,13 +438,13 @@ basicGroupFullInfo creator_user_id:int32 members:vector invite_link: //@date Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member //@status Status of the current user in the supergroup or channel //@member_count Member count; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was found through SearchPublicChats -//@anyone_can_invite True, if any member of the supergroup can invite other members. This field has no meaning for channels //@sign_messages True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels //@is_channel True, if the supergroup is a channel //@is_verified True, if the supergroup or channel is verified //@restriction_reason If non-empty, contains the reason why access to this supergroup or channel must be restricted. Format of the string is "{type}: {description}". //-{type} Contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user) -supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_count:int32 anyone_can_invite:Bool sign_messages:Bool is_channel:Bool is_verified:Bool restriction_reason:string = Supergroup; +//@is_scam True, if many users reported this supergroup as a scam +supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_count:int32 sign_messages:Bool is_channel:Bool is_verified:Bool restriction_reason:string is_scam:Bool = Supergroup; //@description Contains full information about a supergroup or channel //@param_description Supergroup or channel description @@ -471,7 +493,7 @@ secretChat id:int32 user_id:int32 state:SecretChatState is_outbound:Bool ttl:int //@description The message was originally written by a known user @sender_user_id Identifier of the user that originally sent the message messageForwardOriginUser sender_user_id:int32 = MessageForwardOrigin; -//@description The message was originally written by a user, which is hidden by his privacy settings @sender_name Name of the sender +//@description The message was originally written by a user, which is hidden by their privacy settings @sender_name Name of the sender messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin; //@description The message was originally a post in a channel @@ -484,8 +506,8 @@ messageForwardOriginChannel chat_id:int53 message_id:int53 author_signature:stri //@description Contains information about a forwarded message //@origin Origin of a forwarded message //@date Point in time (Unix timestamp) when the message was originally sent -//@from_chat_id For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded last time; 0 if unknown -//@from_message_id For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded last time; 0 if unknown +//@from_chat_id For messages forwarded to the chat with the current user (saved messages) or to the channel discussion supergroup, the identifier of the chat from which the message was forwarded last time; 0 if unknown +//@from_message_id For messages forwarded to the chat with the current user (saved messages) or to the channel discussion supergroup, the identifier of the original message from which the new message was forwarded last time; 0 if unknown messageForwardInfo origin:MessageForwardOrigin date:int32 from_chat_id:int53 from_message_id:int53 = MessageForwardInfo; @@ -494,13 +516,14 @@ messageForwardInfo origin:MessageForwardOrigin date:int32 from_chat_id:int53 fro //@description The message is being sent now, but has not yet been delivered to the server messageSendingStatePending = MessageSendingState; -//@description The message failed to be sent -messageSendingStateFailed = MessageSendingState; +//@description The message failed to be sent @error_code An error code; 0 if unknown @error_message Error message +//@can_retry True, if the message can be re-sent @retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes +messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool retry_after:double = MessageSendingState; //@description Describes a message //@id Message identifier, unique for the chat to which the message belongs -//@sender_user_id Identifier of the user who sent the message; 0 if unknown. It is unknown for channel posts +//@sender_user_id Identifier of the user who sent the message; 0 if unknown. Currently, it is unknown for channel posts and for channel posts automatically forwarded to discussion group //@chat_id Chat identifier //@sending_state Information about the sending state of the message; may be null //@is_outgoing True, if the message is outgoing @@ -584,6 +607,7 @@ chatTypeSecret secret_chat_id:int32 user_id:int32 = ChatType; //@type Type of the chat //@title Chat title //@photo Chat photo; may be null +//@permissions Actions that non-administrator chat members are allowed to take in the chat //@last_message Last message in the chat; may be null //@order Descending parameter by which chats are sorted in the main chat list. If the order number of two chats is the same, they must be sorted in descending order by ID. If 0, the position of the chat in the list is undetermined //@is_pinned True, if the chat is pinned @@ -602,7 +626,7 @@ chatTypeSecret secret_chat_id:int32 user_id:int32 = ChatType; //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null //@client_data Contains client-specific data associated with the chat. (For example, the chat position or local chat notification settings can be stored here.) Persistent if a message database is used -chat id:int53 type:ChatType title:string photo:chatPhoto last_message:message order:int64 is_pinned:Bool is_marked_as_unread:Bool is_sponsored:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings pinned_message_id:int53 reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat id:int53 type:ChatType title:string photo:chatPhoto permissions:chatPermissions last_message:message order:int64 is_pinned:Bool is_marked_as_unread:Bool is_sponsored:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings pinned_message_id:int53 reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats @chat_ids List of chat identifiers chats chat_ids:vector = Chats; @@ -618,7 +642,7 @@ chatInviteLink invite_link:string = ChatInviteLink; //@photo Chat photo; may be null //@member_count Number of members //@member_user_ids User identifiers of some chat members that may be known to the current user -//@is_public True, if the chat is a public supergroup or channel with a username +//@is_public True, if the chat is a public supergroup or a channel with a username chatInviteLinkInfo chat_id:int53 type:ChatType title:string photo:chatPhoto member_count:int32 member_user_ids:vector is_public:Bool = ChatInviteLinkInfo; @@ -643,6 +667,9 @@ 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 logs in in current user if they allowed to do that @url HTTP URL to open @id Unique button identifier @forward_text If non-empty, new text of the button in forwarded messages +inlineKeyboardButtonTypeLoginUrl url:string id:int32 forward_text:string = InlineKeyboardButtonType; + //@description A button that sends a special callback query to a bot @data Data to be sent to the bot via a callback query inlineKeyboardButtonTypeCallback data:bytes = InlineKeyboardButtonType; @@ -721,8 +748,8 @@ richTextMarked text:RichText = RichText; richTextPhoneNumber text:RichText phone_number:string = RichText; //@description A small image inside the text @document The image represented as a document. The image can be in GIF, JPEG or PNG format -//@width Width of a bounding box in which the image should be shown, 0 if unknown -//@height Height of a bounding box in which the image should be shown, 0 if unknown +//@width Width of a bounding box in which the image should be shown; 0 if unknown +//@height Height of a bounding box in which the image should be shown; 0 if unknown richTextIcon document:document width:int32 height:int32 = RichText; //@description A rich text anchor @text Text @name Anchor name @@ -829,10 +856,10 @@ pageBlockVideo video:video caption:pageBlockCaption need_autoplay:Bool is_looped //@description A page cover @cover Cover pageBlockCover cover:PageBlock = PageBlock; -//@description An embedded web page @url Web page URL, if available @html HTML-markup of the embedded page @poster_photo Poster photo, if available; may be null @width Block width, 0 if unknown @height Block height, 0 if unknown @caption Block caption @is_full_width True, if the block should be full width @allow_scrolling True, if scrolling should be allowed +//@description An embedded web page @url Web page URL, if available @html HTML-markup of the embedded page @poster_photo Poster photo, if available; may be null @width Block width; 0 if unknown @height Block height; 0 if unknown @caption Block caption @is_full_width True, if the block should be full width @allow_scrolling True, if scrolling should be allowed pageBlockEmbedded url:string html:string poster_photo:photo width:int32 height:int32 caption:pageBlockCaption is_full_width:Bool allow_scrolling:Bool = PageBlock; -//@description An embedded post @url Web page URL @author Post author @author_photo Post author photo @date Point in time (Unix timestamp) when the post was created; 0 if unknown @page_blocks Post content @caption Post caption +//@description An embedded post @url Web page URL @author Post author @author_photo Post author photo; may be null @date Point in time (Unix timestamp) when the post was created; 0 if unknown @page_blocks Post content @caption Post caption pageBlockEmbeddedPost url:string author:string author_photo:photo date:int32 page_blocks:vector caption:pageBlockCaption = PageBlock; //@description A collage @page_blocks Collage item contents @caption Block caption @@ -1421,8 +1448,11 @@ inputMessageInvoice invoice:invoice title:string description:string photo_url:st //@description A message with a poll. Polls can't be sent to private or secret chats @question Poll question, 1-255 characters @options List of poll answer options, 2-10 strings 1-100 characters each inputMessagePoll question:string options:vector = InputMessageContent; -//@description A forwarded message @from_chat_id Identifier for the chat this forwarded message came from @message_id Identifier of the message to forward @in_game_share True, if a game message should be shared within a launched game; applies only to game messages -inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool = InputMessageContent; +//@description A forwarded message @from_chat_id Identifier for the chat this forwarded message came from @message_id Identifier of the message to forward +//@in_game_share True, if a game message should be shared within a launched game; applies only to game messages +//@send_copy True, if content of the message needs to be copied without a link to the original message. Always true if the message is forwarded to a secret chat +//@remove_caption True, if media caption of the message copy needs to be removed. Ignored if send_copy is false +inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool send_copy:Bool remove_caption:Bool = InputMessageContent; //@class SearchMessagesFilter @description Represents a filter for message search results @@ -1530,18 +1560,22 @@ userStatusLastMonth = UserStatus; //@description Represents a list of stickers @stickers List of stickers stickers stickers:vector = Stickers; -//@description Represents a list of all emoji corresponding to a sticker in a sticker set. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object @emojis List of emojis -stickerEmojis emojis:vector = StickerEmojis; +//@description Represents a list of emoji @emojis List of emojis +emojis emojis:vector = Emojis; -//@description Represents a sticker set @id Identifier of the sticker set @title Title of the sticker set @name Name of the sticker set @is_installed True, if the sticker set has been installed by the current user -//@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously @is_official True, if the sticker set is official @is_masks True, if the stickers in the set are masks -//@is_viewed True for already viewed trending sticker sets @stickers List of stickers in this set @emojis A list of emoji corresponding to the stickers in the same order -stickerSet id:int64 title:string name:string is_installed:Bool is_archived:Bool is_official:Bool is_masks:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; +//@description Represents a sticker set +//@id Identifier of the sticker set @title Title of the sticker set @name Name of the sticker set @thumbnail Sticker set thumbnail in WEBP format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed +//@is_installed True, if the sticker set has been installed by the current user @is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously +//@is_official True, if the sticker set is official @is_animated True, is the stickers in the set are animated @is_masks True, if the stickers in the set are masks @is_viewed True for already viewed trending sticker sets +//@stickers List of stickers in this set @emojis A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object +stickerSet id:int64 title:string name:string thumbnail:photoSize is_installed:Bool is_archived:Bool is_official:Bool is_animated:Bool is_masks:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; -//@description Represents short information about a sticker set @id Identifier of the sticker set @title Title of the sticker set @name Name of the sticker set @is_installed True, if the sticker set has been installed by current user -//@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously @is_official True, if the sticker set is official @is_masks True, if the stickers in the set are masks -//@is_viewed True for already viewed trending sticker sets @size Total number of stickers in the set @covers Contains up to the first 5 stickers from the set, depending on the context. If the client needs more stickers the full set should be requested -stickerSetInfo id:int64 title:string name:string is_installed:Bool is_archived:Bool is_official:Bool is_masks:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; +//@description Represents short information about a sticker set +//@id Identifier of the sticker set @title Title of the sticker set @name Name of the sticker set @thumbnail Sticker set thumbnail in WEBP format with width and height 100; may be null +//@is_installed True, if the sticker set has been installed by current user @is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously +//@is_official True, if the sticker set is official @is_animated True, is the stickers in the set are animated @is_masks True, if the stickers in the set are masks @is_viewed True for already viewed trending sticker sets +//@size Total number of stickers in the set @covers Contains up to the first 5 stickers from the set, depending on the context. If the client needs more stickers the full set should be requested +stickerSetInfo id:int64 title:string name:string thumbnail:photoSize is_installed:Bool is_archived:Bool is_official:Bool is_animated:Bool is_masks:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; //@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets stickerSets total_count:int32 sets:vector = StickerSets; @@ -1597,10 +1631,41 @@ callStateDiscarded reason:CallDiscardReason need_rating:Bool need_debug_informat callStateError error:error = CallState; +//@class CallProblem @description Describes the exact type of a problem with a call + +//@description The user heard their own voice +callProblemEcho = CallProblem; + +//@description The user heard background noise +callProblemNoise = CallProblem; + +//@description The other side kept disappearing +callProblemInterruptions = CallProblem; + +//@description The speech was distorted +callProblemDistortedSpeech = CallProblem; + +//@description The user couldn't hear the other side +callProblemSilentLocal = CallProblem; + +//@description The other side couldn't hear the user +callProblemSilentRemote = CallProblem; + +//@description The call ended unexpectedly +callProblemDropped = CallProblem; + + //@description Describes a call @id Call identifier, not persistent @user_id Peer user identifier @is_outgoing True, if the call is outgoing @state Call state call id:int32 user_id:int32 is_outgoing:Bool state:CallState = Call; +//@description Contains settings for the authentication of the user's phone number +//@allow_flash_call Pass true if the authentication code may be sent via flash call to the specified phone number +//@is_current_phone_number Pass true if the authenticated phone number is used on the current device +//@allow_sms_retriever_api For official applications only. True, if the app can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details +phoneNumberAuthenticationSettings allow_flash_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool = PhoneNumberAuthenticationSettings; + + //@description Represents a list of animations @animations List of animations animations animations:vector = Animations; @@ -1665,8 +1730,8 @@ inputInlineQueryResultLocation id:string location:location live_period:int32 tit //@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessagePhoto, InputMessageLocation, InputMessageVenue or InputMessageContact inputInlineQueryResultPhoto id:string title:string description:string thumbnail_url:string photo_url:string photo_width:int32 photo_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; -//@description Represents a link to a WEBP sticker @id Unique identifier of the query result @thumbnail_url URL of the sticker thumbnail, if it exists -//@sticker_url The URL of the WEBP sticker (sticker file size must not exceed 5MB) @sticker_width Width of the sticker @sticker_height Height of the sticker +//@description Represents a link to a WEBP or a TGS sticker @id Unique identifier of the query result @thumbnail_url URL of the sticker thumbnail, if it exists +//@sticker_url The URL of the WEBP or a TGS sticker (sticker file size must not exceed 5MB) @sticker_width Width of the sticker @sticker_height Height of the sticker //@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null //@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, inputMessageSticker, InputMessageLocation, InputMessageVenue or InputMessageContact inputInlineQueryResultSticker id:string thumbnail_url:string sticker_url:string sticker_width:int32 sticker_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; @@ -1767,6 +1832,9 @@ chatEventMessageEdited old_message:message new_message:message = ChatEventAction //@description A message was deleted @message Deleted message chatEventMessageDeleted message:message = ChatEventAction; +//@description A poll in a message was stopped @message The message with the poll +chatEventPollStopped message:message = ChatEventAction; + //@description A message was pinned @message Pinned message chatEventMessagePinned message:message = ChatEventAction; @@ -1791,6 +1859,9 @@ chatEventMemberRestricted user_id:int32 old_status:ChatMemberStatus new_status:C //@description The chat title was changed @old_title Previous chat title @new_title New chat title chatEventTitleChanged old_title:string new_title:string = ChatEventAction; +//@description The chat permissions was changed @old_permissions Previous chat permissions @new_permissions New chat permissions +chatEventPermissionsChanged old_permissions:chatPermissions new_permissions:chatPermissions = ChatEventAction; + //@description The chat description was changed @old_description Previous chat description @new_description New chat description chatEventDescriptionChanged old_description:string new_description:string = ChatEventAction; @@ -1798,10 +1869,10 @@ chatEventDescriptionChanged old_description:string new_description:string = Chat chatEventUsernameChanged old_username:string new_username:string = ChatEventAction; //@description The chat photo was changed @old_photo Previous chat photo value; may be null @new_photo New chat photo value; may be null -chatEventPhotoChanged old_photo:chatPhoto new_photo:chatPhoto = ChatEventAction; +chatEventPhotoChanged old_photo:photo new_photo:photo = ChatEventAction; -//@description The anyone_can_invite setting of a supergroup chat was toggled @anyone_can_invite New value of anyone_can_invite -chatEventInvitesToggled anyone_can_invite:Bool = ChatEventAction; +//@description The can_invite_users permission of a supergroup chat was toggled @can_invite_users New value of can_invite_users permission +chatEventInvitesToggled can_invite_users:Bool = ChatEventAction; //@description The sign_messages setting of a channel was toggled @sign_messages New value of sign_messages chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction; @@ -1907,11 +1978,44 @@ deviceTokenTizenPush reg_id:string = DeviceToken; pushReceiverId id:int64 = PushReceiverId; -//@description Contains information about a wallpaper @id Unique persistent wallpaper identifier @sizes Available variants of the wallpaper in different sizes. These photos can only be downloaded; they can't be sent in a message @color Main color of the wallpaper in RGB24 format; should be treated as background color if no photos are specified -wallpaper id:int32 sizes:vector color:int32 = Wallpaper; +//@class BackgroundType @description Describes a type of a background -//@description Contains a list of wallpapers @wallpapers A list of wallpapers -wallpapers wallpapers:vector = Wallpapers; +//@description A wallpaper in JPEG format +//@is_blurred True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12 +//@is_moving True, if the background needs to be slightly moved when device is rotated +backgroundTypeWallpaper is_blurred:Bool is_moving:Bool = BackgroundType; + +//@description A PNG pattern to be combined with the color chosen by the user +//@is_moving True, if the background needs to be slightly moved when device is rotated +//@color Main color of the background in RGB24 format +//@intensity Intensity of the pattern when it is shown above the main background color, 0-100 +backgroundTypePattern is_moving:Bool color:int32 intensity:int32 = BackgroundType; + +//@description A solid background @color A color of the background in RGB24 format +backgroundTypeSolid color:int32 = BackgroundType; + + +//@description Describes a chat background +//@id Unique background identifier +//@is_default True, if this is one of default backgrounds +//@is_dark True, if the background is dark and is recommended to be used with dark theme +//@name Unique background name +//@document Document with the background; may be null. Null only for solid backgrounds +//@type Type of the background +background id:int64 is_default:Bool is_dark:Bool name:string document:document type:BackgroundType = Background; + +//@description Contains a list of backgrounds @backgrounds A list of backgrounds +backgrounds backgrounds:vector = Backgrounds; + + +//@class InputBackground @description Contains information about background to set + +//@description A background from a local file +//@background Background file to use. Only inputFileLocal and inputFileGenerated are supported. The file nust be in JPEG format for wallpapers and in PNG format for patterns +inputBackgroundLocal background:InputFile = InputBackground; + +//@description A background from the server @background_id The background identifier +inputBackgroundRemote background_id:int64 = InputBackground; //@description Contains a list of hashtags @hashtags A list of hashtags @@ -1929,7 +2033,7 @@ checkChatUsernameResultUsernameInvalid = CheckChatUsernameResult; //@description The username is occupied checkChatUsernameResultUsernameOccupied = CheckChatUsernameResult; -//@description The user has too much public chats, one of them should be made private first +//@description The user has too much chats with username, one of them should be made private first checkChatUsernameResultPublicChatsTooMuch = CheckChatUsernameResult; //@description The user can't be a member of a public supergroup @@ -1941,7 +2045,7 @@ checkChatUsernameResultPublicGroupsUnavailable = CheckChatUsernameResult; //@description A general message with hidden content @is_pinned True, if the message is a pinned message with the specified content pushMessageContentHidden is_pinned:Bool = PushMessageContent; -//@description An animation message (GIF-style) @animation Message content; may be null @caption Animation caption @is_pinned True, if the message is a pinned message with the specified content +//@description An animation message (GIF-style). @animation Message content; may be null @caption Animation caption @is_pinned True, if the message is a pinned message with the specified content pushMessageContentAnimation animation:animation caption:string is_pinned:Bool = PushMessageContent; //@description An audio message @audio Message content; may be null @is_pinned True, if the message is a pinned message with the specified content @@ -2127,6 +2231,12 @@ userPrivacySettingRules rules:vector = UserPrivacySettin //@description A privacy setting for managing whether the user's online status is visible userPrivacySettingShowStatus = UserPrivacySetting; +//@description A privacy setting for managing whether the user's profile photo is visible +userPrivacySettingShowProfilePhoto = UserPrivacySetting; + +//@description A privacy setting for managing whether a link to the user's account is included in forwarded messages +userPrivacySettingShowLinkInForwardedMessages = UserPrivacySetting; + //@description A privacy setting for managing whether the user can be invited to chats userPrivacySettingAllowChatInvites = UserPrivacySetting; @@ -2196,9 +2306,16 @@ chatReportReasonCopyright = ChatReportReason; chatReportReasonCustom text:string = ChatReportReason; -//@description Contains a public HTTPS link to a message in a public supergroup or channel @link Message link @html HTML-code for embedding the message +//@description Contains a public HTTPS link to a message in a public supergroup or channel with a username @link Message link @html HTML-code for embedding the message publicMessageLink link:string html:string = PublicMessageLink; +//@description Contains information about a link to a message in a chat +//@is_public True, if the link is a public link for a message in a chat +//@chat_id If found, identifier of the chat to which the message belongs, 0 otherwise +//@message If found, the linked message; may be null +//@for_album True, if the whole media album to which the message belongs is linked +messageLinkInfo is_public:Bool chat_id:int53 message:message for_album:Bool = MessageLinkInfo; + //@description Contains a part of a file @data File bytes filePart data:bytes = FilePart; @@ -2251,7 +2368,7 @@ fileTypeVideoNote = FileType; //@description The file is a voice note fileTypeVoiceNote = FileType; -//@description The file is a wallpaper +//@description The file is a wallpaper or a background pattern fileTypeWallpaper = FileType; @@ -2305,9 +2422,26 @@ networkStatisticsEntryCall network_type:NetworkType sent_bytes:int53 received_by networkStatistics since_date:int32 entries:vector = NetworkStatistics; +//@description Contains auto-download settings +//@is_auto_download_enabled True, if the auto-download is enabled +//@max_photo_file_size Maximum size of a photo file to be auto-downloaded +//@max_video_file_size Maximum size of a video file to be auto-downloaded +//@max_other_file_size Maximum size of other file types to be auto-downloaded +//@preload_large_videos True, if the beginning of videos needs to be preloaded for instant playback +//@preload_next_audio True, if the next audio track needs to be preloaded while the user is listening to an audio file +//@use_less_data_for_calls True, if "use less data for calls" option needs to be enabled +autoDownloadSettings is_auto_download_enabled:Bool max_photo_file_size:int32 max_video_file_size:int32 max_other_file_size:int32 preload_large_videos:Bool preload_next_audio:Bool use_less_data_for_calls:Bool = AutoDownloadSettings; + +//@description Contains auto-download settings presets for the user +//@low Preset with lowest settings; supposed to be used by default when roaming +//@medium Preset with medium settings; supposed to be used by default when using mobile data +//@high Preset with highest settings; supposed to be used by default when connected on Wi-Fi +autoDownloadSettingsPresets low:autoDownloadSettings medium:autoDownloadSettings high:autoDownloadSettings = AutoDownloadSettingsPresets; + + //@class ConnectionState @description Describes the current state of the connection to Telegram servers -//@description Currently waiting for the network to become available. Use SetNetworkType to change the available network type +//@description Currently waiting for the network to become available. Use setNetworkType to change the available network type connectionStateWaitingForNetwork = ConnectionState; //@description Currently establishing a connection with a proxy server @@ -2427,7 +2561,7 @@ updateMessageSendAcknowledged chat_id:int53 message_id:int53 = Update; updateMessageSendSucceeded message:message old_message_id:int53 = Update; //@description A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update -//@message Contains information about the message that failed to send @old_message_id The previous temporary message identifier @error_code An error code @error_message Error message +//@message Contains information about the message which failed to send @old_message_id The previous temporary message identifier @error_code An error code @error_message Error message updateMessageSendFailed message:message old_message_id:int53 error_code:int32 error_message:string = Update; //@description The message content has changed @chat_id Chat identifier @message_id Message identifier @new_content New message content @@ -2454,6 +2588,9 @@ updateChatTitle chat_id:int53 title:string = Update; //@description A chat photo was changed @chat_id Chat identifier @photo The new chat photo; may be null updateChatPhoto chat_id:int53 photo:chatPhoto = Update; +//@description Chat permissions was changed @chat_id Chat identifier @permissions The new chat permissions +updateChatPermissions chat_id:int53 permissions:chatPermissions = Update; + //@description The last message of a chat was changed. If last_message is null then the last message in the chat became unknown. Some new unknown messages might be added to the chat in this case @chat_id Chat identifier @last_message The new last message in the chat; may be null @order New value of the chat order updateChatLastMessage chat_id:int53 last_message:message order:int64 = Update; @@ -2603,6 +2740,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 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; + //@description Some language pack strings have been updated @localization_target Localization target to which the language pack belongs @language_pack_id Identifier of the updated language pack @strings List of changed language pack strings updateLanguagePackStrings localization_target:string language_pack_id:string strings:vector = Update; @@ -2693,17 +2833,20 @@ setTdlibParameters parameters:tdlibParameters = Ok; //@description Checks the database encryption key for correctness. Works only when the current authorization state is authorizationStateWaitEncryptionKey @encryption_key Encryption key to check or set up checkDatabaseEncryptionKey encryption_key:bytes = Ok; -//@description Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber -//@phone_number The phone number of the user, in international format @allow_flash_call Pass true if the authentication code may be sent via flash call to the specified phone number @is_current_phone_number Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false -setAuthenticationPhoneNumber phone_number:string allow_flash_call:Bool is_current_phone_number:Bool = Ok; +//@description Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, +//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode or authorizationStateWaitPassword +//@phone_number The phone number of the user, in international format @settings Settings for the authentication of the user's phone number +setAuthenticationPhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = Ok; //@description Re-sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode and the next_code_type of the result is not null resendAuthenticationCode = Ok; //@description Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode @code The verification code received via SMS, Telegram message, phone call, or flash call -//@first_name If the user is not yet registered, the first name of the user; 1-64 characters. You can also pass an empty string for unregistered user there to check verification code validness. In the latter case PHONE_NUMBER_UNOCCUPIED error will be returned for a valid code -//@last_name If the user is not yet registered; the last name of the user; optional; 0-64 characters -checkAuthenticationCode code:string first_name:string last_name:string = Ok; +checkAuthenticationCode code:string = Ok; + +//@description Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration +//@first_name The first name of the user; 1-64 characters @last_name The last name of the user; 0-64 characters +registerUser first_name:string last_name:string = Ok; //@description Checks the authentication password for correctness. Works only when the current authorization state is authorizationStateWaitPassword @password The password to check checkAuthenticationPassword password:string = Ok; @@ -2745,7 +2888,7 @@ setPassword old_password:string new_password:string new_hint:string set_recovery //@description Returns a 2-step verification recovery email address that was previously set up. This method can be used to verify a password provided by the user @password The password for the current user getRecoveryEmailAddress password:string = RecoveryEmailAddress; -//@description Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed +//@description Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed. //-If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation @password Password of the current user @new_recovery_email_address New recovery email address setRecoveryEmailAddress password:string new_recovery_email_address:string = PasswordState; @@ -2817,7 +2960,7 @@ getFile file_id:int32 = File; getRemoteFile remote_file_id:string file_type:FileType = File; //@description Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). -//-For optimal performance the number of returned chats is chosen by the library. @offset_order Chat order to return chats from @offset_chat_id Chat identifier to return chats from +//-For optimal performance the number of returned chats is chosen by the library @offset_order Chat order to return chats from @offset_chat_id Chat identifier to return chats from //@limit The maximum number of chats to be returned. It is possible that fewer chats than the limit are returned even if the end of the list is not reached getChats offset_order:int64 offset_chat_id:int53 limit:int32 = Chats; @@ -2851,7 +2994,7 @@ clearRecentlyFoundChats = Ok; //@description Checks whether a username can be set for a chat @chat_id Chat identifier; should be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if chat is being created @username Username to be checked checkChatUsername chat_id:int53 username:string = CheckChatUsernameResult; -//@description Returns a list of public chats created by the user +//@description Returns a list of public chats with username created by the user getCreatedPublicChats = Chats; @@ -2924,7 +3067,7 @@ removeNotification notification_group_id:int32 notification_id:int32 = Ok; removeNotificationGroup notification_group_id:int32 max_notification_id:int32 = Ok; -//@description Returns a public HTTPS link to a message. Available only for messages in public supergroups and channels +//@description Returns a public HTTPS link to a message. Available only for messages in supergroups and channels with username //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message //@for_album Pass true if a link for a whole media album should be returned @@ -2935,6 +3078,9 @@ getPublicMessageLink chat_id:int53 message_id:int53 for_album:Bool = PublicMessa //@message_id Identifier of the message getMessageLink chat_id:int53 message_id:int53 = HttpUrl; +//@description Returns information about a public or private message link @url The message link in the format "https://t.me/c/...", or "tg://privatepost?...", or "https://t.me/username/...", or "tg://resolve?..." +getMessageLinkInfo url:string = MessageLinkInfo; + //@description Sends a message. Returns the sent message @chat_id Target chat @reply_to_message_id Identifier of the message to reply to or 0 //@disable_notification Pass true to disable notification for the message. Not supported in secret chats @from_background Pass true if the message is sent from the background @@ -2947,7 +3093,7 @@ sendMessage chat_id:int53 reply_to_message_id:int53 disable_notification:Bool fr sendMessageAlbum chat_id:int53 reply_to_message_id:int53 disable_notification:Bool from_background:Bool input_message_contents:vector = Messages; //@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message -//@bot_user_id Identifier of the bot @chat_id Identifier of the target chat @parameter A hidden parameter sent to the bot for deep linking purposes (https://api.telegram.org/bots#deep-linking) +//@bot_user_id Identifier of the bot @chat_id Identifier of the target chat @parameter A hidden parameter sent to the bot for deep linking purposes (https://core.telegram.org/bots#deep-linking) sendBotStartMessage bot_user_id:int32 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 @reply_to_message_id Identifier of a message to reply to or 0 @@ -2958,9 +3104,16 @@ sendInlineQueryResultMessage chat_id:int53 reply_to_message_id:int53 disable_not //@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message //@chat_id Identifier of the chat to which to forward messages @from_chat_id Identifier of the chat from which to forward messages @message_ids Identifiers of the messages to forward -//@disable_notification Pass true to disable notification for the message, doesn't work if messages are forwarded to a secret chat @from_background Pass true if the message is sent from the background +//@disable_notification Pass true to disable notification for the message, doesn't work if messages are forwarded to a secret chat @from_background Pass true if the messages are sent from the background //@as_album True, if the messages should be grouped into an album after forwarding. For this to work, no more than 10 messages may be forwarded, and all of them must be photo or video messages -forwardMessages chat_id:int53 from_chat_id:int53 message_ids:vector disable_notification:Bool from_background:Bool as_album:Bool = Messages; +//@send_copy True, if content of the messages needs to be copied without links to the original messages. Always true if the messages are forwarded to a secret chat +//@remove_caption True, if media captions of message copies needs to be removed. Ignored if send_copy is false +forwardMessages chat_id:int53 from_chat_id:int53 message_ids:vector disable_notification:Bool from_background:Bool as_album:Bool send_copy:Bool remove_caption:Bool = Messages; + +//@description Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. +//-If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message +//@chat_id Identifier of the chat to send messages @message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order +resendMessages chat_id:int53 message_ids:vector = Messages; //@description Changes the current TTL setting (sets a new self-destruct timer) in a secret chat and sends the corresponding message @chat_id Chat identifier @ttl New TTL value, in seconds sendChatSetTtlMessage chat_id:int53 ttl:int32 = Message; @@ -3138,18 +3291,22 @@ createNewSupergroupChat title:string is_channel:Bool description:string = Chat; //@description Creates a new secret chat. Returns the newly created chat @user_id Identifier of the target user createNewSecretChat user_id:int32 = Chat; -//@description Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom. Deactivates the original basic group @chat_id Identifier of the chat to upgrade +//@description Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group @chat_id Identifier of the chat to upgrade upgradeBasicGroupChatToSupergroupChat chat_id:int53 = Chat; -//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The title will not be changed until the request to the server has been completed +//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info rights. The title will not be changed until the request to the server has been completed //@chat_id Chat identifier @title New title of the chat; 1-128 characters setChatTitle chat_id:int53 title:string = Ok; -//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The photo will not be changed before request to the server has been completed +//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info rights. The photo will not be changed before request to the server has been completed //@chat_id Chat identifier @photo New chat photo. You can use a zero InputFileId to delete the chat photo. Files that are accessible only by HTTP URL are not acceptable setChatPhoto chat_id:int53 photo:InputFile = Ok; +//@description Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right +//@chat_id Chat identifier @permissions New non-administrator members permissions in the chat +setChatPermissions chat_id:int53 permissions:chatPermissions = Ok; + //@description Changes the draft message in a chat @chat_id Chat identifier @draft_message New draft message; may be null setChatDraftMessage chat_id:int53 draft_message:draftMessage = Ok; @@ -3168,10 +3325,13 @@ toggleChatDefaultDisableNotification chat_id:int53 default_disable_notification: //@description Changes client data associated with a chat @chat_id Chat identifier @client_data New value of client_data setChatClientData chat_id:int53 client_data:string = Ok; -//@description Pins a message in a chat; requires appropriate administrator rights in the group or channel @chat_id Identifier of the chat @message_id Identifier of the new pinned message @disable_notification True, if there should be no notification about the pinned message +//@description Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info rights @chat_id Identifier of the chat @param_description New chat description; 0-255 characters +setChatDescription chat_id:int53 description:string = Ok; + +//@description Pins a message in a chat; requires can_pin_messages rights @chat_id Identifier of the chat @message_id Identifier of the new pinned message @disable_notification True, if there should be no notification about the pinned message pinChatMessage chat_id:int53 message_id:int53 disable_notification:Bool = Ok; -//@description Removes the pinned message from a chat; requires appropriate administrator rights in the group or channel @chat_id Identifier of the chat +//@description Removes the pinned message from a chat; requires can_pin_messages rights in the group or channel @chat_id Identifier of the chat unpinChatMessage chat_id:int53 = Ok; //@description Adds current user as a new member to a chat. Private and secret chats can't be joined using this method @chat_id Chat identifier @@ -3270,7 +3430,7 @@ readFilePart file_id:int32 offset:int32 count:int32 = FilePart; deleteFile file_id:int32 = Ok; -//@description Generates a new invite link for a chat; the previously generated link is revoked. Available for basic groups, supergroups, and channels. In basic groups this can be called only by the group's creator; in supergroups and channels this requires appropriate administrator rights @chat_id Chat identifier +//@description Generates a new invite link for a chat; the previously generated link is revoked. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right @chat_id Chat identifier generateChatInviteLink chat_id:int53 = ChatInviteLink; //@description Checks the validity of an invite link for a chat and returns information about the corresponding chat @invite_link Invite link to be checked; should begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/", or "https://telegram.dog/joinchat/" @@ -3290,8 +3450,8 @@ acceptCall call_id:int32 protocol:callProtocol = Ok; //@description Discards a call @call_id Call identifier @is_disconnected True, if the user was disconnected @duration The call duration, in seconds @connection_id Identifier of the connection used during the call discardCall call_id:int32 is_disconnected:Bool duration:int32 connection_id:int64 = Ok; -//@description Sends a call rating @call_id Call identifier @rating Call rating; 1-5 @comment An optional user comment if the rating is less than 5 -sendCallRating call_id:int32 rating:int32 comment:string = Ok; +//@description Sends a call rating @call_id Call identifier @rating Call rating; 1-5 @comment An optional user comment if the rating is less than 5 @problems List of the exact types of problems with the call, specified by the user +sendCallRating call_id:int32 rating:int32 comment:string problems:vector = Ok; //@description Sends debug information for a call @call_id Call identifier @debug_information Debug information in application-specific format sendCallDebugInformation call_id:int32 debug_information:string = Ok; @@ -3397,8 +3557,14 @@ addFavoriteSticker sticker:InputFile = Ok; //@description Removes a sticker from the list of favorite stickers @sticker Sticker file to delete from the list removeFavoriteSticker sticker:InputFile = Ok; -//@description Returns emoji corresponding to a sticker @sticker Sticker file identifier -getStickerEmojis sticker:InputFile = StickerEmojis; +//@description Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object @sticker Sticker file identifier +getStickerEmojis sticker:InputFile = Emojis; + +//@description Searches for emojis by keywords. Supported only if the file database is enabled @text Text to search for @exact_match True, if only emojis, which exactly match text needs to be returned +searchEmojis text:string exact_match:Bool = Emojis; + +//@description Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation @language_code Language code for which the emoji replacements will be suggested +getEmojiSuggestionsUrl language_code:string = HttpUrl; //@description Returns saved animations @@ -3446,8 +3612,8 @@ setBio bio:string = Ok; setUsername username:string = Ok; //@description Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code -//@phone_number The new phone number of the user in international format @allow_flash_call Pass true if the code can be sent via flash call to the specified phone number @is_current_phone_number Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false -changePhoneNumber phone_number:string allow_flash_call:Bool is_current_phone_number:Bool = AuthenticationCodeInfo; +//@phone_number The new phone number of the user in international format @settings Settings for the authentication of the user's phone number +changePhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo; //@description Re-sends the authentication code sent to confirm a new phone number for the user. Works only if the previously received authenticationCodeInfo next_code_type was not null resendChangePhoneNumberCode = AuthenticationCodeInfo; @@ -3476,28 +3642,18 @@ disconnectWebsite website_id:int64 = Ok; disconnectAllWebsites = Ok; -//@description Toggles the "All members are admins" setting in basic groups; requires creator privileges in the group @basic_group_id Identifier of the basic group @everyone_is_administrator New value of everyone_is_administrator -toggleBasicGroupAdministrators basic_group_id:int32 everyone_is_administrator:Bool = Ok; - - //@description Changes the username of a supergroup or channel, requires creator privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @username New value of the username. Use an empty string to remove the username setSupergroupUsername supergroup_id:int32 username:string = Ok; -//@description Changes the sticker set of a supergroup; requires appropriate rights in the supergroup @supergroup_id Identifier of the supergroup @sticker_set_id New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set +//@description Changes the sticker set of a supergroup; requires can_change_info rights @supergroup_id Identifier of the supergroup @sticker_set_id New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set setSupergroupStickerSet supergroup_id:int32 sticker_set_id:int64 = Ok; -//@description Toggles whether all members of a supergroup can add new members; requires appropriate administrator rights in the supergroup. @supergroup_id Identifier of the supergroup @anyone_can_invite New value of anyone_can_invite -toggleSupergroupInvites supergroup_id:int32 anyone_can_invite:Bool = Ok; - -//@description Toggles sender signatures messages sent in a channel; requires appropriate administrator rights in the channel. @supergroup_id Identifier of the channel @sign_messages New value of sign_messages +//@description Toggles sender signatures messages sent in a channel; requires can_change_info rights @supergroup_id Identifier of the channel @sign_messages New value of sign_messages toggleSupergroupSignMessages supergroup_id:int32 sign_messages:Bool = Ok; -//@description Toggles whether the message history of a supergroup is available to new members; requires appropriate administrator rights in the supergroup. @supergroup_id The identifier of the supergroup @is_all_history_available The new value of is_all_history_available +//@description Toggles whether the message history of a supergroup is available to new members; requires can_change_info rights @supergroup_id The identifier of the supergroup @is_all_history_available The new value of is_all_history_available toggleSupergroupIsAllHistoryAvailable supergroup_id:int32 is_all_history_available:Bool = Ok; -//@description Changes information about a supergroup or channel; requires appropriate administrator rights @supergroup_id Identifier of the supergroup or channel @param_description New supergroup or channel description; 0-255 characters -setSupergroupDescription supergroup_id:int32 description:string = Ok; - //@description Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup @supergroup_id Supergroup identifier @user_id User identifier @message_ids Identifiers of messages sent in the supergroup by the user. This list must be non-empty reportSupergroupSpam supergroup_id:int32 user_id:int32 message_ids:vector = Ok; @@ -3545,8 +3701,27 @@ deleteSavedCredentials = Ok; //@description Returns a user that can be contacted to get support getSupportUser = User; -//@description Returns background wallpapers -getWallpapers = Wallpapers; + +//@description Returns backgrounds installed by the user @for_dark_theme True, if the backgrounds needs to be ordered for dark theme +getBackgrounds for_dark_theme:Bool = Backgrounds; + +//@description Constructs a persistent HTTP URL for a background @name Background name @type Background type +getBackgroundUrl name:string type:BackgroundType = HttpUrl; + +//@description Searches for a background by its name @name The name of the background +searchBackground name:string = Background; + +//@description Changes the background selected by the user; adds background to the list of installed backgrounds +//@background The input background to use, null for solid backgrounds +//@type Background type; null for default background. The method will return error 404 if type is null +//@for_dark_theme True, if the background is chosen for dark theme +setBackground background:InputBackground type:BackgroundType for_dark_theme:Bool = Background; + +//@description Removes background from the list of installed backgrounds @background_id The background indentifier +removeBackground background_id:int64 = Ok; + +//@description Resets list of installed backgrounds to its default value +resetBackgrounds = Ok; //@description Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization @only_local If true, returns only locally available information without sending network requests @@ -3628,7 +3803,7 @@ changeChatReportSpamState chat_id:int53 is_spam_chat:Bool = Ok; reportChat chat_id:int53 reason:ChatReportReason message_ids:vector = Ok; -//@description Returns URL with the chat statistics. Currently this method can be used only for channels @chat_id Chat identifier @parameters Parameters from "tg://statsrefresh?params=******" link @is_dark Pass true if a URL with the dark theme must be returned +//@description Returns an HTTP URL with the chat statistics. Currently this method can be used only for channels @chat_id Chat identifier @parameters Parameters from "tg://statsrefresh?params=******" link @is_dark Pass true if a URL with the dark theme must be returned getChatStatisticsUrl chat_id:int53 parameters:string is_dark:Bool = HttpUrl; @@ -3666,6 +3841,12 @@ addNetworkStatistics entry:NetworkStatisticsEntry = Ok; //@description Resets all network data usage statistics to zero. Can be called before authorization resetNetworkStatistics = Ok; +//@description Returns auto-download settings presets for the currently logged in user +getAutoDownloadSettingsPresets = AutoDownloadSettingsPresets; + +//@description Sets auto-download settings @settings New user auto-download settings @type Type of the network for which the new settings are applied +setAutoDownloadSettings settings:autoDownloadSettings type:NetworkType = Ok; + //@description Returns one of the available Telegram Passport elements @type Telegram Passport element type @password Password of the current user getPassportElement type:PassportElementType password:string = PassportElement; @@ -3688,8 +3869,8 @@ getPreferredCountryLanguage country_code:string = Text; //@description Sends a code to verify a phone number to be added to a user's Telegram Passport -//@phone_number The phone number of the user, in international format @allow_flash_call Pass true if the authentication code may be sent via flash call to the specified phone number @is_current_phone_number Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false -sendPhoneNumberVerificationCode phone_number:string allow_flash_call:Bool is_current_phone_number:Bool = AuthenticationCodeInfo; +//@phone_number The phone number of the user, in international format @settings Settings for the authentication of the user's phone number +sendPhoneNumberVerificationCode phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo; //@description Re-sends the code to verify a phone number to be added to a user's Telegram Passport resendPhoneNumberVerificationCode = AuthenticationCodeInfo; @@ -3720,8 +3901,8 @@ sendPassportAuthorizationForm autorization_form_id:int32 types:vector = TestVectorStringObject; 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 +testProxy server:string port:int32 type:ProxyType = Ok; //@description Forces an updates.getDifference call to the Telegram servers; for testing only testGetDifference = Ok; //@description Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization testUseUpdate = Update; -//@description Does nothing and ensures that the Error object is used; for testing only. This is an offline method. Can be called before authorization -testUseError = Error; +//@description Returns the specified error and ensures that the Error object is used; for testing only. This is an offline method. Can be called before authorization. Can be called synchronously @error The error to be returned +testReturnError error:error = Error;