update for TDLib v1.5.0

This commit is contained in:
Aleksandr Zelenin 2019-09-10 15:36:54 +03:00
parent 7f5ecc75f7
commit bb283b57fc
10 changed files with 3191 additions and 689 deletions

View file

@ -1,4 +1,4 @@
TAG := v1.4.0 TAG := v1.5.0
schema-update: schema-update:
curl https://raw.githubusercontent.com/tdlib/td/${TAG}/td/generate/scheme/td_api.tl 2>/dev/null > ./data/td_api.tl curl https://raw.githubusercontent.com/tdlib/td/${TAG}/td/generate/scheme/td_api.tl 2>/dev/null > ./data/td_api.tl

View file

@ -1,33 +1,10 @@
# go-tdlib # 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 ## TDLib installation
### Ubuntu 18-19 / Debian 9 Use [TDLib build instructions](https://tdlib.github.io/td/build.html)
#### 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
```
## Usage ## Usage
@ -44,13 +21,6 @@ import (
"github.com/zelenin/go-tdlib/client" "github.com/zelenin/go-tdlib/client"
) )
func WithLogs() client.Option {
return func(tdlibClient *client.Client) {
tdlibClient.SetLogVerbosityLevel(&client.SetLogVerbosityLevelRequest{
NewVerbosityLevel: 1,
})
}
}
func main() { func main() {
// client authorizer // client authorizer
@ -58,8 +28,8 @@ func main() {
go client.CliInteractor(authorizer) go client.CliInteractor(authorizer)
// or bot authorizer // or bot authorizer
botToken := "000000000:gsVCGG5YbikxYHC7bP5vRvmBqJ7Xz6vG6td" // botToken := "000000000:gsVCGG5YbikxYHC7bP5vRvmBqJ7Xz6vG6td"
authorizer := client.BotAuthorizer(botToken) // authorizer := client.BotAuthorizer(botToken)
const ( const (
apiId = 00000 apiId = 00000
@ -84,11 +54,24 @@ func main() {
IgnoreFileNames: false, IgnoreFileNames: false,
} }
tdlibClient, err := client.NewClient(authorizer, WithLogs()) logVerbosity := client.WithLogVerbosity(&client.SetLogVerbosityLevelRequest{
NewVerbosityLevel: 0,
})
tdlibClient, err := client.NewClient(authorizer, logVerbosity)
if err != nil { if err != nil {
log.Fatalf("NewClient error: %s", err) 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() me, err := tdlibClient.GetMe()
if err != nil { if err != nil {
log.Fatalf("GetMe error: %s", err) log.Fatalf("GetMe error: %s", err)
@ -120,7 +103,7 @@ for update := range listener.Updates {
### Proxy support ### Proxy support
```go ```go
proxyOption := client.WithProxy(&client.AddProxyRequest{ proxy := client.WithProxy(&client.AddProxyRequest{
Server: "1.1.1.1", Server: "1.1.1.1",
Port: 1080, Port: 1080,
Enable: true, Enable: true,
@ -130,7 +113,7 @@ proxyOption := client.WithProxy(&client.AddProxyRequest{
}, },
}) })
tdlibClient, err := client.NewClient(authorizer, proxyOption) tdlibClient, err := client.NewClient(authorizer, proxy)
``` ```

View file

@ -40,8 +40,6 @@ type clientAuthorizer struct {
PhoneNumber chan string PhoneNumber chan string
Code chan string Code chan string
State chan AuthorizationState State chan AuthorizationState
FirstName chan string
LastName chan string
Password chan string Password chan string
} }
@ -51,8 +49,6 @@ func ClientAuthorizer() *clientAuthorizer {
PhoneNumber: make(chan string, 1), PhoneNumber: make(chan string, 1),
Code: make(chan string, 1), Code: make(chan string, 1),
State: make(chan AuthorizationState, 10), State: make(chan AuthorizationState, 10),
FirstName: make(chan string, 1),
LastName: make(chan string, 1),
Password: make(chan string, 1), Password: make(chan string, 1),
} }
} }
@ -73,20 +69,24 @@ func (stateHandler *clientAuthorizer) Handle(client *Client, state Authorization
case TypeAuthorizationStateWaitPhoneNumber: case TypeAuthorizationStateWaitPhoneNumber:
_, err := client.SetAuthenticationPhoneNumber(&SetAuthenticationPhoneNumberRequest{ _, err := client.SetAuthenticationPhoneNumber(&SetAuthenticationPhoneNumberRequest{
PhoneNumber: <-stateHandler.PhoneNumber, PhoneNumber: <-stateHandler.PhoneNumber,
AllowFlashCall: false, Settings: &PhoneNumberAuthenticationSettings{
IsCurrentPhoneNumber: false, AllowFlashCall: false,
IsCurrentPhoneNumber: false,
AllowSmsRetrieverApi: false,
},
}) })
return err return err
case TypeAuthorizationStateWaitCode: case TypeAuthorizationStateWaitCode:
_, err := client.CheckAuthenticationCode(&CheckAuthenticationCodeRequest{ _, err := client.CheckAuthenticationCode(&CheckAuthenticationCodeRequest{
Code: <-stateHandler.Code, Code: <-stateHandler.Code,
FirstName: <-stateHandler.FirstName,
LastName: <-stateHandler.LastName,
}) })
return err return err
case TypeAuthorizationStateWaitRegistration:
return ErrNotSupportedAuthorizationState
case TypeAuthorizationStateWaitPassword: case TypeAuthorizationStateWaitPassword:
_, err := client.CheckAuthenticationPassword(&CheckAuthenticationPasswordRequest{ _, err := client.CheckAuthenticationPassword(&CheckAuthenticationPasswordRequest{
Password: <-stateHandler.Password, Password: <-stateHandler.Password,
@ -114,8 +114,6 @@ func (stateHandler *clientAuthorizer) Close() {
close(stateHandler.PhoneNumber) close(stateHandler.PhoneNumber)
close(stateHandler.Code) close(stateHandler.Code)
close(stateHandler.State) close(stateHandler.State)
close(stateHandler.FirstName)
close(stateHandler.LastName)
close(stateHandler.Password) close(stateHandler.Password)
} }
@ -137,25 +135,11 @@ func CliInteractor(clientAuthorizer *clientAuthorizer) {
case TypeAuthorizationStateWaitCode: case TypeAuthorizationStateWaitCode:
var code string var code string
var firstName string
var lastName string
fmt.Println("Enter code: ") fmt.Println("Enter code: ")
fmt.Scanln(&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.Code <- code
clientAuthorizer.FirstName <- firstName
clientAuthorizer.LastName <- lastName
case TypeAuthorizationStateWaitPassword: case TypeAuthorizationStateWaitPassword:
fmt.Println("Enter password: ") fmt.Println("Enter password: ")

View file

@ -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) { func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...Option) (*Client, error) {
catchersListener := make(chan *Response, 1000) catchersListener := make(chan *Response, 1000)

View file

@ -35,6 +35,9 @@ func (client *Client) GetAuthorizationState() (AuthorizationState, error) {
case TypeAuthorizationStateWaitCode: case TypeAuthorizationStateWaitCode:
return UnmarshalAuthorizationStateWaitCode(result.Data) return UnmarshalAuthorizationStateWaitCode(result.Data)
case TypeAuthorizationStateWaitRegistration:
return UnmarshalAuthorizationStateWaitRegistration(result.Data)
case TypeAuthorizationStateWaitPassword: case TypeAuthorizationStateWaitPassword:
return UnmarshalAuthorizationStateWaitPassword(result.Data) return UnmarshalAuthorizationStateWaitPassword(result.Data)
@ -110,22 +113,19 @@ func (client *Client) CheckDatabaseEncryptionKey(req *CheckDatabaseEncryptionKey
type SetAuthenticationPhoneNumberRequest struct { type SetAuthenticationPhoneNumberRequest struct {
// The phone number of the user, in international format // The phone number of the user, in international format
PhoneNumber string `json:"phone_number"` PhoneNumber string `json:"phone_number"`
// Pass true if the authentication code may be sent via flash call to the specified phone number // Settings for the authentication of the user's phone number
AllowFlashCall bool `json:"allow_flash_call"` Settings *PhoneNumberAuthenticationSettings `json:"settings"`
// 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"`
} }
// 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) { func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNumberRequest) (*Ok, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
Type: "setAuthenticationPhoneNumber", Type: "setAuthenticationPhoneNumber",
}, },
Data: map[string]interface{}{ Data: map[string]interface{}{
"phone_number": req.PhoneNumber, "phone_number": req.PhoneNumber,
"allow_flash_call": req.AllowFlashCall, "settings": req.Settings,
"is_current_phone_number": req.IsCurrentPhoneNumber,
}, },
}) })
if err != nil { if err != nil {
@ -161,10 +161,6 @@ func (client *Client) ResendAuthenticationCode() (*Ok, error) {
type CheckAuthenticationCodeRequest struct { type CheckAuthenticationCodeRequest struct {
// The verification code received via SMS, Telegram message, phone call, or flash call // The verification code received via SMS, Telegram message, phone call, or flash call
Code string `json:"code"` 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 // 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", Type: "checkAuthenticationCode",
}, },
Data: map[string]interface{}{ 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, "first_name": req.FirstName,
"last_name": req.LastName, "last_name": req.LastName,
}, },
@ -479,7 +502,7 @@ type SetRecoveryEmailAddressRequest struct {
NewRecoveryEmailAddress string `json:"new_recovery_email_address"` 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) { func (client *Client) SetRecoveryEmailAddress(req *SetRecoveryEmailAddressRequest) (*PasswordState, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -1072,7 +1095,7 @@ type GetChatsRequest struct {
Limit int32 `json:"limit"` 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) { func (client *Client) GetChats(req *GetChatsRequest) (*Chats, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ 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) { func (client *Client) GetCreatedPublicChats() (*Chats, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -1830,7 +1853,7 @@ type GetPublicMessageLinkRequest struct {
ForAlbum bool `json:"for_album"` 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) { func (client *Client) GetPublicMessageLink(req *GetPublicMessageLinkRequest) (*PublicMessageLink, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -1882,6 +1905,32 @@ func (client *Client) GetMessageLink(req *GetMessageLinkRequest) (*HttpUrl, erro
return UnmarshalHttpUrl(result.Data) 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 { type SendMessageRequest struct {
// Target chat // Target chat
ChatId int64 `json:"chat_id"` ChatId int64 `json:"chat_id"`
@ -1966,7 +2015,7 @@ type SendBotStartMessageRequest struct {
BotUserId int32 `json:"bot_user_id"` BotUserId int32 `json:"bot_user_id"`
// Identifier of the target chat // Identifier of the target chat
ChatId int64 `json:"chat_id"` 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"` Parameter string `json:"parameter"`
} }
@ -2046,10 +2095,14 @@ type ForwardMessagesRequest struct {
MessageIds []int64 `json:"message_ids"` MessageIds []int64 `json:"message_ids"`
// Pass true to disable notification for the message, doesn't work if messages are forwarded to a secret chat // Pass true to disable notification for the message, doesn't work if messages are forwarded to a secret chat
DisableNotification bool `json:"disable_notification"` 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"` 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 // 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"` 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 // 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, "disable_notification": req.DisableNotification,
"from_background": req.FromBackground, "from_background": req.FromBackground,
"as_album": req.AsAlbum, "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 { if err != nil {
@ -3633,7 +3717,7 @@ type UpgradeBasicGroupChatToSupergroupChatRequest struct {
ChatId int64 `json:"chat_id"` 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) { func (client *Client) UpgradeBasicGroupChatToSupergroupChat(req *UpgradeBasicGroupChatToSupergroupChatRequest) (*Chat, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -3661,7 +3745,7 @@ type SetChatTitleRequest struct {
Title string `json:"title"` 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) { func (client *Client) SetChatTitle(req *SetChatTitleRequest) (*Ok, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -3690,7 +3774,7 @@ type SetChatPhotoRequest struct {
Photo InputFile `json:"photo"` 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) { func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -3712,6 +3796,35 @@ func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) {
return UnmarshalOk(result.Data) 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 { type SetChatDraftMessageRequest struct {
// Chat identifier // Chat identifier
ChatId int64 `json:"chat_id"` ChatId int64 `json:"chat_id"`
@ -3886,6 +3999,35 @@ func (client *Client) SetChatClientData(req *SetChatClientDataRequest) (*Ok, err
return UnmarshalOk(result.Data) 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 { type PinChatMessageRequest struct {
// Identifier of the chat // Identifier of the chat
ChatId int64 `json:"chat_id"` ChatId int64 `json:"chat_id"`
@ -3895,7 +4037,7 @@ type PinChatMessageRequest struct {
DisableNotification bool `json:"disable_notification"` 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) { func (client *Client) PinChatMessage(req *PinChatMessageRequest) (*Ok, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -3923,7 +4065,7 @@ type UnpinChatMessageRequest struct {
ChatId int64 `json:"chat_id"` 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) { func (client *Client) UnpinChatMessage(req *UnpinChatMessageRequest) (*Ok, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -4644,7 +4786,7 @@ type GenerateChatInviteLinkRequest struct {
ChatId int64 `json:"chat_id"` 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) { func (client *Client) GenerateChatInviteLink(req *GenerateChatInviteLinkRequest) (*ChatInviteLink, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -4817,6 +4959,8 @@ type SendCallRatingRequest struct {
Rating int32 `json:"rating"` Rating int32 `json:"rating"`
// An optional user comment if the rating is less than 5 // An optional user comment if the rating is less than 5
Comment string `json:"comment"` 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 // Sends a call rating
@ -4826,9 +4970,10 @@ func (client *Client) SendCallRating(req *SendCallRatingRequest) (*Ok, error) {
Type: "sendCallRating", Type: "sendCallRating",
}, },
Data: map[string]interface{}{ Data: map[string]interface{}{
"call_id": req.CallId, "call_id": req.CallId,
"rating": req.Rating, "rating": req.Rating,
"comment": req.Comment, "comment": req.Comment,
"problems": req.Problems,
}, },
}) })
if err != nil { if err != nil {
@ -5692,8 +5837,8 @@ type GetStickerEmojisRequest struct {
Sticker InputFile `json:"sticker"` Sticker InputFile `json:"sticker"`
} }
// Returns emoji corresponding to a sticker // 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) (*StickerEmojis, error) { func (client *Client) GetStickerEmojis(req *GetStickerEmojisRequest) (*Emojis, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
Type: "getStickerEmojis", Type: "getStickerEmojis",
@ -5710,7 +5855,62 @@ func (client *Client) GetStickerEmojis(req *GetStickerEmojisRequest) (*StickerEm
return nil, buildResponseError(result.Data) 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 // Returns saved animations
@ -6049,10 +6249,8 @@ func (client *Client) SetUsername(req *SetUsernameRequest) (*Ok, error) {
type ChangePhoneNumberRequest struct { type ChangePhoneNumberRequest struct {
// The new phone number of the user in international format // The new phone number of the user in international format
PhoneNumber string `json:"phone_number"` PhoneNumber string `json:"phone_number"`
// Pass true if the code can be sent via flash call to the specified phone number // Settings for the authentication of the user's phone number
AllowFlashCall bool `json:"allow_flash_call"` Settings *PhoneNumberAuthenticationSettings `json:"settings"`
// 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"`
} }
// 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 // 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", Type: "changePhoneNumber",
}, },
Data: map[string]interface{}{ Data: map[string]interface{}{
"phone_number": req.PhoneNumber, "phone_number": req.PhoneNumber,
"allow_flash_call": req.AllowFlashCall, "settings": req.Settings,
"is_current_phone_number": req.IsCurrentPhoneNumber,
}, },
}) })
if err != nil { if err != nil {
@ -6251,35 +6448,6 @@ func (client *Client) DisconnectAllWebsites() (*Ok, error) {
return UnmarshalOk(result.Data) 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 { type SetSupergroupUsernameRequest struct {
// Identifier of the supergroup or channel // Identifier of the supergroup or channel
SupergroupId int32 `json:"supergroup_id"` SupergroupId int32 `json:"supergroup_id"`
@ -6316,7 +6484,7 @@ type SetSupergroupStickerSetRequest struct {
StickerSetId JsonInt64 `json:"sticker_set_id"` 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) { func (client *Client) SetSupergroupStickerSet(req *SetSupergroupStickerSetRequest) (*Ok, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -6338,35 +6506,6 @@ func (client *Client) SetSupergroupStickerSet(req *SetSupergroupStickerSetReques
return UnmarshalOk(result.Data) 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 { type ToggleSupergroupSignMessagesRequest struct {
// Identifier of the channel // Identifier of the channel
SupergroupId int32 `json:"supergroup_id"` SupergroupId int32 `json:"supergroup_id"`
@ -6374,7 +6513,7 @@ type ToggleSupergroupSignMessagesRequest struct {
SignMessages bool `json:"sign_messages"` 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) { func (client *Client) ToggleSupergroupSignMessages(req *ToggleSupergroupSignMessagesRequest) (*Ok, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -6403,7 +6542,7 @@ type ToggleSupergroupIsAllHistoryAvailableRequest struct {
IsAllHistoryAvailable bool `json:"is_all_history_available"` 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) { func (client *Client) ToggleSupergroupIsAllHistoryAvailable(req *ToggleSupergroupIsAllHistoryAvailableRequest) (*Ok, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -6425,35 +6564,6 @@ func (client *Client) ToggleSupergroupIsAllHistoryAvailable(req *ToggleSupergrou
return UnmarshalOk(result.Data) 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 { type ReportSupergroupSpamRequest struct {
// Supergroup identifier // Supergroup identifier
SupergroupId int32 `json:"supergroup_id"` SupergroupId int32 `json:"supergroup_id"`
@ -6821,11 +6931,150 @@ func (client *Client) GetSupportUser() (*User, error) {
return UnmarshalUser(result.Data) return UnmarshalUser(result.Data)
} }
// Returns background wallpapers type GetBackgroundsRequest struct {
func (client *Client) GetWallpapers() (*Wallpapers, error) { // 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{ result, err := client.Send(Request{
meta: meta{ 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{}{}, Data: map[string]interface{}{},
}) })
@ -6837,7 +7086,7 @@ func (client *Client) GetWallpapers() (*Wallpapers, error) {
return nil, buildResponseError(result.Data) return nil, buildResponseError(result.Data)
} }
return UnmarshalWallpapers(result.Data) return UnmarshalOk(result.Data)
} }
type GetLocalizationTargetInfoRequest struct { type GetLocalizationTargetInfoRequest struct {
@ -7482,7 +7731,7 @@ type GetChatStatisticsUrlRequest struct {
IsDark bool `json:"is_dark"` 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) { func (client *Client) GetChatStatisticsUrl(req *GetChatStatisticsUrlRequest) (*HttpUrl, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -7713,6 +7962,54 @@ func (client *Client) ResetNetworkStatistics() (*Ok, error) {
return UnmarshalOk(result.Data) 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 { type GetPassportElementRequest struct {
// Telegram Passport element type // Telegram Passport element type
Type PassportElementType `json:"type"` Type PassportElementType `json:"type"`
@ -7965,10 +8262,8 @@ func (client *Client) GetPreferredCountryLanguage(req *GetPreferredCountryLangua
type SendPhoneNumberVerificationCodeRequest struct { type SendPhoneNumberVerificationCodeRequest struct {
// The phone number of the user, in international format // The phone number of the user, in international format
PhoneNumber string `json:"phone_number"` PhoneNumber string `json:"phone_number"`
// Pass true if the authentication code may be sent via flash call to the specified phone number // Settings for the authentication of the user's phone number
AllowFlashCall bool `json:"allow_flash_call"` Settings *PhoneNumberAuthenticationSettings `json:"settings"`
// 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"`
} }
// Sends a code to verify a phone number to be added to a user's Telegram Passport // 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", Type: "sendPhoneNumberVerificationCode",
}, },
Data: map[string]interface{}{ Data: map[string]interface{}{
"phone_number": req.PhoneNumber, "phone_number": req.PhoneNumber,
"allow_flash_call": req.AllowFlashCall, "settings": req.Settings,
"is_current_phone_number": req.IsCurrentPhoneNumber,
}, },
}) })
if err != nil { if err != nil {
@ -8208,10 +8502,8 @@ type SendPhoneNumberConfirmationCodeRequest struct {
Hash string `json:"hash"` Hash string `json:"hash"`
// Value of the "phone" parameter from the link // Value of the "phone" parameter from the link
PhoneNumber string `json:"phone_number"` PhoneNumber string `json:"phone_number"`
// Pass true if the authentication code may be sent via flash call to the specified phone number // Settings for the authentication of the user's phone number
AllowFlashCall bool `json:"allow_flash_call"` Settings *PhoneNumberAuthenticationSettings `json:"settings"`
// 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"`
} }
// Sends phone number confirmation code. Should be called when user presses "https://t.me/confirmphone?phone=*******&hash=**********" or "tg://confirmphone?phone=*******&hash=**********" link // 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", Type: "sendPhoneNumberConfirmationCode",
}, },
Data: map[string]interface{}{ Data: map[string]interface{}{
"hash": req.Hash, "hash": req.Hash,
"phone_number": req.PhoneNumber, "phone_number": req.PhoneNumber,
"allow_flash_call": req.AllowFlashCall, "settings": req.Settings,
"is_current_phone_number": req.IsCurrentPhoneNumber,
}, },
}) })
if err != nil { if err != nil {
@ -8617,7 +8908,7 @@ func (client *Client) SetAlarm(req *SetAlarmRequest) (*Ok, error) {
return UnmarshalOk(result.Data) 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) { func (client *Client) GetCountryCode() (*Text, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
meta: meta{ meta: meta{
@ -9393,6 +9684,38 @@ func (client *Client) TestNetwork() (*Ok, error) {
return UnmarshalOk(result.Data) 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 // Forces an updates.getDifference call to the Telegram servers; for testing only
func (client *Client) TestGetDifference() (*Ok, error) { func (client *Client) TestGetDifference() (*Ok, error) {
result, err := client.Send(Request{ result, err := client.Send(Request{
@ -9468,6 +9791,9 @@ func (client *Client) TestUseUpdate() (Update, error) {
case TypeUpdateChatPhoto: case TypeUpdateChatPhoto:
return UnmarshalUpdateChatPhoto(result.Data) return UnmarshalUpdateChatPhoto(result.Data)
case TypeUpdateChatPermissions:
return UnmarshalUpdateChatPermissions(result.Data)
case TypeUpdateChatLastMessage: case TypeUpdateChatLastMessage:
return UnmarshalUpdateChatLastMessage(result.Data) return UnmarshalUpdateChatLastMessage(result.Data)
@ -9597,6 +9923,9 @@ func (client *Client) TestUseUpdate() (Update, error) {
case TypeUpdateSavedAnimations: case TypeUpdateSavedAnimations:
return UnmarshalUpdateSavedAnimations(result.Data) return UnmarshalUpdateSavedAnimations(result.Data)
case TypeUpdateSelectedBackground:
return UnmarshalUpdateSelectedBackground(result.Data)
case TypeUpdateLanguagePackStrings: case TypeUpdateLanguagePackStrings:
return UnmarshalUpdateLanguagePackStrings(result.Data) 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 type TestReturnErrorRequest struct {
func (client *Client) TestUseError() (*Error, error) { // The error to be returned
result, err := client.Send(Request{ 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{ meta: meta{
Type: "testUseError", Type: "testReturnError",
},
Data: map[string]interface{}{
"error": req.Error,
}, },
Data: map[string]interface{}{},
}) })
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -3,7 +3,6 @@ package client
/* /*
#include <stdlib.h> #include <stdlib.h>
#include <td/telegram/td_json_client.h> #include <td/telegram/td_json_client.h>
#include <td/telegram/td_log.h>
*/ */
import "C" import "C"
@ -94,31 +93,6 @@ func (jsonClient *JsonClient) Destroy() {
C.td_json_client_destroy(jsonClient.jsonClient) 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 meta struct {
Type string `json:"@type"` Type string `json:"@type"`
Extra string `json:"@extra"` Extra string `json:"@extra"`

File diff suppressed because it is too large Load diff

View file

@ -54,6 +54,9 @@ func UnmarshalAuthorizationState(data json.RawMessage) (AuthorizationState, erro
case TypeAuthorizationStateWaitCode: case TypeAuthorizationStateWaitCode:
return UnmarshalAuthorizationStateWaitCode(data) return UnmarshalAuthorizationStateWaitCode(data)
case TypeAuthorizationStateWaitRegistration:
return UnmarshalAuthorizationStateWaitRegistration(data)
case TypeAuthorizationStateWaitPassword: case TypeAuthorizationStateWaitPassword:
return UnmarshalAuthorizationStateWaitPassword(data) return UnmarshalAuthorizationStateWaitPassword(data)
@ -216,6 +219,9 @@ func UnmarshalChatMembersFilter(data json.RawMessage) (ChatMembersFilter, error)
} }
switch meta.Type { switch meta.Type {
case TypeChatMembersFilterContacts:
return UnmarshalChatMembersFilterContacts(data)
case TypeChatMembersFilterAdministrators: case TypeChatMembersFilterAdministrators:
return UnmarshalChatMembersFilterAdministrators(data) return UnmarshalChatMembersFilterAdministrators(data)
@ -248,6 +254,9 @@ func UnmarshalSupergroupMembersFilter(data json.RawMessage) (SupergroupMembersFi
case TypeSupergroupMembersFilterRecent: case TypeSupergroupMembersFilterRecent:
return UnmarshalSupergroupMembersFilterRecent(data) return UnmarshalSupergroupMembersFilterRecent(data)
case TypeSupergroupMembersFilterContacts:
return UnmarshalSupergroupMembersFilterContacts(data)
case TypeSupergroupMembersFilterAdministrators: case TypeSupergroupMembersFilterAdministrators:
return UnmarshalSupergroupMembersFilterAdministrators(data) return UnmarshalSupergroupMembersFilterAdministrators(data)
@ -418,6 +427,9 @@ func UnmarshalInlineKeyboardButtonType(data json.RawMessage) (InlineKeyboardButt
case TypeInlineKeyboardButtonTypeUrl: case TypeInlineKeyboardButtonTypeUrl:
return UnmarshalInlineKeyboardButtonTypeUrl(data) return UnmarshalInlineKeyboardButtonTypeUrl(data)
case TypeInlineKeyboardButtonTypeLoginUrl:
return UnmarshalInlineKeyboardButtonTypeLoginUrl(data)
case TypeInlineKeyboardButtonTypeCallback: case TypeInlineKeyboardButtonTypeCallback:
return UnmarshalInlineKeyboardButtonTypeCallback(data) 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) { func UnmarshalInputInlineQueryResult(data json.RawMessage) (InputInlineQueryResult, error) {
var meta meta var meta meta
@ -1529,6 +1576,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) {
case TypeChatEventMessageDeleted: case TypeChatEventMessageDeleted:
return UnmarshalChatEventMessageDeleted(data) return UnmarshalChatEventMessageDeleted(data)
case TypeChatEventPollStopped:
return UnmarshalChatEventPollStopped(data)
case TypeChatEventMessagePinned: case TypeChatEventMessagePinned:
return UnmarshalChatEventMessagePinned(data) return UnmarshalChatEventMessagePinned(data)
@ -1553,6 +1603,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) {
case TypeChatEventTitleChanged: case TypeChatEventTitleChanged:
return UnmarshalChatEventTitleChanged(data) return UnmarshalChatEventTitleChanged(data)
case TypeChatEventPermissionsChanged:
return UnmarshalChatEventPermissionsChanged(data)
case TypeChatEventDescriptionChanged: case TypeChatEventDescriptionChanged:
return UnmarshalChatEventDescriptionChanged(data) 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) { func UnmarshalCheckChatUsernameResult(data json.RawMessage) (CheckChatUsernameResult, error) {
var meta meta var meta meta
@ -1924,6 +2020,12 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro
case TypeUserPrivacySettingShowStatus: case TypeUserPrivacySettingShowStatus:
return UnmarshalUserPrivacySettingShowStatus(data) return UnmarshalUserPrivacySettingShowStatus(data)
case TypeUserPrivacySettingShowProfilePhoto:
return UnmarshalUserPrivacySettingShowProfilePhoto(data)
case TypeUserPrivacySettingShowLinkInForwardedMessages:
return UnmarshalUserPrivacySettingShowLinkInForwardedMessages(data)
case TypeUserPrivacySettingAllowChatInvites: case TypeUserPrivacySettingAllowChatInvites:
return UnmarshalUserPrivacySettingAllowChatInvites(data) return UnmarshalUserPrivacySettingAllowChatInvites(data)
@ -2259,6 +2361,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) {
case TypeUpdateChatPhoto: case TypeUpdateChatPhoto:
return UnmarshalUpdateChatPhoto(data) return UnmarshalUpdateChatPhoto(data)
case TypeUpdateChatPermissions:
return UnmarshalUpdateChatPermissions(data)
case TypeUpdateChatLastMessage: case TypeUpdateChatLastMessage:
return UnmarshalUpdateChatLastMessage(data) return UnmarshalUpdateChatLastMessage(data)
@ -2388,6 +2493,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) {
case TypeUpdateSavedAnimations: case TypeUpdateSavedAnimations:
return UnmarshalUpdateSavedAnimations(data) return UnmarshalUpdateSavedAnimations(data)
case TypeUpdateSelectedBackground:
return UnmarshalUpdateSelectedBackground(data)
case TypeUpdateLanguagePackStrings: case TypeUpdateLanguagePackStrings:
return UnmarshalUpdateLanguagePackStrings(data) return UnmarshalUpdateLanguagePackStrings(data)
@ -2588,6 +2696,14 @@ func UnmarshalAuthorizationStateWaitCode(data json.RawMessage) (*AuthorizationSt
return &resp, err 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) { func UnmarshalAuthorizationStateWaitPassword(data json.RawMessage) (*AuthorizationStateWaitPassword, error) {
var resp AuthorizationStateWaitPassword var resp AuthorizationStateWaitPassword
@ -2716,6 +2832,14 @@ func UnmarshalPhotoSize(data json.RawMessage) (*PhotoSize, error) {
return &resp, err 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) { func UnmarshalMaskPointForehead(data json.RawMessage) (*MaskPointForehead, error) {
var resp MaskPointForehead var resp MaskPointForehead
@ -2996,6 +3120,14 @@ func UnmarshalUsers(data json.RawMessage) (*Users, error) {
return &resp, err return &resp, err
} }
func UnmarshalChatPermissions(data json.RawMessage) (*ChatPermissions, error) {
var resp ChatPermissions
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalChatMemberStatusCreator(data json.RawMessage) (*ChatMemberStatusCreator, error) { func UnmarshalChatMemberStatusCreator(data json.RawMessage) (*ChatMemberStatusCreator, error) {
var resp ChatMemberStatusCreator var resp ChatMemberStatusCreator
@ -3060,6 +3192,14 @@ func UnmarshalChatMembers(data json.RawMessage) (*ChatMembers, error) {
return &resp, err 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) { func UnmarshalChatMembersFilterAdministrators(data json.RawMessage) (*ChatMembersFilterAdministrators, error) {
var resp ChatMembersFilterAdministrators var resp ChatMembersFilterAdministrators
@ -3108,6 +3248,14 @@ func UnmarshalSupergroupMembersFilterRecent(data json.RawMessage) (*SupergroupMe
return &resp, err 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) { func UnmarshalSupergroupMembersFilterAdministrators(data json.RawMessage) (*SupergroupMembersFilterAdministrators, error) {
var resp SupergroupMembersFilterAdministrators var resp SupergroupMembersFilterAdministrators
@ -3436,6 +3584,14 @@ func UnmarshalInlineKeyboardButtonTypeUrl(data json.RawMessage) (*InlineKeyboard
return &resp, err 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) { func UnmarshalInlineKeyboardButtonTypeCallback(data json.RawMessage) (*InlineKeyboardButtonTypeCallback, error) {
var resp InlineKeyboardButtonTypeCallback var resp InlineKeyboardButtonTypeCallback
@ -5508,8 +5664,8 @@ func UnmarshalStickers(data json.RawMessage) (*Stickers, error) {
return &resp, err return &resp, err
} }
func UnmarshalStickerEmojis(data json.RawMessage) (*StickerEmojis, error) { func UnmarshalEmojis(data json.RawMessage) (*Emojis, error) {
var resp StickerEmojis var resp Emojis
err := json.Unmarshal(data, &resp) err := json.Unmarshal(data, &resp)
@ -5652,6 +5808,62 @@ func UnmarshalCallStateError(data json.RawMessage) (*CallStateError, error) {
return &resp, err 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) { func UnmarshalCall(data json.RawMessage) (*Call, error) {
var resp Call var resp Call
@ -5660,6 +5872,14 @@ func UnmarshalCall(data json.RawMessage) (*Call, error) {
return &resp, err 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) { func UnmarshalAnimations(data json.RawMessage) (*Animations, error) {
var resp Animations var resp Animations
@ -5956,6 +6176,14 @@ func UnmarshalChatEventMessageDeleted(data json.RawMessage) (*ChatEventMessageDe
return &resp, err 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) { func UnmarshalChatEventMessagePinned(data json.RawMessage) (*ChatEventMessagePinned, error) {
var resp ChatEventMessagePinned var resp ChatEventMessagePinned
@ -6020,6 +6248,14 @@ func UnmarshalChatEventTitleChanged(data json.RawMessage) (*ChatEventTitleChange
return &resp, err 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) { func UnmarshalChatEventDescriptionChanged(data json.RawMessage) (*ChatEventDescriptionChanged, error) {
var resp ChatEventDescriptionChanged var resp ChatEventDescriptionChanged
@ -6252,16 +6488,56 @@ func UnmarshalPushReceiverId(data json.RawMessage) (*PushReceiverId, error) {
return &resp, err return &resp, err
} }
func UnmarshalWallpaper(data json.RawMessage) (*Wallpaper, error) { func UnmarshalBackgroundTypeWallpaper(data json.RawMessage) (*BackgroundTypeWallpaper, error) {
var resp Wallpaper var resp BackgroundTypeWallpaper
err := json.Unmarshal(data, &resp) err := json.Unmarshal(data, &resp)
return &resp, err return &resp, err
} }
func UnmarshalWallpapers(data json.RawMessage) (*Wallpapers, error) { func UnmarshalBackgroundTypePattern(data json.RawMessage) (*BackgroundTypePattern, error) {
var resp Wallpapers 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) err := json.Unmarshal(data, &resp)
@ -6756,6 +7032,22 @@ func UnmarshalUserPrivacySettingShowStatus(data json.RawMessage) (*UserPrivacySe
return &resp, err 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) { func UnmarshalUserPrivacySettingAllowChatInvites(data json.RawMessage) (*UserPrivacySettingAllowChatInvites, error) {
var resp UserPrivacySettingAllowChatInvites var resp UserPrivacySettingAllowChatInvites
@ -6884,6 +7176,14 @@ func UnmarshalPublicMessageLink(data json.RawMessage) (*PublicMessageLink, error
return &resp, err 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) { func UnmarshalFilePart(data json.RawMessage) (*FilePart, error) {
var resp FilePart var resp FilePart
@ -7124,6 +7424,22 @@ func UnmarshalNetworkStatistics(data json.RawMessage) (*NetworkStatistics, error
return &resp, err 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) { func UnmarshalConnectionStateWaitingForNetwork(data json.RawMessage) (*ConnectionStateWaitingForNetwork, error) {
var resp ConnectionStateWaitingForNetwork var resp ConnectionStateWaitingForNetwork
@ -7460,6 +7776,14 @@ func UnmarshalUpdateChatPhoto(data json.RawMessage) (*UpdateChatPhoto, error) {
return &resp, err 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) { func UnmarshalUpdateChatLastMessage(data json.RawMessage) (*UpdateChatLastMessage, error) {
var resp UpdateChatLastMessage var resp UpdateChatLastMessage
@ -7804,6 +8128,14 @@ func UnmarshalUpdateSavedAnimations(data json.RawMessage) (*UpdateSavedAnimation
return &resp, err 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) { func UnmarshalUpdateLanguagePackStrings(data json.RawMessage) (*UpdateLanguagePackStrings, error) {
var resp UpdateLanguagePackStrings var resp UpdateLanguagePackStrings
@ -8064,6 +8396,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeAuthorizationStateWaitCode: case TypeAuthorizationStateWaitCode:
return UnmarshalAuthorizationStateWaitCode(data) return UnmarshalAuthorizationStateWaitCode(data)
case TypeAuthorizationStateWaitRegistration:
return UnmarshalAuthorizationStateWaitRegistration(data)
case TypeAuthorizationStateWaitPassword: case TypeAuthorizationStateWaitPassword:
return UnmarshalAuthorizationStateWaitPassword(data) return UnmarshalAuthorizationStateWaitPassword(data)
@ -8112,6 +8447,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypePhotoSize: case TypePhotoSize:
return UnmarshalPhotoSize(data) return UnmarshalPhotoSize(data)
case TypeMinithumbnail:
return UnmarshalMinithumbnail(data)
case TypeMaskPointForehead: case TypeMaskPointForehead:
return UnmarshalMaskPointForehead(data) return UnmarshalMaskPointForehead(data)
@ -8217,6 +8555,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeUsers: case TypeUsers:
return UnmarshalUsers(data) return UnmarshalUsers(data)
case TypeChatPermissions:
return UnmarshalChatPermissions(data)
case TypeChatMemberStatusCreator: case TypeChatMemberStatusCreator:
return UnmarshalChatMemberStatusCreator(data) return UnmarshalChatMemberStatusCreator(data)
@ -8241,6 +8582,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeChatMembers: case TypeChatMembers:
return UnmarshalChatMembers(data) return UnmarshalChatMembers(data)
case TypeChatMembersFilterContacts:
return UnmarshalChatMembersFilterContacts(data)
case TypeChatMembersFilterAdministrators: case TypeChatMembersFilterAdministrators:
return UnmarshalChatMembersFilterAdministrators(data) return UnmarshalChatMembersFilterAdministrators(data)
@ -8259,6 +8603,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeSupergroupMembersFilterRecent: case TypeSupergroupMembersFilterRecent:
return UnmarshalSupergroupMembersFilterRecent(data) return UnmarshalSupergroupMembersFilterRecent(data)
case TypeSupergroupMembersFilterContacts:
return UnmarshalSupergroupMembersFilterContacts(data)
case TypeSupergroupMembersFilterAdministrators: case TypeSupergroupMembersFilterAdministrators:
return UnmarshalSupergroupMembersFilterAdministrators(data) return UnmarshalSupergroupMembersFilterAdministrators(data)
@ -8382,6 +8729,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeInlineKeyboardButtonTypeUrl: case TypeInlineKeyboardButtonTypeUrl:
return UnmarshalInlineKeyboardButtonTypeUrl(data) return UnmarshalInlineKeyboardButtonTypeUrl(data)
case TypeInlineKeyboardButtonTypeLoginUrl:
return UnmarshalInlineKeyboardButtonTypeLoginUrl(data)
case TypeInlineKeyboardButtonTypeCallback: case TypeInlineKeyboardButtonTypeCallback:
return UnmarshalInlineKeyboardButtonTypeCallback(data) return UnmarshalInlineKeyboardButtonTypeCallback(data)
@ -9159,8 +9509,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeStickers: case TypeStickers:
return UnmarshalStickers(data) return UnmarshalStickers(data)
case TypeStickerEmojis: case TypeEmojis:
return UnmarshalStickerEmojis(data) return UnmarshalEmojis(data)
case TypeStickerSet: case TypeStickerSet:
return UnmarshalStickerSet(data) return UnmarshalStickerSet(data)
@ -9213,9 +9563,33 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeCallStateError: case TypeCallStateError:
return UnmarshalCallStateError(data) 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: case TypeCall:
return UnmarshalCall(data) return UnmarshalCall(data)
case TypePhoneNumberAuthenticationSettings:
return UnmarshalPhoneNumberAuthenticationSettings(data)
case TypeAnimations: case TypeAnimations:
return UnmarshalAnimations(data) return UnmarshalAnimations(data)
@ -9327,6 +9701,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeChatEventMessageDeleted: case TypeChatEventMessageDeleted:
return UnmarshalChatEventMessageDeleted(data) return UnmarshalChatEventMessageDeleted(data)
case TypeChatEventPollStopped:
return UnmarshalChatEventPollStopped(data)
case TypeChatEventMessagePinned: case TypeChatEventMessagePinned:
return UnmarshalChatEventMessagePinned(data) return UnmarshalChatEventMessagePinned(data)
@ -9351,6 +9728,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeChatEventTitleChanged: case TypeChatEventTitleChanged:
return UnmarshalChatEventTitleChanged(data) return UnmarshalChatEventTitleChanged(data)
case TypeChatEventPermissionsChanged:
return UnmarshalChatEventPermissionsChanged(data)
case TypeChatEventDescriptionChanged: case TypeChatEventDescriptionChanged:
return UnmarshalChatEventDescriptionChanged(data) return UnmarshalChatEventDescriptionChanged(data)
@ -9438,11 +9818,26 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypePushReceiverId: case TypePushReceiverId:
return UnmarshalPushReceiverId(data) return UnmarshalPushReceiverId(data)
case TypeWallpaper: case TypeBackgroundTypeWallpaper:
return UnmarshalWallpaper(data) return UnmarshalBackgroundTypeWallpaper(data)
case TypeWallpapers: case TypeBackgroundTypePattern:
return UnmarshalWallpapers(data) 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: case TypeHashtags:
return UnmarshalHashtags(data) return UnmarshalHashtags(data)
@ -9627,6 +10022,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeUserPrivacySettingShowStatus: case TypeUserPrivacySettingShowStatus:
return UnmarshalUserPrivacySettingShowStatus(data) return UnmarshalUserPrivacySettingShowStatus(data)
case TypeUserPrivacySettingShowProfilePhoto:
return UnmarshalUserPrivacySettingShowProfilePhoto(data)
case TypeUserPrivacySettingShowLinkInForwardedMessages:
return UnmarshalUserPrivacySettingShowLinkInForwardedMessages(data)
case TypeUserPrivacySettingAllowChatInvites: case TypeUserPrivacySettingAllowChatInvites:
return UnmarshalUserPrivacySettingAllowChatInvites(data) return UnmarshalUserPrivacySettingAllowChatInvites(data)
@ -9675,6 +10076,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypePublicMessageLink: case TypePublicMessageLink:
return UnmarshalPublicMessageLink(data) return UnmarshalPublicMessageLink(data)
case TypeMessageLinkInfo:
return UnmarshalMessageLinkInfo(data)
case TypeFilePart: case TypeFilePart:
return UnmarshalFilePart(data) return UnmarshalFilePart(data)
@ -9765,6 +10169,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeNetworkStatistics: case TypeNetworkStatistics:
return UnmarshalNetworkStatistics(data) return UnmarshalNetworkStatistics(data)
case TypeAutoDownloadSettings:
return UnmarshalAutoDownloadSettings(data)
case TypeAutoDownloadSettingsPresets:
return UnmarshalAutoDownloadSettingsPresets(data)
case TypeConnectionStateWaitingForNetwork: case TypeConnectionStateWaitingForNetwork:
return UnmarshalConnectionStateWaitingForNetwork(data) return UnmarshalConnectionStateWaitingForNetwork(data)
@ -9891,6 +10301,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeUpdateChatPhoto: case TypeUpdateChatPhoto:
return UnmarshalUpdateChatPhoto(data) return UnmarshalUpdateChatPhoto(data)
case TypeUpdateChatPermissions:
return UnmarshalUpdateChatPermissions(data)
case TypeUpdateChatLastMessage: case TypeUpdateChatLastMessage:
return UnmarshalUpdateChatLastMessage(data) return UnmarshalUpdateChatLastMessage(data)
@ -10020,6 +10433,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeUpdateSavedAnimations: case TypeUpdateSavedAnimations:
return UnmarshalUpdateSavedAnimations(data) return UnmarshalUpdateSavedAnimations(data)
case TypeUpdateSelectedBackground:
return UnmarshalUpdateSelectedBackground(data)
case TypeUpdateLanguagePackStrings: case TypeUpdateLanguagePackStrings:
return UnmarshalUpdateLanguagePackStrings(data) return UnmarshalUpdateLanguagePackStrings(data)

File diff suppressed because it is too large Load diff

View file

@ -73,7 +73,7 @@ textEntities entities:vector<textEntity> = TextEntities;
formattedText text:string entities:vector<textEntity> = FormattedText; formattedText text:string entities:vector<textEntity> = 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; 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 //@description TDLib needs the user's phone number to authorize
authorizationStateWaitPhoneNumber = AuthorizationState; 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 //@description TDLib needs the user's authentication code to authorize @code_info Information about the authorization code that was sent
authorizationStateWaitCode is_registered:Bool terms_of_service:termsOfService code_info:authenticationCodeInfo = AuthorizationState; 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 //@recovery_email_address_pattern Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent
authorizationStateWaitPassword password_hint:string has_recovery_email_address:Bool recovery_email_address_pattern:string = AuthorizationState; authorizationStateWaitPassword password_hint:string has_recovery_email_address:Bool 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 //@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; 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 //@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 //@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 //@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"
animation duration:int32 width:int32 height:int32 file_name:string mime_type:string thumbnail:photoSize animation:file = Animation; //@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 //@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 //@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_thumbnail:photoSize audio:file = 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 //@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 //@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 thumbnail:photoSize document:file = 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 //@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 sizes:vector<photoSize> = Photo; photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector<photoSize> = 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 //@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 //@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_mask:Bool mask_position:maskPosition thumbnail:photoSize sticker:file = 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 //@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 //@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 //@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 thumbnail:photoSize video:file = 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 //@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 thumbnail:photoSize video:file = VideoNote; 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 //@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 //@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<pollOption> 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 //@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; 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; chatPhoto small:file big:file = ChatPhoto;
@ -296,8 +303,9 @@ botInfo description:string commands:vector<botCommand> = BotInfo;
//@is_verified True, if the user is verified @is_support True, if the user is Telegram support account //@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}". //@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) //-{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 //@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 //@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 //@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<userProfilePhoto> = UserProfil
users total_count:int32 user_ids:vector<int32> = Users; users total_count:int32 user_ids:vector<int32> = 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 //@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 //@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_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_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_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; 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 //@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 //@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 //@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 //@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 //@permissions User permissions in the chat
//@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 chatMemberStatusRestricted is_member:Bool restricted_until_date:int32 permissions:chatPermissions = ChatMemberStatus;
//@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;
//@description The user is not a chat member //@description The user is not a chat member
chatMemberStatusLeft = ChatMemberStatus; chatMemberStatusLeft = ChatMemberStatus;
@ -360,6 +377,9 @@ chatMembers total_count:int32 members:vector<chatMember> = ChatMembers;
//@class ChatMembersFilter @description Specifies the kind of chat members to return in searchChatMembers //@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 //@description Returns the creator and administrators
chatMembersFilterAdministrators = ChatMembersFilter; chatMembersFilterAdministrators = ChatMembersFilter;
@ -381,6 +401,9 @@ chatMembersFilterBots = ChatMembersFilter;
//@description Returns recently active users in reverse chronological order //@description Returns recently active users in reverse chronological order
supergroupMembersFilterRecent = SupergroupMembersFilter; 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 //@description Returns the creator and administrators
supergroupMembersFilterAdministrators = SupergroupMembersFilter; supergroupMembersFilterAdministrators = SupergroupMembersFilter;
@ -401,13 +424,12 @@ supergroupMembersFilterBots = SupergroupMembersFilter;
//@id Group identifier //@id Group identifier
//@member_count Number of members in the group //@member_count Number of members in the group
//@status Status of the current user 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 //@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 //@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 //@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 creator_user_id:int32 members:vector<chatMember> invite_link:string = BasicGroupFullInfo; basicGroupFullInfo description:string creator_user_id:int32 members:vector<chatMember> 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 //@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<chatMember> 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 //@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 //@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 //@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 //@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_channel True, if the supergroup is a channel
//@is_verified True, if the supergroup or channel is verified //@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}". //@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) //-{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 //@description Contains full information about a supergroup or channel
//@param_description Supergroup or channel description //@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 //@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; 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; messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin;
//@description The message was originally a post in a channel //@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 //@description Contains information about a forwarded message
//@origin Origin of a forwarded message //@origin Origin of a forwarded message
//@date Point in time (Unix timestamp) when the message was originally sent //@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_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), the identifier of the original message from which the new 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; 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 //@description The message is being sent now, but has not yet been delivered to the server
messageSendingStatePending = MessageSendingState; messageSendingStatePending = MessageSendingState;
//@description The message failed to be sent //@description The message failed to be sent @error_code An error code; 0 if unknown @error_message Error message
messageSendingStateFailed = MessageSendingState; //@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 //@description Describes a message
//@id Message identifier, unique for the chat to which the message belongs //@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 //@chat_id Chat identifier
//@sending_state Information about the sending state of the message; may be null //@sending_state Information about the sending state of the message; may be null
//@is_outgoing True, if the message is outgoing //@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 //@type Type of the chat
//@title Chat title //@title Chat title
//@photo Chat photo; may be null //@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 //@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 //@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 //@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 //@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 //@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 //@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 //@description Represents a list of chats @chat_ids List of chat identifiers
chats chat_ids:vector<int53> = Chats; chats chat_ids:vector<int53> = Chats;
@ -618,7 +642,7 @@ chatInviteLink invite_link:string = ChatInviteLink;
//@photo Chat photo; may be null //@photo Chat photo; may be null
//@member_count Number of members //@member_count Number of members
//@member_user_ids User identifiers of some chat members that may be known to the current user //@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<int32> is_public:Bool = ChatInviteLinkInfo; chatInviteLinkInfo chat_id:int53 type:ChatType title:string photo:chatPhoto member_count:int32 member_user_ids:vector<int32> 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 //@description A button that opens a specified URL @url HTTP or tg:// URL to open
inlineKeyboardButtonTypeUrl url:string = InlineKeyboardButtonType; 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 //@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; inlineKeyboardButtonTypeCallback data:bytes = InlineKeyboardButtonType;
@ -721,8 +748,8 @@ richTextMarked text:RichText = RichText;
richTextPhoneNumber text:RichText phone_number:string = 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 //@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 //@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 //@height Height of a bounding box in which the image should be shown; 0 if unknown
richTextIcon document:document width:int32 height:int32 = RichText; richTextIcon document:document width:int32 height:int32 = RichText;
//@description A rich text anchor @text Text @name Anchor name //@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 //@description A page cover @cover Cover
pageBlockCover cover:PageBlock = PageBlock; 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; 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<PageBlock> caption:pageBlockCaption = PageBlock; pageBlockEmbeddedPost url:string author:string author_photo:photo date:int32 page_blocks:vector<PageBlock> caption:pageBlockCaption = PageBlock;
//@description A collage @page_blocks Collage item contents @caption Block caption //@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 //@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<string> = InputMessageContent; inputMessagePoll question:string options:vector<string> = 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 //@description A forwarded message @from_chat_id Identifier for the chat this forwarded message came from @message_id Identifier of the message to forward
inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool = InputMessageContent; //@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 //@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 //@description Represents a list of stickers @stickers List of stickers
stickers stickers:vector<sticker> = Stickers; stickers stickers:vector<sticker> = 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 //@description Represents a list of emoji @emojis List of emojis
stickerEmojis emojis:vector<string> = StickerEmojis; emojis emojis:vector<string> = 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 //@description Represents a sticker set
//@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 //@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_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 //@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
stickerSet id:int64 title:string name:string is_installed:Bool is_archived:Bool is_official:Bool is_masks:Bool is_viewed:Bool stickers:vector<sticker> emojis:vector<stickerEmojis> = StickerSet; //@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<sticker> emojis:vector<emojis> = 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 //@description Represents short information about a sticker set
//@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 //@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_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 //@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
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<sticker> = StickerSetInfo; //@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<sticker> = StickerSetInfo;
//@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets //@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<stickerSetInfo> = StickerSets; stickerSets total_count:int32 sets:vector<stickerSetInfo> = StickerSets;
@ -1597,10 +1631,41 @@ callStateDiscarded reason:CallDiscardReason need_rating:Bool need_debug_informat
callStateError error:error = CallState; 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 //@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; 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 //@description Represents a list of animations @animations List of animations
animations animations:vector<animation> = Animations; animations animations:vector<animation> = 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 //@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; 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 //@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 sticker (sticker file size must not exceed 5MB) @sticker_width Width of the sticker @sticker_height Height of the sticker //@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 //@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 //@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; 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 //@description A message was deleted @message Deleted message
chatEventMessageDeleted message:message = ChatEventAction; 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 //@description A message was pinned @message Pinned message
chatEventMessagePinned message:message = ChatEventAction; 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 //@description The chat title was changed @old_title Previous chat title @new_title New chat title
chatEventTitleChanged old_title:string new_title:string = ChatEventAction; 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 //@description The chat description was changed @old_description Previous chat description @new_description New chat description
chatEventDescriptionChanged old_description:string new_description:string = ChatEventAction; 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; 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 //@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 //@description The can_invite_users permission of a supergroup chat was toggled @can_invite_users New value of can_invite_users permission
chatEventInvitesToggled anyone_can_invite:Bool = ChatEventAction; chatEventInvitesToggled can_invite_users:Bool = ChatEventAction;
//@description The sign_messages setting of a channel was toggled @sign_messages New value of sign_messages //@description The sign_messages setting of a channel was toggled @sign_messages New value of sign_messages
chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction; chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction;
@ -1907,11 +1978,44 @@ deviceTokenTizenPush reg_id:string = DeviceToken;
pushReceiverId id:int64 = PushReceiverId; 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 //@class BackgroundType @description Describes a type of a background
wallpaper id:int32 sizes:vector<photoSize> color:int32 = Wallpaper;
//@description Contains a list of wallpapers @wallpapers A list of wallpapers //@description A wallpaper in JPEG format
wallpapers wallpapers:vector<wallpaper> = Wallpapers; //@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<background> = 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 //@description Contains a list of hashtags @hashtags A list of hashtags
@ -1929,7 +2033,7 @@ checkChatUsernameResultUsernameInvalid = CheckChatUsernameResult;
//@description The username is occupied //@description The username is occupied
checkChatUsernameResultUsernameOccupied = CheckChatUsernameResult; 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; checkChatUsernameResultPublicChatsTooMuch = CheckChatUsernameResult;
//@description The user can't be a member of a public supergroup //@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 //@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; 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; 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 //@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<UserPrivacySettingRule> = UserPrivacySettin
//@description A privacy setting for managing whether the user's online status is visible //@description A privacy setting for managing whether the user's online status is visible
userPrivacySettingShowStatus = UserPrivacySetting; 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 //@description A privacy setting for managing whether the user can be invited to chats
userPrivacySettingAllowChatInvites = UserPrivacySetting; userPrivacySettingAllowChatInvites = UserPrivacySetting;
@ -2196,9 +2306,16 @@ chatReportReasonCopyright = ChatReportReason;
chatReportReasonCustom text:string = 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; 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 //@description Contains a part of a file @data File bytes
filePart data:bytes = FilePart; filePart data:bytes = FilePart;
@ -2251,7 +2368,7 @@ fileTypeVideoNote = FileType;
//@description The file is a voice note //@description The file is a voice note
fileTypeVoiceNote = FileType; fileTypeVoiceNote = FileType;
//@description The file is a wallpaper //@description The file is a wallpaper or a background pattern
fileTypeWallpaper = FileType; fileTypeWallpaper = FileType;
@ -2305,9 +2422,26 @@ networkStatisticsEntryCall network_type:NetworkType sent_bytes:int53 received_by
networkStatistics since_date:int32 entries:vector<NetworkStatisticsEntry> = NetworkStatistics; networkStatistics since_date:int32 entries:vector<NetworkStatisticsEntry> = 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 //@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; connectionStateWaitingForNetwork = ConnectionState;
//@description Currently establishing a connection with a proxy server //@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; 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 //@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; 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 //@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 //@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; 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 //@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; updateChatLastMessage chat_id:int53 last_message:message order:int64 = Update;
@ -2603,6 +2740,9 @@ updateFavoriteStickers sticker_ids:vector<int32> = Update;
//@description The list of saved animations was updated @animation_ids The new list of file identifiers of saved animations //@description The list of saved animations was updated @animation_ids The new list of file identifiers of saved animations
updateSavedAnimations animation_ids:vector<int32> = Update; updateSavedAnimations animation_ids:vector<int32> = 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 //@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<languagePackString> = Update; updateLanguagePackStrings localization_target:string language_pack_id:string strings:vector<languagePackString> = 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 //@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; 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 //@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 //-or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode or authorizationStateWaitPassword
setAuthenticationPhoneNumber phone_number:string allow_flash_call:Bool is_current_phone_number:Bool = Ok; //@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 //@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; 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 //@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 checkAuthenticationCode code:string = Ok;
//@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; //@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 //@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; 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 //@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; 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 //-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; 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; 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). //@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 //@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; 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 //@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; 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; 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; 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 //@chat_id Identifier of the chat to which the message belongs
//@message_id Identifier of the message //@message_id Identifier of the message
//@for_album Pass true if a link for a whole media album should be returned //@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 //@message_id Identifier of the message
getMessageLink chat_id:int53 message_id:int53 = HttpUrl; 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 //@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 //@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<InputMessageContent> = Messages; sendMessageAlbum chat_id:int53 reply_to_message_id:int53 disable_notification:Bool from_background:Bool input_message_contents:vector<InputMessageContent> = 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 //@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; 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 //@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 //@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 //@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 //@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<int53> 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<int53> 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<int53> = 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 //@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; 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 //@description Creates a new secret chat. Returns the newly created chat @user_id Identifier of the target user
createNewSecretChat user_id:int32 = Chat; 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; 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 //@chat_id Chat identifier @title New title of the chat; 1-128 characters
setChatTitle chat_id:int53 title:string = Ok; 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 //@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; 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 //@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; 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 //@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; 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; 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; 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 //@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; 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; 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/" //@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 //@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; 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 //@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 = Ok; sendCallRating call_id:int32 rating:int32 comment:string problems:vector<CallProblem> = Ok;
//@description Sends debug information for a call @call_id Call identifier @debug_information Debug information in application-specific format //@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; 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 //@description Removes a sticker from the list of favorite stickers @sticker Sticker file to delete from the list
removeFavoriteSticker sticker:InputFile = Ok; removeFavoriteSticker sticker:InputFile = Ok;
//@description Returns emoji corresponding to a sticker @sticker Sticker file identifier //@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 = StickerEmojis; 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 //@description Returns saved animations
@ -3446,8 +3612,8 @@ setBio bio:string = Ok;
setUsername username: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 //@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 //@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 allow_flash_call:Bool is_current_phone_number:Bool = AuthenticationCodeInfo; 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 //@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; resendChangePhoneNumberCode = AuthenticationCodeInfo;
@ -3476,28 +3642,18 @@ disconnectWebsite website_id:int64 = Ok;
disconnectAllWebsites = 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 //@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; 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; 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 //@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
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
toggleSupergroupSignMessages supergroup_id:int32 sign_messages:Bool = Ok; 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; 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 //@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<int53> = Ok; reportSupergroupSpam supergroup_id:int32 user_id:int32 message_ids:vector<int53> = Ok;
@ -3545,8 +3701,27 @@ deleteSavedCredentials = Ok;
//@description Returns a user that can be contacted to get support //@description Returns a user that can be contacted to get support
getSupportUser = User; 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 //@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<int53> = Ok; reportChat chat_id:int53 reason:ChatReportReason message_ids:vector<int53> = 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; 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 //@description Resets all network data usage statistics to zero. Can be called before authorization
resetNetworkStatistics = Ok; 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 //@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; 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 //@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 //@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 allow_flash_call:Bool is_current_phone_number:Bool = AuthenticationCodeInfo; 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 //@description Re-sends the code to verify a phone number to be added to a user's Telegram Passport
resendPhoneNumberVerificationCode = AuthenticationCodeInfo; resendPhoneNumberVerificationCode = AuthenticationCodeInfo;
@ -3720,8 +3901,8 @@ sendPassportAuthorizationForm autorization_form_id:int32 types:vector<PassportEl
//@description Sends phone number confirmation code. Should be called when user presses "https://t.me/confirmphone?phone=*******&hash=**********" or "tg://confirmphone?phone=*******&hash=**********" link @hash Value of the "hash" parameter from the link //@description Sends phone number confirmation code. Should be called when user presses "https://t.me/confirmphone?phone=*******&hash=**********" or "tg://confirmphone?phone=*******&hash=**********" link @hash Value of the "hash" parameter from the link
//@phone_number Value of the "phone" parameter from the link @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 //@phone_number Value of the "phone" parameter from the link @settings Settings for the authentication of the user's phone number
sendPhoneNumberConfirmationCode hash:string phone_number:string allow_flash_call:Bool is_current_phone_number:Bool = AuthenticationCodeInfo; sendPhoneNumberConfirmationCode hash:string phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo;
//@description Resends phone number confirmation code //@description Resends phone number confirmation code
resendPhoneNumberConfirmationCode = AuthenticationCodeInfo; resendPhoneNumberConfirmationCode = AuthenticationCodeInfo;
@ -3770,7 +3951,7 @@ answerCustomQuery custom_query_id:int64 data:string = Ok;
setAlarm seconds:double = Ok; setAlarm seconds:double = Ok;
//@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
getCountryCode = Text; getCountryCode = Text;
//@description Returns the default text for invitation messages to be used as a placeholder when the current user invites friends to Telegram //@description Returns the default text for invitation messages to be used as a placeholder when the current user invites friends to Telegram
@ -3858,9 +4039,11 @@ testCallVectorStringObject x:vector<testString> = TestVectorStringObject;
testSquareInt x:int32 = TestInt; testSquareInt x:int32 = TestInt;
//@description Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization //@description Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization
testNetwork = Ok; 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 //@description Forces an updates.getDifference call to the Telegram servers; for testing only
testGetDifference = Ok; 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 //@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; 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 //@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
testUseError = Error; testReturnError error:error = Error;