Module: TD::ClientMethods

Defined in:
lib/tdlib/client_methods.rb

Overview

This is a generated module from current TDLib scheme It contains all available TDLib methods

Instance Method Summary collapse

Instance Method Details

#accept_call(call_id:, protocol:) ⇒ TD::Types::Ok

Accepts an incoming call.

Parameters:

  • call_id (Integer)

    Call identifier.

  • protocol (TD::Types::CallProtocol)

    Description of the call protocols supported by the application.

Returns:



9
10
11
12
13
# File 'lib/tdlib/client_methods.rb', line 9

def accept_call(call_id:, protocol:)
  broadcast('@type'    => 'acceptCall',
            'call_id'  => call_id,
            'protocol' => protocol)
end

#accept_terms_of_service(terms_of_service_id:) ⇒ TD::Types::Ok

Accepts Telegram terms of services.

Parameters:

  • terms_of_service_id (TD::Types::String)

    Terms of service identifier.

Returns:



19
20
21
22
# File 'lib/tdlib/client_methods.rb', line 19

def accept_terms_of_service(terms_of_service_id:)
  broadcast('@type'               => 'acceptTermsOfService',
            'terms_of_service_id' => terms_of_service_id)
end

#add_chat_member(chat_id:, user_id:, forward_limit:) ⇒ TD::Types::Ok

Adds a new member to a chat. Members can’t be added to private or secret chats.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • user_id (Integer)

    Identifier of the user.

  • forward_limit (Integer)

    The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels.

Returns:



33
34
35
36
37
38
# File 'lib/tdlib/client_methods.rb', line 33

def add_chat_member(chat_id:, user_id:, forward_limit:)
  broadcast('@type'         => 'addChatMember',
            'chat_id'       => chat_id,
            'user_id'       => user_id,
            'forward_limit' => forward_limit)
end

#add_chat_members(chat_id:, user_ids:) ⇒ TD::Types::Ok

Adds multiple new members to a chat. Currently this method is only available for supergroups and channels. This method can’t be used to join a chat. Members can’t be added to a channel if it has more than 200 members.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • user_ids (Array<Integer>)

    Identifiers of the users to be added to the chat. The maximum number of added users is 20 for supergroups and 100 for channels.

Returns:



49
50
51
52
53
# File 'lib/tdlib/client_methods.rb', line 49

def add_chat_members(chat_id:, user_ids:)
  broadcast('@type'    => 'addChatMembers',
            'chat_id'  => chat_id,
            'user_ids' => user_ids)
end

#add_chat_to_list(chat_id:, chat_list:) ⇒ TD::Types::Ok

Adds a chat to a chat list. A chat can’t be simultaneously in Main and Archive chat lists, so it is automatically removed from another one if

needed.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • chat_list (TD::Types::ChatList)

    The chat list. Use getChatListsToAddChat to get suitable chat lists.

Returns:



63
64
65
66
67
# File 'lib/tdlib/client_methods.rb', line 63

def add_chat_to_list(chat_id:, chat_list:)
  broadcast('@type'     => 'addChatToList',
            'chat_id'   => chat_id,
            'chat_list' => chat_list)
end

#add_contact(contact: nil, share_phone_number:) ⇒ TD::Types::Ok

Adds a user to the contact list or edits an existing contact by their user identifier.

Parameters:

  • contact (TD::Types::Contact, nil) (defaults to: nil)

    The contact to add or edit; phone number can be empty and needs to be specified only if known, vCard is ignored.

  • share_phone_number (Boolean)

    True, if the new contact needs to be allowed to see current user’s phone number. A corresponding rule to Types::UserPrivacySetting::ShowPhoneNumber will be added if needed. Use the field UserFullInfo.need_phone_number_privacy_exception to check whether the current user needs to be asked to share their phone number.

Returns:



79
80
81
82
83
# File 'lib/tdlib/client_methods.rb', line 79

def add_contact(contact: nil, share_phone_number:)
  broadcast('@type'              => 'addContact',
            'contact'            => contact,
            'share_phone_number' => share_phone_number)
end

#add_custom_server_language_pack(language_pack_id:) ⇒ TD::Types::Ok

Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization.

Parameters:

  • language_pack_id (TD::Types::String)

    Identifier of a language pack to be added; may be different from a name that is used in an “t.me/setlanguage/” link.

Returns:



91
92
93
94
# File 'lib/tdlib/client_methods.rb', line 91

def add_custom_server_language_pack(language_pack_id:)
  broadcast('@type'            => 'addCustomServerLanguagePack',
            'language_pack_id' => language_pack_id)
end

#add_favorite_sticker(sticker:) ⇒ TD::Types::Ok

Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list.

Parameters:

Returns:



103
104
105
106
# File 'lib/tdlib/client_methods.rb', line 103

def add_favorite_sticker(sticker:)
  broadcast('@type'   => 'addFavoriteSticker',
            'sticker' => sticker)
end

#add_local_message(chat_id:, sender:, reply_to_message_id:, disable_notification:, input_message_content:) ⇒ TD::Types::Message

Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message.

Parameters:

  • chat_id (Integer)

    Target chat.

  • sender (TD::Types::MessageSender)

    The sender sender of the message.

  • reply_to_message_id (Integer)

    Identifier of the message to reply to or 0.

  • disable_notification (Boolean)

    Pass true to disable notification for the message.

  • input_message_content (TD::Types::InputMessageContent)

    The content of the message to be added.

Returns:



118
119
120
121
122
123
124
125
# File 'lib/tdlib/client_methods.rb', line 118

def add_local_message(chat_id:, sender:, reply_to_message_id:, disable_notification:, input_message_content:)
  broadcast('@type'                 => 'addLocalMessage',
            'chat_id'               => chat_id,
            'sender'                => sender,
            'reply_to_message_id'   => reply_to_message_id,
            'disable_notification'  => disable_notification,
            'input_message_content' => input_message_content)
end

#add_log_message(verbosity_level:, text:) ⇒ TD::Types::Ok

Adds a message to TDLib internal log. Can be called synchronously.

Parameters:

  • verbosity_level (Integer)

    The minimum verbosity level needed for the message to be logged; 0-1023.

  • text (TD::Types::String)

    Text of a message to log.

Returns:



133
134
135
136
137
# File 'lib/tdlib/client_methods.rb', line 133

def add_log_message(verbosity_level:, text:)
  broadcast('@type'           => 'addLogMessage',
            'verbosity_level' => verbosity_level,
            'text'            => text)
end

#add_network_statistics(entry:) ⇒ TD::Types::Ok

Adds the specified data to data usage statistics. Can be called before authorization.

Parameters:

Returns:



145
146
147
148
# File 'lib/tdlib/client_methods.rb', line 145

def add_network_statistics(entry:)
  broadcast('@type' => 'addNetworkStatistics',
            'entry' => entry)
end

#add_proxy(server:, port:, enable:, type:) ⇒ TD::Types::Proxy

Adds a proxy server for network requests. Can be called before authorization.

Parameters:

  • server (TD::Types::String)

    Proxy server IP address.

  • port (Integer)

    Proxy server port.

  • enable (Boolean)

    True, if the proxy should be enabled.

  • type (TD::Types::ProxyType)

    Proxy type.

Returns:



158
159
160
161
162
163
164
# File 'lib/tdlib/client_methods.rb', line 158

def add_proxy(server:, port:, enable:, type:)
  broadcast('@type'  => 'addProxy',
            'server' => server,
            'port'   => port,
            'enable' => enable,
            'type'   => type)
end

#add_recent_sticker(is_attached:, sticker:) ⇒ TD::Types::Stickers

Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list.

Parameters:

  • is_attached (Boolean)

    Pass true to add the sticker to the list of stickers recently attached to photo or video files; pass false to add the sticker to the list of recently sent stickers.

  • sticker (TD::Types::InputFile)

    Sticker file to add.

Returns:



175
176
177
178
179
# File 'lib/tdlib/client_methods.rb', line 175

def add_recent_sticker(is_attached:, sticker:)
  broadcast('@type'       => 'addRecentSticker',
            'is_attached' => is_attached,
            'sticker'     => sticker)
end

#add_recently_found_chat(chat_id:) ⇒ TD::Types::Ok

Adds a chat to the list of recently found chats. The chat is added to the beginning of the list. If the chat is already in the list, it will be removed from the list first.

Parameters:

  • chat_id (Integer)

    Identifier of the chat to add.

Returns:



187
188
189
190
# File 'lib/tdlib/client_methods.rb', line 187

def add_recently_found_chat(chat_id:)
  broadcast('@type'   => 'addRecentlyFoundChat',
            'chat_id' => chat_id)
end

#add_saved_animation(animation:) ⇒ TD::Types::Ok

Manually adds a new animation to the list of saved animations. The new animation is added to the beginning of the list. If the animation was already in the list, it is removed first. Only non-secret video animations with MIME type “video/mp4” can be added to the list.

Parameters:

  • animation (TD::Types::InputFile)

    The animation file to be added. Only animations known to the server (i.e. successfully sent via a message) can be added to the list.

Returns:



201
202
203
204
# File 'lib/tdlib/client_methods.rb', line 201

def add_saved_animation(animation:)
  broadcast('@type'     => 'addSavedAnimation',
            'animation' => animation)
end

#add_sticker_to_set(user_id:, name:, sticker:) ⇒ TD::Types::StickerSet

Adds a new sticker to a set; for bots only. Returns the sticker set.

Parameters:

  • user_id (Integer)

    Sticker set owner.

  • name (TD::Types::String)

    Sticker set name.

  • sticker (TD::Types::InputSticker)

    Sticker to add to the set.

Returns:



213
214
215
216
217
218
# File 'lib/tdlib/client_methods.rb', line 213

def add_sticker_to_set(user_id:, name:, sticker:)
  broadcast('@type'   => 'addStickerToSet',
            'user_id' => user_id,
            'name'    => name,
            'sticker' => sticker)
end

#answer_callback_query(callback_query_id:, text:, show_alert:, url:, cache_time:) ⇒ TD::Types::Ok

Sets the result of a callback query; for bots only.

Parameters:

  • callback_query_id (Integer)

    Identifier of the callback query.

  • text (TD::Types::String)

    Text of the answer.

  • show_alert (Boolean)

    If true, an alert should be shown to the user instead of a toast notification.

  • url (TD::Types::String)

    URL to be opened.

  • cache_time (Integer)

    Time during which the result of the query can be cached, in seconds.

Returns:



228
229
230
231
232
233
234
235
# File 'lib/tdlib/client_methods.rb', line 228

def answer_callback_query(callback_query_id:, text:, show_alert:, url:, cache_time:)
  broadcast('@type'             => 'answerCallbackQuery',
            'callback_query_id' => callback_query_id,
            'text'              => text,
            'show_alert'        => show_alert,
            'url'               => url,
            'cache_time'        => cache_time)
end

#answer_custom_query(custom_query_id:, data:) ⇒ TD::Types::Ok

Answers a custom query; for bots only.

Parameters:

  • custom_query_id (Integer)

    Identifier of a custom query.

  • data (TD::Types::String)

    JSON-serialized answer to the query.

Returns:



242
243
244
245
246
# File 'lib/tdlib/client_methods.rb', line 242

def answer_custom_query(custom_query_id:, data:)
  broadcast('@type'           => 'answerCustomQuery',
            'custom_query_id' => custom_query_id,
            'data'            => data)
end

#answer_inline_query(inline_query_id:, is_personal:, results:, cache_time:, next_offset:, switch_pm_text:, switch_pm_parameter:) ⇒ TD::Types::Ok

Sets the result of an inline query; for bots only.

Parameters:

  • inline_query_id (Integer)

    Identifier of the inline query.

  • is_personal (Boolean)

    True, if the result of the query can be cached for the specified user.

  • results (Array<TD::Types::InputInlineQueryResult>)

    The results of the query.

  • cache_time (Integer)

    Allowed time to cache the results of the query, in seconds.

  • next_offset (TD::Types::String)

    Offset for the next inline query; pass an empty string if there are no more results.

  • switch_pm_text (TD::Types::String)

    If non-empty, this text should be shown on the button that opens a private chat with the bot and sends a start message to the bot with the parameter switch_pm_parameter.

  • switch_pm_parameter (TD::Types::String)

    The parameter for the bot start message.

Returns:



260
261
262
263
264
265
266
267
268
269
270
# File 'lib/tdlib/client_methods.rb', line 260

def answer_inline_query(inline_query_id:, is_personal:, results:, cache_time:, next_offset:, switch_pm_text:,
                        switch_pm_parameter:)
  broadcast('@type'               => 'answerInlineQuery',
            'inline_query_id'     => inline_query_id,
            'is_personal'         => is_personal,
            'results'             => results,
            'cache_time'          => cache_time,
            'next_offset'         => next_offset,
            'switch_pm_text'      => switch_pm_text,
            'switch_pm_parameter' => switch_pm_parameter)
end

#answer_pre_checkout_query(pre_checkout_query_id:, error_message:) ⇒ TD::Types::Ok

Sets the result of a pre-checkout query; for bots only.

Parameters:

  • pre_checkout_query_id (Integer)

    Identifier of the pre-checkout query.

  • error_message (TD::Types::String)

    An error message, empty on success.

Returns:



277
278
279
280
281
# File 'lib/tdlib/client_methods.rb', line 277

def answer_pre_checkout_query(pre_checkout_query_id:, error_message:)
  broadcast('@type'                 => 'answerPreCheckoutQuery',
            'pre_checkout_query_id' => pre_checkout_query_id,
            'error_message'         => error_message)
end

#answer_shipping_query(shipping_query_id:, shipping_options:, error_message:) ⇒ TD::Types::Ok

Sets the result of a shipping query; for bots only.

Parameters:

  • shipping_query_id (Integer)

    Identifier of the shipping query.

  • shipping_options (Array<TD::Types::ShippingOption>)

    Available shipping options.

  • error_message (TD::Types::String)

    An error message, empty on success.

Returns:



289
290
291
292
293
294
# File 'lib/tdlib/client_methods.rb', line 289

def answer_shipping_query(shipping_query_id:, shipping_options:, error_message:)
  broadcast('@type'             => 'answerShippingQuery',
            'shipping_query_id' => shipping_query_id,
            'shipping_options'  => shipping_options,
            'error_message'     => error_message)
end

#ban_chat_member(chat_id:, member_id:, banned_until_date:, revoke_messages:) ⇒ TD::Types::Ok

Bans a member in a chat. Members can’t be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links,

etc., unless unbanned first.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • member_id (TD::Types::MessageSender)

    Member identifier.

  • banned_until_date (Integer)

    Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user is banned for more than 366 days or for less than 30 seconds from the current time, the user is considered to be banned forever. Ignored in basic groups.

  • revoke_messages (Boolean)

    Pass true to delete all messages in the chat for the user. Always true for supergroups and channels.

Returns:



310
311
312
313
314
315
316
# File 'lib/tdlib/client_methods.rb', line 310

def ban_chat_member(chat_id:, member_id:, banned_until_date:, revoke_messages:)
  broadcast('@type'             => 'banChatMember',
            'chat_id'           => chat_id,
            'member_id'         => member_id,
            'banned_until_date' => banned_until_date,
            'revoke_messages'   => revoke_messages)
end

#block_message_sender_from_replies(message_id:, delete_message:, delete_all_messages:, report_spam:) ⇒ TD::Types::Ok

Blocks an original sender of a message in the Replies chat.

Parameters:

  • message_id (Integer)

    The identifier of an incoming message in the Replies chat.

  • delete_message (Boolean)

    Pass true if the message must be deleted.

  • delete_all_messages (Boolean)

    Pass true if all messages from the same sender must be deleted.

  • report_spam (Boolean)

    Pass true if the sender must be reported to the Telegram moderators.

Returns:



325
326
327
328
329
330
331
# File 'lib/tdlib/client_methods.rb', line 325

def block_message_sender_from_replies(message_id:, delete_message:, delete_all_messages:, report_spam:)
  broadcast('@type'               => 'blockMessageSenderFromReplies',
            'message_id'          => message_id,
            'delete_message'      => delete_message,
            'delete_all_messages' => delete_all_messages,
            'report_spam'         => report_spam)
end

#can_transfer_ownershipTD::Types::CanTransferOwnershipResult

Checks whether the current session can be used to transfer a chat ownership to another user.



336
337
338
# File 'lib/tdlib/client_methods.rb', line 336

def can_transfer_ownership
  broadcast('@type' => 'canTransferOwnership')
end

#cancel_download_file(file_id:, only_if_pending:) ⇒ TD::Types::Ok

Stops the downloading of a file. If a file has already been downloaded, does nothing.

Parameters:

  • file_id (Integer)

    Identifier of a file to stop downloading.

  • only_if_pending (Boolean)

    Pass true to stop downloading only if it hasn’t been started, i.e. request hasn’t been sent to server.

Returns:



347
348
349
350
351
# File 'lib/tdlib/client_methods.rb', line 347

def cancel_download_file(file_id:, only_if_pending:)
  broadcast('@type'           => 'cancelDownloadFile',
            'file_id'         => file_id,
            'only_if_pending' => only_if_pending)
end

#cancel_upload_file(file_id:) ⇒ TD::Types::Ok

Stops the uploading of a file. Supported only for files uploaded by using uploadFile. For other files the behavior is undefined.

Parameters:

  • file_id (Integer)

    Identifier of the file to stop uploading.

Returns:



359
360
361
362
# File 'lib/tdlib/client_methods.rb', line 359

def cancel_upload_file(file_id:)
  broadcast('@type'   => 'cancelUploadFile',
            'file_id' => file_id)
end

#change_imported_contacts(contacts:) ⇒ TD::Types::ImportedContacts

Changes imported contacts using the list of contacts saved on the device. Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts. Query result depends on the result of the previous query, so only one query is possible at the same time.

Parameters:

  • contacts (Array<TD::Types::Contact>)

    The new list of contacts, contact’s vCard are ignored and are not imported.

Returns:



371
372
373
374
# File 'lib/tdlib/client_methods.rb', line 371

def change_imported_contacts(contacts:)
  broadcast('@type'    => 'changeImportedContacts',
            'contacts' => contacts)
end

#change_phone_number(phone_number:, settings:) ⇒ TD::Types::AuthenticationCodeInfo

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.

Parameters:

Returns:



383
384
385
386
387
# File 'lib/tdlib/client_methods.rb', line 383

def change_phone_number(phone_number:, settings:)
  broadcast('@type'        => 'changePhoneNumber',
            'phone_number' => phone_number,
            'settings'     => settings)
end

#change_sticker_set(set_id:, is_installed:, is_archived:) ⇒ TD::Types::Ok

Installs/uninstalls or activates/archives a sticker set.

Parameters:

  • set_id (Integer)

    Identifier of the sticker set.

  • is_installed (Boolean)

    The new value of is_installed.

  • is_archived (Boolean)

    The new value of is_archived. A sticker set can’t be installed and archived simultaneously.

Returns:



396
397
398
399
400
401
# File 'lib/tdlib/client_methods.rb', line 396

def change_sticker_set(set_id:, is_installed:, is_archived:)
  broadcast('@type'        => 'changeStickerSet',
            'set_id'       => set_id,
            'is_installed' => is_installed,
            'is_archived'  => is_archived)
end

#check_authentication_bot_token(token:) ⇒ TD::Types::Ok

Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in.

Parameters:

  • token (TD::Types::String)

    The bot token.

Returns:



409
410
411
412
# File 'lib/tdlib/client_methods.rb', line 409

def check_authentication_bot_token(token:)
  broadcast('@type' => 'checkAuthenticationBotToken',
            'token' => token)
end

#check_authentication_code(code:) ⇒ TD::Types::Ok

Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode.

Parameters:

  • code (TD::Types::String)

    The verification code received via SMS, Telegram message, phone call, or flash call.

Returns:



420
421
422
423
# File 'lib/tdlib/client_methods.rb', line 420

def check_authentication_code(code:)
  broadcast('@type' => 'checkAuthenticationCode',
            'code'  => code)
end

#check_authentication_password(password:) ⇒ TD::Types::Ok

Checks the authentication password for correctness. Works only when the current authorization state is authorizationStateWaitPassword.

Parameters:

  • password (TD::Types::String)

    The password to check.

Returns:



430
431
432
433
# File 'lib/tdlib/client_methods.rb', line 430

def check_authentication_password(password:)
  broadcast('@type'    => 'checkAuthenticationPassword',
            'password' => password)
end

#check_change_phone_number_code(code:) ⇒ TD::Types::Ok

Checks the authentication code sent to confirm a new phone number of the user.

Parameters:

  • code (TD::Types::String)

    Verification code received by SMS, phone call or flash call.

Returns:



439
440
441
442
# File 'lib/tdlib/client_methods.rb', line 439

def check_change_phone_number_code(code:)
  broadcast('@type' => 'checkChangePhoneNumberCode',
            'code'  => code)
end

Checks the validity of an invite link for a chat and returns information about the corresponding chat.

Parameters:

  • invite_link (TD::Types::String)

    Invite link to be checked; must have URL “t.me”, “telegram.me”, or “telegram.dog” and query beginning with “/joinchat/” or “/+”.

Returns:



449
450
451
452
# File 'lib/tdlib/client_methods.rb', line 449

def check_chat_invite_link(invite_link:)
  broadcast('@type'       => 'checkChatInviteLink',
            'invite_link' => invite_link)
end

#check_chat_username(chat_id:, username:) ⇒ TD::Types::CheckChatUsernameResult

Checks whether a username can be set for a chat.

Parameters:

  • chat_id (Integer)

    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 (TD::Types::String)

    Username to be checked.

Returns:



460
461
462
463
464
# File 'lib/tdlib/client_methods.rb', line 460

def check_chat_username(chat_id:, username:)
  broadcast('@type'    => 'checkChatUsername',
            'chat_id'  => chat_id,
            'username' => username)
end

#check_created_public_chats_limit(type:) ⇒ TD::Types::Ok

Checks whether the maximum number of owned public chats has been reached. Returns corresponding error if the limit was reached.

Parameters:

Returns:



471
472
473
474
# File 'lib/tdlib/client_methods.rb', line 471

def check_created_public_chats_limit(type:)
  broadcast('@type' => 'checkCreatedPublicChatsLimit',
            'type'  => type)
end

#check_database_encryption_key(encryption_key:) ⇒ TD::Types::Ok

Checks the database encryption key for correctness. Works only when the current authorization state is authorizationStateWaitEncryptionKey.

Parameters:

  • encryption_key (String)

    Encryption key to check or set up.

Returns:



481
482
483
484
# File 'lib/tdlib/client_methods.rb', line 481

def check_database_encryption_key(encryption_key:)
  broadcast('@type'          => 'checkDatabaseEncryptionKey',
            'encryption_key' => encryption_key)
end

#check_email_address_verification_code(code:) ⇒ TD::Types::Ok

Checks the email address verification code for Telegram Passport.

Parameters:

  • code (TD::Types::String)

    Verification code.

Returns:



490
491
492
493
# File 'lib/tdlib/client_methods.rb', line 490

def check_email_address_verification_code(code:)
  broadcast('@type' => 'checkEmailAddressVerificationCode',
            'code'  => code)
end

#check_phone_number_confirmation_code(code:) ⇒ TD::Types::Ok

Checks phone number confirmation code.

Parameters:

  • code (TD::Types::String)

    The phone number confirmation code.

Returns:



499
500
501
502
# File 'lib/tdlib/client_methods.rb', line 499

def check_phone_number_confirmation_code(code:)
  broadcast('@type' => 'checkPhoneNumberConfirmationCode',
            'code'  => code)
end

#check_phone_number_verification_code(code:) ⇒ TD::Types::Ok

Checks the phone number verification code for Telegram Passport.

Parameters:

  • code (TD::Types::String)

    Verification code.

Returns:



508
509
510
511
# File 'lib/tdlib/client_methods.rb', line 508

def check_phone_number_verification_code(code:)
  broadcast('@type' => 'checkPhoneNumberVerificationCode',
            'code'  => code)
end

#check_recovery_email_address_code(code:) ⇒ TD::Types::PasswordState

Checks the 2-step verification recovery email address verification code.

Parameters:

  • code (TD::Types::String)

    Verification code.

Returns:



517
518
519
520
# File 'lib/tdlib/client_methods.rb', line 517

def check_recovery_email_address_code(code:)
  broadcast('@type' => 'checkRecoveryEmailAddressCode',
            'code'  => code)
end

#clean_file_name(file_name:) ⇒ TD::Types::Text

Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously.

Parameters:

  • file_name (TD::Types::String)

    File name or path to the file.

Returns:



529
530
531
532
# File 'lib/tdlib/client_methods.rb', line 529

def clean_file_name(file_name:)
  broadcast('@type'     => 'cleanFileName',
            'file_name' => file_name)
end

#clear_all_draft_messages(exclude_secret_chats:) ⇒ TD::Types::Ok

Clears draft messages in all chats.

Parameters:

  • exclude_secret_chats (Boolean)

    If true, local draft messages in secret chats will not be cleared.

Returns:



538
539
540
541
# File 'lib/tdlib/client_methods.rb', line 538

def clear_all_draft_messages(exclude_secret_chats:)
  broadcast('@type'                => 'clearAllDraftMessages',
            'exclude_secret_chats' => exclude_secret_chats)
end

#clear_imported_contactsTD::Types::Ok

Clears all imported contacts, contact list remains unchanged.

Returns:



546
547
548
# File 'lib/tdlib/client_methods.rb', line 546

def clear_imported_contacts
  broadcast('@type' => 'clearImportedContacts')
end

#clear_recent_stickers(is_attached:) ⇒ TD::Types::Ok

Clears the list of recently used stickers.

Parameters:

  • is_attached (Boolean)

    Pass true to clear the list of stickers recently attached to photo or video files; pass false to clear the list of recently sent stickers.

Returns:



555
556
557
558
# File 'lib/tdlib/client_methods.rb', line 555

def clear_recent_stickers(is_attached:)
  broadcast('@type'       => 'clearRecentStickers',
            'is_attached' => is_attached)
end

#clear_recently_found_chatsTD::Types::Ok

Clears the list of recently found chats.

Returns:



563
564
565
# File 'lib/tdlib/client_methods.rb', line 563

def clear_recently_found_chats
  broadcast('@type' => 'clearRecentlyFoundChats')
end

#closeTD::Types::Ok

Closes the TDLib instance. All databases will be flushed to disk and properly closed. After the close completes, updateAuthorizationState with authorizationStateClosed will be sent. Can be called before initialization.

Returns:



573
574
575
# File 'lib/tdlib/client_methods.rb', line 573

def close
  broadcast('@type' => 'close')
end

#close_chat(chat_id:) ⇒ TD::Types::Ok

Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



582
583
584
585
# File 'lib/tdlib/client_methods.rb', line 582

def close_chat(chat_id:)
  broadcast('@type'   => 'closeChat',
            'chat_id' => chat_id)
end

#close_secret_chat(secret_chat_id:) ⇒ TD::Types::Ok

Closes a secret chat, effectively transferring its state to secretChatStateClosed.

Parameters:

  • secret_chat_id (Integer)

    Secret chat identifier.

Returns:



591
592
593
594
# File 'lib/tdlib/client_methods.rb', line 591

def close_secret_chat(secret_chat_id:)
  broadcast('@type'          => 'closeSecretChat',
            'secret_chat_id' => secret_chat_id)
end

#confirm_qr_code_authentication(link:) ⇒ TD::Types::Session

Confirms QR code authentication on another device. Returns created session on success.

Parameters:

  • link (TD::Types::String)

    A link from a QR code. The link must be scanned by the in-app camera.

Returns:



602
603
604
605
# File 'lib/tdlib/client_methods.rb', line 602

def confirm_qr_code_authentication(link:)
  broadcast('@type' => 'confirmQrCodeAuthentication',
            'link'  => link)
end

#create_basic_group_chat(basic_group_id:, force:) ⇒ TD::Types::Chat

Returns an existing chat corresponding to a known basic group.

Parameters:

  • basic_group_id (Integer)

    Basic group identifier.

  • force (Boolean)

    If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect.

Returns:



613
614
615
616
617
# File 'lib/tdlib/client_methods.rb', line 613

def create_basic_group_chat(basic_group_id:, force:)
  broadcast('@type'          => 'createBasicGroupChat',
            'basic_group_id' => basic_group_id,
            'force'          => force)
end

#create_call(user_id:, protocol:, is_video:) ⇒ TD::Types::CallId

Creates a new call.

Parameters:

  • user_id (Integer)

    Identifier of the user to be called.

  • protocol (TD::Types::CallProtocol)

    Description of the call protocols supported by the application.

  • is_video (Boolean)

    True, if a video call needs to be created.

Returns:



625
626
627
628
629
630
# File 'lib/tdlib/client_methods.rb', line 625

def create_call(user_id:, protocol:, is_video:)
  broadcast('@type'    => 'createCall',
            'user_id'  => user_id,
            'protocol' => protocol,
            'is_video' => is_video)
end

#create_chat_filter(filter:) ⇒ TD::Types::ChatFilterInfo

Creates new chat filter. Returns information about the created chat filter.

Parameters:

Returns:



637
638
639
640
# File 'lib/tdlib/client_methods.rb', line 637

def create_chat_filter(filter:)
  broadcast('@type'  => 'createChatFilter',
            'filter' => filter)
end

Creates a new invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • expire_date (Integer)

    Point in time (Unix timestamp) when the link will expire; pass 0 if never.

  • member_limit (Integer)

    The maximum number of chat members that can join the chat by the link simultaneously; 0-99999; pass 0 if not limited.

Returns:



651
652
653
654
655
656
# File 'lib/tdlib/client_methods.rb', line 651

def create_chat_invite_link(chat_id:, expire_date:, member_limit:)
  broadcast('@type'        => 'createChatInviteLink',
            'chat_id'      => chat_id,
            'expire_date'  => expire_date,
            'member_limit' => member_limit)
end

#create_new_basic_group_chat(user_ids:, title:) ⇒ TD::Types::Chat

Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat.

Parameters:

  • user_ids (Array<Integer>)

    Identifiers of users to be added to the basic group.

  • title (TD::Types::String)

    Title of the new basic group; 1-128 characters.

Returns:



664
665
666
667
668
# File 'lib/tdlib/client_methods.rb', line 664

def create_new_basic_group_chat(user_ids:, title:)
  broadcast('@type'    => 'createNewBasicGroupChat',
            'user_ids' => user_ids,
            'title'    => title)
end

#create_new_secret_chat(user_id:) ⇒ TD::Types::Chat

Creates a new secret chat. Returns the newly created chat.

Parameters:

  • user_id (Integer)

    Identifier of the target user.

Returns:



675
676
677
678
# File 'lib/tdlib/client_methods.rb', line 675

def create_new_secret_chat(user_id:)
  broadcast('@type'   => 'createNewSecretChat',
            'user_id' => user_id)
end

#create_new_sticker_set(user_id: nil, title: nil, name: nil, is_masks: nil, stickers:) ⇒ TD::Types::StickerSet

Creates a new sticker set; for bots only. Returns the newly created sticker set.

Parameters:

  • user_id (Integer, nil) (defaults to: nil)

    Sticker set owner.

  • title (TD::Types::String, nil) (defaults to: nil)

    Sticker set title; 1-64 characters.

  • name (TD::Types::String, nil) (defaults to: nil)

    Sticker set name. Can contain only English letters, digits and underscores. Must end with *“by<bot username>”* (*<bot_username>* is case insensitive); 1-64 characters.

  • is_masks (Boolean, nil) (defaults to: nil)

    True, if stickers are masks. Animated stickers can’t be masks.

  • stickers (Array<TD::Types::InputSticker>)

    List of stickers to be added to the set; must be non-empty. All stickers must be of the same type.

Returns:



693
694
695
696
697
698
699
700
# File 'lib/tdlib/client_methods.rb', line 693

def create_new_sticker_set(user_id: nil, title: nil, name: nil, is_masks: nil, stickers:)
  broadcast('@type'    => 'createNewStickerSet',
            'user_id'  => user_id,
            'title'    => title,
            'name'     => name,
            'is_masks' => is_masks,
            'stickers' => stickers)
end

#create_new_supergroup_chat(title:, is_channel:, description:, location:, for_import:) ⇒ TD::Types::Chat

Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat.

Parameters:

  • title (TD::Types::String)

    Title of the new chat; 1-128 characters.

  • is_channel (Boolean)

    True, if a channel chat needs to be created.

  • description (TD::Types::String)

    Chat description; 0-255 characters.

  • location (TD::Types::ChatLocation)

    Chat location if a location-based supergroup is being created.

  • for_import (Boolean)

    True, if the supergroup is created for importing messages using importMessage.

Returns:



711
712
713
714
715
716
717
718
# File 'lib/tdlib/client_methods.rb', line 711

def create_new_supergroup_chat(title:, is_channel:, description:, location:, for_import:)
  broadcast('@type'       => 'createNewSupergroupChat',
            'title'       => title,
            'is_channel'  => is_channel,
            'description' => description,
            'location'    => location,
            'for_import'  => for_import)
end

#create_private_chat(user_id:, force:) ⇒ TD::Types::Chat

Returns an existing chat corresponding to a given user.

Parameters:

  • user_id (Integer)

    User identifier.

  • force (Boolean)

    If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect.

Returns:



726
727
728
729
730
# File 'lib/tdlib/client_methods.rb', line 726

def create_private_chat(user_id:, force:)
  broadcast('@type'   => 'createPrivateChat',
            'user_id' => user_id,
            'force'   => force)
end

#create_secret_chat(secret_chat_id:) ⇒ TD::Types::Chat

Returns an existing chat corresponding to a known secret chat.

Parameters:

  • secret_chat_id (Integer)

    Secret chat identifier.

Returns:



736
737
738
739
# File 'lib/tdlib/client_methods.rb', line 736

def create_secret_chat(secret_chat_id:)
  broadcast('@type'          => 'createSecretChat',
            'secret_chat_id' => secret_chat_id)
end

#create_supergroup_chat(supergroup_id:, force:) ⇒ TD::Types::Chat

Returns an existing chat corresponding to a known supergroup or channel.

Parameters:

  • supergroup_id (Integer)

    Supergroup or channel identifier.

  • force (Boolean)

    If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect.

Returns:



747
748
749
750
751
# File 'lib/tdlib/client_methods.rb', line 747

def create_supergroup_chat(supergroup_id:, force:)
  broadcast('@type'         => 'createSupergroupChat',
            'supergroup_id' => supergroup_id,
            'force'         => force)
end

#create_temporary_password(password:, valid_for:) ⇒ TD::Types::TemporaryPasswordState

Creates a new temporary password for processing payments.

Parameters:

  • password (TD::Types::String)

    Persistent user password.

  • valid_for (Integer)

    Time during which the temporary password will be valid, in seconds; should be between 60 and 86400.

Returns:



759
760
761
762
763
# File 'lib/tdlib/client_methods.rb', line 759

def create_temporary_password(password:, valid_for:)
  broadcast('@type'     => 'createTemporaryPassword',
            'password'  => password,
            'valid_for' => valid_for)
end

#create_voice_chat(chat_id:, title: nil, start_date:) ⇒ TD::Types::GroupCallId

Creates a voice chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_voice_chats rights.

Parameters:

  • chat_id (Integer)

    Chat identifier, in which the voice chat will be created.

  • title (TD::Types::String, nil) (defaults to: nil)

    Group call title; if empty, chat title will be used.

  • start_date (Integer)

    Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the voice chat immediately. The date must be at least 10 seconds and at most 8 days in the future.

Returns:



774
775
776
777
778
779
# File 'lib/tdlib/client_methods.rb', line 774

def create_voice_chat(chat_id:, title: nil, start_date:)
  broadcast('@type'      => 'createVoiceChat',
            'chat_id'    => chat_id,
            'title'      => title,
            'start_date' => start_date)
end

#delete_account(reason: nil) ⇒ TD::Types::Ok

Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. Can be called before authorization when the current authorization state is authorizationStateWaitPassword.

Parameters:

  • reason (TD::Types::String, nil) (defaults to: nil)

    The reason why the account was deleted; optional.

Returns:



787
788
789
790
# File 'lib/tdlib/client_methods.rb', line 787

def (reason: nil)
  broadcast('@type'  => 'deleteAccount',
            'reason' => reason)
end

#delete_all_call_messages(revoke:) ⇒ TD::Types::Ok

Deletes all call messages.

Parameters:

  • revoke (Boolean)

    Pass true to delete the messages for all users.

Returns:



796
797
798
799
# File 'lib/tdlib/client_methods.rb', line 796

def delete_all_call_messages(revoke:)
  broadcast('@type'  => 'deleteAllCallMessages',
            'revoke' => revoke)
end

Deletes all revoked chat invite links created by a given chat administrator. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for

other links.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • creator_user_id (Integer)

    User identifier of a chat administrator, which links will be deleted. Must be an identifier of the current user for non-owner.

Returns:



809
810
811
812
813
# File 'lib/tdlib/client_methods.rb', line 809

def delete_all_revoked_chat_invite_links(chat_id:, creator_user_id:)
  broadcast('@type'           => 'deleteAllRevokedChatInviteLinks',
            'chat_id'         => chat_id,
            'creator_user_id' => creator_user_id)
end

#delete_chat(chat_id:) ⇒ TD::Types::Ok

Deletes a chat along with all messages in the corresponding chat for all chat members; requires owner privileges. For group chats this will release the username and remove all members. Chats with more than 1000 members can’t be deleted using this method.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



821
822
823
824
# File 'lib/tdlib/client_methods.rb', line 821

def delete_chat(chat_id:)
  broadcast('@type'   => 'deleteChat',
            'chat_id' => chat_id)
end

#delete_chat_filter(chat_filter_id:) ⇒ TD::Types::Ok

Deletes existing chat filter.

Parameters:

  • chat_filter_id (Integer)

    Chat filter identifier.

Returns:



830
831
832
833
# File 'lib/tdlib/client_methods.rb', line 830

def delete_chat_filter(chat_filter_id:)
  broadcast('@type'          => 'deleteChatFilter',
            'chat_filter_id' => chat_filter_id)
end

#delete_chat_history(chat_id:, remove_from_chat_list:, revoke:) ⇒ TD::Types::Ok

Deletes all messages in the chat. Use Chat.can_be_deleted_only_for_self and Chat.can_be_deleted_for_all_users fields to find whether and how the

method can be applied to the chat.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • remove_from_chat_list (Boolean)

    Pass true if the chat should be removed from the chat list.

  • revoke (Boolean)

    Pass true to try to delete chat history for all users.

Returns:



843
844
845
846
847
848
# File 'lib/tdlib/client_methods.rb', line 843

def delete_chat_history(chat_id:, remove_from_chat_list:, revoke:)
  broadcast('@type'                 => 'deleteChatHistory',
            'chat_id'               => chat_id,
            'remove_from_chat_list' => remove_from_chat_list,
            'revoke'                => revoke)
end

#delete_chat_messages_from_user(chat_id:, user_id:) ⇒ TD::Types::Ok

Deletes all messages sent by the specified user to a chat. Supported only for supergroups; requires can_delete_messages administrator privileges.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • user_id (Integer)

    User identifier.

Returns:



856
857
858
859
860
# File 'lib/tdlib/client_methods.rb', line 856

def delete_chat_messages_from_user(chat_id:, user_id:)
  broadcast('@type'   => 'deleteChatMessagesFromUser',
            'chat_id' => chat_id,
            'user_id' => user_id)
end

#delete_chat_reply_markup(chat_id:, message_id:) ⇒ TD::Types::Ok

Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a ForceReply reply markup has been used. UpdateChatReplyMarkup will be sent if the reply markup will be changed.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • message_id (Integer)

    The message identifier of the used keyboard.

Returns:



869
870
871
872
873
# File 'lib/tdlib/client_methods.rb', line 869

def delete_chat_reply_markup(chat_id:, message_id:)
  broadcast('@type'      => 'deleteChatReplyMarkup',
            'chat_id'    => chat_id,
            'message_id' => message_id)
end

#delete_file(file_id:) ⇒ TD::Types::Ok

Deletes a file from the TDLib file cache.

Parameters:

  • file_id (Integer)

    Identifier of the file to delete.

Returns:



879
880
881
882
# File 'lib/tdlib/client_methods.rb', line 879

def delete_file(file_id:)
  broadcast('@type'   => 'deleteFile',
            'file_id' => file_id)
end

#delete_language_pack(language_pack_id:) ⇒ TD::Types::Ok

Deletes all information about a language pack in the current localization target. The language pack which is currently in use (including base language pack) or is being synchronized can’t be

deleted.

Can be called before authorization.

Parameters:

  • language_pack_id (TD::Types::String)

    Identifier of the language pack to delete.

Returns:



891
892
893
894
# File 'lib/tdlib/client_methods.rb', line 891

def delete_language_pack(language_pack_id:)
  broadcast('@type'            => 'deleteLanguagePack',
            'language_pack_id' => language_pack_id)
end

#delete_messages(chat_id:, message_ids:, revoke:) ⇒ TD::Types::Ok

Deletes messages.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • message_ids (Array<Integer>)

    Identifiers of the messages to be deleted.

  • revoke (Boolean)

    Pass true to try to delete messages for all chat members. Always true for supergroups, channels and secret chats.

Returns:



903
904
905
906
907
908
# File 'lib/tdlib/client_methods.rb', line 903

def delete_messages(chat_id:, message_ids:, revoke:)
  broadcast('@type'       => 'deleteMessages',
            'chat_id'     => chat_id,
            'message_ids' => message_ids,
            'revoke'      => revoke)
end

#delete_passport_element(type:) ⇒ TD::Types::Ok

Deletes a Telegram Passport element.

Parameters:

Returns:



914
915
916
917
# File 'lib/tdlib/client_methods.rb', line 914

def delete_passport_element(type:)
  broadcast('@type' => 'deletePassportElement',
            'type'  => type)
end

#delete_profile_photo(profile_photo_id:) ⇒ TD::Types::Ok

Deletes a profile photo.

Parameters:

  • profile_photo_id (Integer)

    Identifier of the profile photo to delete.

Returns:



923
924
925
926
# File 'lib/tdlib/client_methods.rb', line 923

def delete_profile_photo(profile_photo_id:)
  broadcast('@type'            => 'deleteProfilePhoto',
            'profile_photo_id' => profile_photo_id)
end

Deletes revoked chat invite links. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for

other links.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • invite_link (TD::Types::String)

    Invite link to revoke.

Returns:



935
936
937
938
939
# File 'lib/tdlib/client_methods.rb', line 935

def delete_revoked_chat_invite_link(chat_id:, invite_link:)
  broadcast('@type'       => 'deleteRevokedChatInviteLink',
            'chat_id'     => chat_id,
            'invite_link' => invite_link)
end

#delete_saved_credentialsTD::Types::Ok

Deletes saved credentials for all payment provider bots.

Returns:



944
945
946
# File 'lib/tdlib/client_methods.rb', line 944

def delete_saved_credentials
  broadcast('@type' => 'deleteSavedCredentials')
end

#delete_saved_order_infoTD::Types::Ok

Deletes saved order info.

Returns:



951
952
953
# File 'lib/tdlib/client_methods.rb', line 951

def delete_saved_order_info
  broadcast('@type' => 'deleteSavedOrderInfo')
end

#destroyTD::Types::Ok

Closes the TDLib instance, destroying all local data without a proper logout. The current user session will remain in the list of all active sessions. All local data will be destroyed. After the destruction completes updateAuthorizationState with authorizationStateClosed will be sent. Can be called before authorization.

Returns:



962
963
964
# File 'lib/tdlib/client_methods.rb', line 962

def destroy
  broadcast('@type' => 'destroy')
end

#disable_proxyTD::Types::Ok

Disables the currently enabled proxy. Can be called before authorization.

Returns:



970
971
972
# File 'lib/tdlib/client_methods.rb', line 970

def disable_proxy
  broadcast('@type' => 'disableProxy')
end

#discard_call(call_id:, is_disconnected:, duration:, is_video:, connection_id:) ⇒ TD::Types::Ok

Discards a call.

Parameters:

  • call_id (Integer)

    Call identifier.

  • is_disconnected (Boolean)

    True, if the user was disconnected.

  • duration (Integer)

    The call duration, in seconds.

  • is_video (Boolean)

    True, if the call was a video call.

  • connection_id (Integer)

    Identifier of the connection used during the call.

Returns:



982
983
984
985
986
987
988
989
# File 'lib/tdlib/client_methods.rb', line 982

def discard_call(call_id:, is_disconnected:, duration:, is_video:, connection_id:)
  broadcast('@type'           => 'discardCall',
            'call_id'         => call_id,
            'is_disconnected' => is_disconnected,
            'duration'        => duration,
            'is_video'        => is_video,
            'connection_id'   => connection_id)
end

#discard_group_call(group_call_id:) ⇒ TD::Types::Ok

Discards a group call. Requires groupCall.can_be_managed.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

Returns:



996
997
998
999
# File 'lib/tdlib/client_methods.rb', line 996

def discard_group_call(group_call_id:)
  broadcast('@type'         => 'discardGroupCall',
            'group_call_id' => group_call_id)
end

#disconnect_all_websitesTD::Types::Ok

Disconnects all websites from the current user’s Telegram account.

Returns:



1004
1005
1006
# File 'lib/tdlib/client_methods.rb', line 1004

def disconnect_all_websites
  broadcast('@type' => 'disconnectAllWebsites')
end

#disconnect_website(website_id:) ⇒ TD::Types::Ok

Disconnects website from the current user’s Telegram account.

Parameters:

  • website_id (Integer)

    Website identifier.

Returns:



1012
1013
1014
1015
# File 'lib/tdlib/client_methods.rb', line 1012

def disconnect_website(website_id:)
  broadcast('@type'      => 'disconnectWebsite',
            'website_id' => website_id)
end

#download_file(file_id:, priority:, offset:, limit:, synchronous:) ⇒ TD::Types::File

Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates.

Parameters:

  • file_id (Integer)

    Identifier of the file to download.

  • priority (Integer)

    Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first.

  • offset (Integer)

    The starting position from which the file should be downloaded.

  • limit (Integer)

    Number of bytes which should be downloaded starting from the “offset” position before the download will be automatically cancelled; use 0 to download without a limit.

  • synchronous (Boolean)

    If false, this request returns file state just after the download has been started. If true, this request returns file state only after the download has succeeded, has failed, has been cancelled or a new downloadFile request with different offset/limit parameters was sent.

Returns:



1032
1033
1034
1035
1036
1037
1038
1039
# File 'lib/tdlib/client_methods.rb', line 1032

def download_file(file_id:, priority:, offset:, limit:, synchronous:)
  broadcast('@type'       => 'downloadFile',
            'file_id'     => file_id,
            'priority'    => priority,
            'offset'      => offset,
            'limit'       => limit,
            'synchronous' => synchronous)
end

#edit_chat_filter(chat_filter_id:, filter:) ⇒ TD::Types::ChatFilterInfo

Edits existing chat filter. Returns information about the edited chat filter.

Parameters:

  • chat_filter_id (Integer)

    Chat filter identifier.

  • filter (TD::Types::ChatFilter)

    The edited chat filter.

Returns:



1047
1048
1049
1050
1051
# File 'lib/tdlib/client_methods.rb', line 1047

def edit_chat_filter(chat_filter_id:, filter:)
  broadcast('@type'          => 'editChatFilter',
            'chat_filter_id' => chat_filter_id,
            'filter'         => filter)
end

Edits a non-primary invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for

other links.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • invite_link (TD::Types::String)

    Invite link to be edited.

  • expire_date (Integer)

    Point in time (Unix timestamp) when the link will expire; pass 0 if never.

  • member_limit (Integer)

    The maximum number of chat members that can join the chat by the link simultaneously; 0-99999; pass 0 if not limited.

Returns:



1064
1065
1066
1067
1068
1069
1070
# File 'lib/tdlib/client_methods.rb', line 1064

def edit_chat_invite_link(chat_id:, invite_link:, expire_date:, member_limit:)
  broadcast('@type'        => 'editChatInviteLink',
            'chat_id'      => chat_id,
            'invite_link'  => invite_link,
            'expire_date'  => expire_date,
            'member_limit' => member_limit)
end

#edit_custom_language_pack_info(info:) ⇒ TD::Types::Ok

Edits information about a custom local language pack in the current localization target. Can be called before authorization.

Parameters:

Returns:



1077
1078
1079
1080
# File 'lib/tdlib/client_methods.rb', line 1077

def edit_custom_language_pack_info(info:)
  broadcast('@type' => 'editCustomLanguagePackInfo',
            'info'  => info)
end

#edit_inline_message_caption(inline_message_id:, reply_markup:, caption:) ⇒ TD::Types::Ok

Edits the caption of an inline message sent via a bot; for bots only.

Parameters:

  • inline_message_id (TD::Types::String)

    Inline message identifier.

  • reply_markup (TD::Types::ReplyMarkup)

    The new message reply markup.

  • caption (TD::Types::FormattedText)

    New message content caption; 0-GetOption(“message_caption_length_max”) characters.

Returns:



1089
1090
1091
1092
1093
1094
# File 'lib/tdlib/client_methods.rb', line 1089

def edit_inline_message_caption(inline_message_id:, reply_markup:, caption:)
  broadcast('@type'             => 'editInlineMessageCaption',
            'inline_message_id' => inline_message_id,
            'reply_markup'      => reply_markup,
            'caption'           => caption)
end

#edit_inline_message_live_location(inline_message_id:, reply_markup:, location: nil, heading:, proximity_alert_radius:) ⇒ TD::Types::Ok

Edits the content of a live location in an inline message sent via a bot; for bots only.

Parameters:

  • inline_message_id (TD::Types::String)

    Inline message identifier.

  • reply_markup (TD::Types::ReplyMarkup)

    The new message reply markup.

  • location (TD::Types::Location, nil) (defaults to: nil)

    New location content of the message; may be null. Pass null to stop sharing the live location.

  • heading (Integer)

    The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown.

  • proximity_alert_radius (Integer)

    The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled.

Returns:



1107
1108
1109
1110
1111
1112
1113
1114
1115
# File 'lib/tdlib/client_methods.rb', line 1107

def edit_inline_message_live_location(inline_message_id:, reply_markup:, location: nil, heading:,
                                      proximity_alert_radius:)
  broadcast('@type'                  => 'editInlineMessageLiveLocation',
            'inline_message_id'      => inline_message_id,
            'reply_markup'           => reply_markup,
            'location'               => location,
            'heading'                => heading,
            'proximity_alert_radius' => proximity_alert_radius)
end

#edit_inline_message_media(inline_message_id:, reply_markup:, input_message_content:) ⇒ TD::Types::Ok

Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message

sent via a bot; for bots only.

Parameters:

Returns:



1126
1127
1128
1129
1130
1131
# File 'lib/tdlib/client_methods.rb', line 1126

def edit_inline_message_media(inline_message_id:, reply_markup:, input_message_content:)
  broadcast('@type'                 => 'editInlineMessageMedia',
            'inline_message_id'     => inline_message_id,
            'reply_markup'          => reply_markup,
            'input_message_content' => input_message_content)
end

#edit_inline_message_reply_markup(inline_message_id:, reply_markup:) ⇒ TD::Types::Ok

Edits the reply markup of an inline message sent via a bot; for bots only.

Parameters:

  • inline_message_id (TD::Types::String)

    Inline message identifier.

  • reply_markup (TD::Types::ReplyMarkup)

    The new message reply markup.

Returns:



1138
1139
1140
1141
1142
# File 'lib/tdlib/client_methods.rb', line 1138

def edit_inline_message_reply_markup(inline_message_id:, reply_markup:)
  broadcast('@type'             => 'editInlineMessageReplyMarkup',
            'inline_message_id' => inline_message_id,
            'reply_markup'      => reply_markup)
end

#edit_inline_message_text(inline_message_id:, reply_markup:, input_message_content:) ⇒ TD::Types::Ok

Edits the text of an inline text or game message sent via a bot; for bots only.

Parameters:

  • inline_message_id (TD::Types::String)

    Inline message identifier.

  • reply_markup (TD::Types::ReplyMarkup)

    The new message reply markup.

  • input_message_content (TD::Types::InputMessageContent)

    New text content of the message. Should be of type inputMessageText.

Returns:



1151
1152
1153
1154
1155
1156
# File 'lib/tdlib/client_methods.rb', line 1151

def edit_inline_message_text(inline_message_id:, reply_markup:, input_message_content:)
  broadcast('@type'                 => 'editInlineMessageText',
            'inline_message_id'     => inline_message_id,
            'reply_markup'          => reply_markup,
            'input_message_content' => input_message_content)
end

#edit_message_caption(chat_id:, message_id:, reply_markup:, caption:) ⇒ TD::Types::Message

Edits the message content caption. Returns the edited message after the edit is completed on the server side.

Parameters:

  • chat_id (Integer)

    The chat the message belongs to.

  • message_id (Integer)

    Identifier of the message.

  • reply_markup (TD::Types::ReplyMarkup)

    The new message reply markup; for bots only.

  • caption (TD::Types::FormattedText)

    New message content caption; 0-GetOption(“message_caption_length_max”) characters.

Returns:



1167
1168
1169
1170
1171
1172
1173
# File 'lib/tdlib/client_methods.rb', line 1167

def edit_message_caption(chat_id:, message_id:, reply_markup:, caption:)
  broadcast('@type'        => 'editMessageCaption',
            'chat_id'      => chat_id,
            'message_id'   => message_id,
            'reply_markup' => reply_markup,
            'caption'      => caption)
end

#edit_message_live_location(chat_id:, message_id:, reply_markup:, location: nil, heading:, proximity_alert_radius:) ⇒ TD::Types::Message

Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side.

Parameters:

  • chat_id (Integer)

    The chat the message belongs to.

  • message_id (Integer)

    Identifier of the message.

  • reply_markup (TD::Types::ReplyMarkup)

    The new message reply markup; for bots only.

  • location (TD::Types::Location, nil) (defaults to: nil)

    New location content of the message; may be null. Pass null to stop sharing the live location.

  • heading (Integer)

    The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown.

  • proximity_alert_radius (Integer)

    The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled.

Returns:



1189
1190
1191
1192
1193
1194
1195
1196
1197
# File 'lib/tdlib/client_methods.rb', line 1189

def edit_message_live_location(chat_id:, message_id:, reply_markup:, location: nil, heading:, proximity_alert_radius:)
  broadcast('@type'                  => 'editMessageLiveLocation',
            'chat_id'                => chat_id,
            'message_id'             => message_id,
            'reply_markup'           => reply_markup,
            'location'               => location,
            'heading'                => heading,
            'proximity_alert_radius' => proximity_alert_radius)
end

#edit_message_media(chat_id:, message_id:, reply_markup:, input_message_content:) ⇒ TD::Types::Message

Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can’t be replaced if the message was set to self-destruct. Media can’t be replaced by self-destructing media. Media in an album can be edited only to contain a photo or a video. Returns the edited message after the edit is completed on the server side.

Parameters:

  • chat_id (Integer)

    The chat the message belongs to.

  • message_id (Integer)

    Identifier of the message.

  • reply_markup (TD::Types::ReplyMarkup)

    The new message reply markup; for bots only.

  • input_message_content (TD::Types::InputMessageContent)

    New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, Types::InputMessageContent::Photo or inputMessageVideo.

Returns:



1212
1213
1214
1215
1216
1217
1218
# File 'lib/tdlib/client_methods.rb', line 1212

def edit_message_media(chat_id:, message_id:, reply_markup:, input_message_content:)
  broadcast('@type'                 => 'editMessageMedia',
            'chat_id'               => chat_id,
            'message_id'            => message_id,
            'reply_markup'          => reply_markup,
            'input_message_content' => input_message_content)
end

#edit_message_reply_markup(chat_id:, message_id:, reply_markup:) ⇒ TD::Types::Message

Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side.

Parameters:

  • chat_id (Integer)

    The chat the message belongs to.

  • message_id (Integer)

    Identifier of the message.

  • reply_markup (TD::Types::ReplyMarkup)

    The new message reply markup.

Returns:



1227
1228
1229
1230
1231
1232
# File 'lib/tdlib/client_methods.rb', line 1227

def edit_message_reply_markup(chat_id:, message_id:, reply_markup:)
  broadcast('@type'        => 'editMessageReplyMarkup',
            'chat_id'      => chat_id,
            'message_id'   => message_id,
            'reply_markup' => reply_markup)
end

#edit_message_scheduling_state(chat_id:, message_id:, scheduling_state:) ⇒ TD::Types::Ok

Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed.

Parameters:

  • chat_id (Integer)

    The chat the message belongs to.

  • message_id (Integer)

    Identifier of the message.

  • scheduling_state (TD::Types::MessageSchedulingState)

    The new message scheduling state. Pass null to send the message immediately.

Returns:



1242
1243
1244
1245
1246
1247
# File 'lib/tdlib/client_methods.rb', line 1242

def edit_message_scheduling_state(chat_id:, message_id:, scheduling_state:)
  broadcast('@type'            => 'editMessageSchedulingState',
            'chat_id'          => chat_id,
            'message_id'       => message_id,
            'scheduling_state' => scheduling_state)
end

#edit_message_text(chat_id:, message_id:, reply_markup:, input_message_content:) ⇒ TD::Types::Message

Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side.

Parameters:

  • chat_id (Integer)

    The chat the message belongs to.

  • message_id (Integer)

    Identifier of the message.

  • reply_markup (TD::Types::ReplyMarkup)

    The new message reply markup; for bots only.

  • input_message_content (TD::Types::InputMessageContent)

    New text content of the message. Should be of type inputMessageText.

Returns:



1258
1259
1260
1261
1262
1263
1264
# File 'lib/tdlib/client_methods.rb', line 1258

def edit_message_text(chat_id:, message_id:, reply_markup:, input_message_content:)
  broadcast('@type'                 => 'editMessageText',
            'chat_id'               => chat_id,
            'message_id'            => message_id,
            'reply_markup'          => reply_markup,
            'input_message_content' => input_message_content)
end

#edit_proxy(proxy_id:, server:, port:, enable:, type:) ⇒ TD::Types::Proxy

Edits an existing proxy server for network requests. Can be called before authorization.

Parameters:

  • proxy_id (Integer)

    Proxy identifier.

  • server (TD::Types::String)

    Proxy server IP address.

  • port (Integer)

    Proxy server port.

  • enable (Boolean)

    True, if the proxy should be enabled.

  • type (TD::Types::ProxyType)

    Proxy type.

Returns:



1275
1276
1277
1278
1279
1280
1281
1282
# File 'lib/tdlib/client_methods.rb', line 1275

def edit_proxy(proxy_id:, server:, port:, enable:, type:)
  broadcast('@type'    => 'editProxy',
            'proxy_id' => proxy_id,
            'server'   => server,
            'port'     => port,
            'enable'   => enable,
            'type'     => type)
end

#enable_proxy(proxy_id:) ⇒ TD::Types::Ok

Enables a proxy. Only one proxy can be enabled at a time. Can be called before authorization.

Parameters:

  • proxy_id (Integer)

    Proxy identifier.

Returns:



1290
1291
1292
1293
# File 'lib/tdlib/client_methods.rb', line 1290

def enable_proxy(proxy_id:)
  broadcast('@type'    => 'enableProxy',
            'proxy_id' => proxy_id)
end

#end_group_call_recording(group_call_id:) ⇒ TD::Types::Ok

Ends recording of an active group call. Requires groupCall.can_be_managed group call flag.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

Returns:



1300
1301
1302
1303
# File 'lib/tdlib/client_methods.rb', line 1300

def end_group_call_recording(group_call_id:)
  broadcast('@type'         => 'endGroupCallRecording',
            'group_call_id' => group_call_id)
end

#finish_file_generation(generation_id:, error:) ⇒ TD::Types::Ok

Finishes the file generation.

Parameters:

  • generation_id (Integer)

    The identifier of the generation process.

  • error (TD::Types::Error)

    If set, means that file generation has failed and should be terminated.

Returns:



1310
1311
1312
1313
1314
# File 'lib/tdlib/client_methods.rb', line 1310

def finish_file_generation(generation_id:, error:)
  broadcast('@type'         => 'finishFileGeneration',
            'generation_id' => generation_id,
            'error'         => error)
end

#forward_messages(chat_id:, from_chat_id:, message_ids:, options:, send_copy:, remove_caption:) ⇒ TD::Types::Messages

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.

Parameters:

  • chat_id (Integer)

    Identifier of the chat to which to forward messages.

  • from_chat_id (Integer)

    Identifier of the chat from which to forward messages.

  • message_ids (Array<Integer>)

    Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously.

  • options (TD::Types::MessageSendOptions)

    Options to be used to send the messages.

  • send_copy (Boolean)

    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 (Boolean)

    True, if media caption of message copies needs to be removed. Ignored if send_copy is false.

Returns:



1332
1333
1334
1335
1336
1337
1338
1339
1340
# File 'lib/tdlib/client_methods.rb', line 1332

def forward_messages(chat_id:, from_chat_id:, message_ids:, options:, send_copy:, remove_caption:)
  broadcast('@type'          => 'forwardMessages',
            'chat_id'        => chat_id,
            'from_chat_id'   => from_chat_id,
            'message_ids'    => message_ids,
            'options'        => options,
            'send_copy'      => send_copy,
            'remove_caption' => remove_caption)
end

#get_account_ttlTD::Types::AccountTtl

Returns the period of inactivity after which the account of the current user will automatically be deleted.



1345
1346
1347
# File 'lib/tdlib/client_methods.rb', line 1345

def 
  broadcast('@type' => 'getAccountTtl')
end

#get_active_live_location_messagesTD::Types::Messages

Returns all active live locations that should be updated by the application. The list is persistent across application restarts only if the message database is used.

Returns:



1353
1354
1355
# File 'lib/tdlib/client_methods.rb', line 1353

def get_active_live_location_messages
  broadcast('@type' => 'getActiveLiveLocationMessages')
end

#get_active_sessionsTD::Types::Sessions

Returns all active sessions of the current user.

Returns:



1360
1361
1362
# File 'lib/tdlib/client_methods.rb', line 1360

def get_active_sessions
  broadcast('@type' => 'getActiveSessions')
end

#get_all_passport_elements(password:) ⇒ TD::Types::PassportElements

Returns all available Telegram Passport elements.

Parameters:

  • password (TD::Types::String)

    Password of the current user.

Returns:



1368
1369
1370
1371
# File 'lib/tdlib/client_methods.rb', line 1368

def get_all_passport_elements(password:)
  broadcast('@type'    => 'getAllPassportElements',
            'password' => password)
end

#get_application_configTD::Types::JsonValue

Returns application config, provided by the server. Can be called before authorization.



1377
1378
1379
# File 'lib/tdlib/client_methods.rb', line 1377

def get_application_config
  broadcast('@type' => 'getApplicationConfig')
end

#get_archived_sticker_sets(is_masks:, offset_sticker_set_id:, limit:) ⇒ TD::Types::StickerSets

Returns a list of archived sticker sets.

Parameters:

  • is_masks (Boolean)

    Pass true to return mask stickers sets; pass false to return ordinary sticker sets.

  • offset_sticker_set_id (Integer)

    Identifier of the sticker set from which to return the result.

  • limit (Integer)

    The maximum number of sticker sets to return.

Returns:



1387
1388
1389
1390
1391
1392
# File 'lib/tdlib/client_methods.rb', line 1387

def get_archived_sticker_sets(is_masks:, offset_sticker_set_id:, limit:)
  broadcast('@type'                 => 'getArchivedStickerSets',
            'is_masks'              => is_masks,
            'offset_sticker_set_id' => offset_sticker_set_id,
            'limit'                 => limit)
end

#get_attached_sticker_sets(file_id:) ⇒ TD::Types::StickerSets

Returns a list of sticker sets attached to a file. Currently only photos and videos can have attached sticker sets.

Parameters:

  • file_id (Integer)

    File identifier.

Returns:



1399
1400
1401
1402
# File 'lib/tdlib/client_methods.rb', line 1399

def get_attached_sticker_sets(file_id:)
  broadcast('@type'   => 'getAttachedStickerSets',
            'file_id' => file_id)
end

#get_authorization_stateTD::Types::AuthorizationState

Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization.



1410
1411
1412
# File 'lib/tdlib/client_methods.rb', line 1410

def get_authorization_state
  broadcast('@type' => 'getAuthorizationState')
end

#get_auto_download_settings_presetsTD::Types::AutoDownloadSettingsPresets

Returns auto-download settings presets for the current user.



1417
1418
1419
# File 'lib/tdlib/client_methods.rb', line 1417

def get_auto_download_settings_presets
  broadcast('@type' => 'getAutoDownloadSettingsPresets')
end

#get_background_url(name:, type:) ⇒ TD::Types::HttpUrl

Constructs a persistent HTTP URL for a background.

Parameters:

Returns:



1426
1427
1428
1429
1430
# File 'lib/tdlib/client_methods.rb', line 1426

def get_background_url(name:, type:)
  broadcast('@type' => 'getBackgroundUrl',
            'name'  => name,
            'type'  => type)
end

#get_backgrounds(for_dark_theme:) ⇒ TD::Types::Backgrounds

Returns backgrounds installed by the user.

Parameters:

  • for_dark_theme (Boolean)

    True, if the backgrounds must be ordered for dark theme.

Returns:



1436
1437
1438
1439
# File 'lib/tdlib/client_methods.rb', line 1436

def get_backgrounds(for_dark_theme:)
  broadcast('@type'          => 'getBackgrounds',
            'for_dark_theme' => for_dark_theme)
end

#get_bank_card_info(bank_card_number:) ⇒ TD::Types::BankCardInfo

Returns information about a bank card.

Parameters:

  • bank_card_number (TD::Types::String)

    The bank card number.

Returns:



1445
1446
1447
1448
# File 'lib/tdlib/client_methods.rb', line 1445

def get_bank_card_info(bank_card_number:)
  broadcast('@type'            => 'getBankCardInfo',
            'bank_card_number' => bank_card_number)
end

#get_basic_group(basic_group_id:) ⇒ TD::Types::BasicGroup

Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot.

Parameters:

  • basic_group_id (Integer)

    Basic group identifier.

Returns:



1455
1456
1457
1458
# File 'lib/tdlib/client_methods.rb', line 1455

def get_basic_group(basic_group_id:)
  broadcast('@type'          => 'getBasicGroup',
            'basic_group_id' => basic_group_id)
end

#get_basic_group_full_info(basic_group_id:) ⇒ TD::Types::BasicGroupFullInfo

Returns full information about a basic group by its identifier.

Parameters:

  • basic_group_id (Integer)

    Basic group identifier.

Returns:



1464
1465
1466
1467
# File 'lib/tdlib/client_methods.rb', line 1464

def get_basic_group_full_info(basic_group_id:)
  broadcast('@type'          => 'getBasicGroupFullInfo',
            'basic_group_id' => basic_group_id)
end

#get_blocked_message_senders(offset:, limit:) ⇒ TD::Types::MessageSenders

Returns users and chats that were blocked by the current user.

Parameters:

  • offset (Integer)

    Number of users and chats to skip in the result; must be non-negative.

  • limit (Integer)

    The maximum number of users and chats to return; up to 100.

Returns:



1474
1475
1476
1477
1478
# File 'lib/tdlib/client_methods.rb', line 1474

def get_blocked_message_senders(offset:, limit:)
  broadcast('@type'  => 'getBlockedMessageSenders',
            'offset' => offset,
            'limit'  => limit)
end

#get_callback_query_answer(chat_id:, message_id:, payload:) ⇒ TD::Types::CallbackQueryAnswer

Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires.

Parameters:

  • chat_id (Integer)

    Identifier of the chat with the message.

  • message_id (Integer)

    Identifier of the message from which the query originated.

  • payload (TD::Types::CallbackQueryPayload)

    Query payload.

Returns:



1487
1488
1489
1490
1491
1492
# File 'lib/tdlib/client_methods.rb', line 1487

def get_callback_query_answer(chat_id:, message_id:, payload:)
  broadcast('@type'      => 'getCallbackQueryAnswer',
            'chat_id'    => chat_id,
            'message_id' => message_id,
            'payload'    => payload)
end

#get_callback_query_message(chat_id:, message_id:, callback_query_id:) ⇒ TD::Types::Message

Returns information about a message with the callback button that originated a callback query; for bots only.

Parameters:

  • chat_id (Integer)

    Identifier of the chat the message belongs to.

  • message_id (Integer)

    Message identifier.

  • callback_query_id (Integer)

    Identifier of the callback query.

Returns:



1500
1501
1502
1503
1504
1505
# File 'lib/tdlib/client_methods.rb', line 1500

def get_callback_query_message(chat_id:, message_id:, callback_query_id:)
  broadcast('@type'             => 'getCallbackQueryMessage',
            'chat_id'           => chat_id,
            'message_id'        => message_id,
            'callback_query_id' => callback_query_id)
end

#get_chat(chat_id:) ⇒ TD::Types::Chat

Returns information about a chat by its identifier, this is an offline request if the current user is not a bot.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



1511
1512
1513
1514
# File 'lib/tdlib/client_methods.rb', line 1511

def get_chat(chat_id:)
  broadcast('@type'   => 'getChat',
            'chat_id' => chat_id)
end

#get_chat_administrators(chat_id:) ⇒ TD::Types::ChatAdministrators

Returns a list of administrators of the chat with their custom titles.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



1520
1521
1522
1523
# File 'lib/tdlib/client_methods.rb', line 1520

def get_chat_administrators(chat_id:)
  broadcast('@type'   => 'getChatAdministrators',
            'chat_id' => chat_id)
end

#get_chat_event_log(chat_id:, query:, from_event_id:, limit:, filters:, user_ids:) ⇒ TD::Types::ChatEvents

Returns a list of service actions taken by chat members and administrators in the last 48 hours. Available only for supergroups and channels. Requires administrator rights. Returns results in reverse chronological order (i. e., in order of decreasing event_id).

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • query (TD::Types::String)

    Search query by which to filter events.

  • from_event_id (Integer)

    Identifier of an event from which to return results. Use 0 to get results from the latest events.

  • limit (Integer)

    The maximum number of events to return; up to 100.

  • filters (TD::Types::ChatEventLogFilters)

    The types of events to return. By default, all types will be returned.

  • user_ids (Array<Integer>)

    User identifiers by which to filter events. By default, events relating to all users will be returned.

Returns:



1541
1542
1543
1544
1545
1546
1547
1548
1549
# File 'lib/tdlib/client_methods.rb', line 1541

def get_chat_event_log(chat_id:, query:, from_event_id:, limit:, filters:, user_ids:)
  broadcast('@type'         => 'getChatEventLog',
            'chat_id'       => chat_id,
            'query'         => query,
            'from_event_id' => from_event_id,
            'limit'         => limit,
            'filters'       => filters,
            'user_ids'      => user_ids)
end

#get_chat_filter(chat_filter_id:) ⇒ TD::Types::ChatFilter

Returns information about a chat filter by its identifier.

Parameters:

  • chat_filter_id (Integer)

    Chat filter identifier.

Returns:



1555
1556
1557
1558
# File 'lib/tdlib/client_methods.rb', line 1555

def get_chat_filter(chat_filter_id:)
  broadcast('@type'          => 'getChatFilter',
            'chat_filter_id' => chat_filter_id)
end

#get_chat_filter_default_icon_name(filter:) ⇒ TD::Types::Text

Returns default icon name for a filter. Can be called synchronously.

Parameters:

Returns:



1565
1566
1567
1568
# File 'lib/tdlib/client_methods.rb', line 1565

def get_chat_filter_default_icon_name(filter:)
  broadcast('@type'  => 'getChatFilterDefaultIconName',
            'filter' => filter)
end

#get_chat_history(chat_id:, from_message_id:, offset:, limit:, only_local:) ⇒ TD::Types::Messages

Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library. This is an offline request if only_local is true.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • from_message_id (Integer)

    Identifier of the message starting from which history must be fetched; use 0 to get results from the last message.

  • offset (Integer)

    Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages.

  • limit (Integer)

    The maximum number of messages to be returned; must be positive and can’t be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached.

  • only_local (Boolean)

    If true, returns only messages that are available locally without sending network requests.

Returns:



1588
1589
1590
1591
1592
1593
1594
1595
# File 'lib/tdlib/client_methods.rb', line 1588

def get_chat_history(chat_id:, from_message_id:, offset:, limit:, only_local:)
  broadcast('@type'           => 'getChatHistory',
            'chat_id'         => chat_id,
            'from_message_id' => from_message_id,
            'offset'          => offset,
            'limit'           => limit,
            'only_local'      => only_local)
end

Returns information about an invite link. Requires administrator privileges and can_invite_users right in the chat to get own links and owner privileges to

get other links.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • invite_link (TD::Types::String)

    Invite link to get.

Returns:



1604
1605
1606
1607
1608
# File 'lib/tdlib/client_methods.rb', line 1604

def get_chat_invite_link(chat_id:, invite_link:)
  broadcast('@type'       => 'getChatInviteLink',
            'chat_id'     => chat_id,
            'invite_link' => invite_link)
end

Returns list of chat administrators with number of their invite links. Requires owner privileges in the chat.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



1615
1616
1617
1618
# File 'lib/tdlib/client_methods.rb', line 1615

def get_chat_invite_link_counts(chat_id:)
  broadcast('@type'   => 'getChatInviteLinkCounts',
            'chat_id' => chat_id)
end

Returns chat members joined a chat by an invite link. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for

other links.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • invite_link (TD::Types::String)

    Invite link for which to return chat members.

  • offset_member (TD::Types::ChatInviteLinkMember)

    A chat member from which to return next chat members; use null to get results from the beginning.

  • limit (Integer)

    The maximum number of chat members to return.

Returns:



1630
1631
1632
1633
1634
1635
1636
# File 'lib/tdlib/client_methods.rb', line 1630

def get_chat_invite_link_members(chat_id:, invite_link:, offset_member:, limit:)
  broadcast('@type'         => 'getChatInviteLinkMembers',
            'chat_id'       => chat_id,
            'invite_link'   => invite_link,
            'offset_member' => offset_member,
            'limit'         => limit)
end

Returns invite links for a chat created by specified administrator. Requires administrator privileges and can_invite_users right in the chat to get own links and owner privileges to

get other links.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • creator_user_id (Integer)

    User identifier of a chat administrator. Must be an identifier of the current user for non-owner.

  • is_revoked (Boolean)

    Pass true if revoked links needs to be returned instead of active or expired.

  • offset_date (Integer)

    Creation date of an invite link starting after which to return invite links; use 0 to get results from the beginning.

  • offset_invite_link (TD::Types::String)

    Invite link starting after which to return invite links; use empty string to get results from the beginning.

  • limit (Integer)

    The maximum number of invite links to return.

Returns:



1652
1653
1654
1655
1656
1657
1658
1659
1660
# File 'lib/tdlib/client_methods.rb', line 1652

def get_chat_invite_links(chat_id:, creator_user_id:, is_revoked:, offset_date:, offset_invite_link:, limit:)
  broadcast('@type'              => 'getChatInviteLinks',
            'chat_id'            => chat_id,
            'creator_user_id'    => creator_user_id,
            'is_revoked'         => is_revoked,
            'offset_date'        => offset_date,
            'offset_invite_link' => offset_invite_link,
            'limit'              => limit)
end

#get_chat_lists_to_add_chat(chat_id:) ⇒ TD::Types::ChatLists

Returns chat lists to which the chat can be added. This is an offline request.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



1667
1668
1669
1670
# File 'lib/tdlib/client_methods.rb', line 1667

def get_chat_lists_to_add_chat(chat_id:)
  broadcast('@type'   => 'getChatListsToAddChat',
            'chat_id' => chat_id)
end

#get_chat_member(chat_id:, member_id:) ⇒ TD::Types::ChatMember

Returns information about a single member of a chat.

Parameters:

Returns:



1677
1678
1679
1680
1681
# File 'lib/tdlib/client_methods.rb', line 1677

def get_chat_member(chat_id:, member_id:)
  broadcast('@type'     => 'getChatMember',
            'chat_id'   => chat_id,
            'member_id' => member_id)
end

#get_chat_message_by_date(chat_id:, date:) ⇒ TD::Types::Message

Returns the last message sent in a chat no later than the specified date.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • date (Integer)

    Point in time (Unix timestamp) relative to which to search for messages.

Returns:



1688
1689
1690
1691
1692
# File 'lib/tdlib/client_methods.rb', line 1688

def get_chat_message_by_date(chat_id:, date:)
  broadcast('@type'   => 'getChatMessageByDate',
            'chat_id' => chat_id,
            'date'    => date)
end

#get_chat_message_count(chat_id:, filter:, return_local:) ⇒ TD::Types::Count

Returns approximate number of messages of the specified type in the chat.

Parameters:

  • chat_id (Integer)

    Identifier of the chat in which to count messages.

  • filter (TD::Types::SearchMessagesFilter)

    Filter for message content; Types::SearchMessagesFilter::Empty is unsupported in this function.

  • return_local (Boolean)

    If true, returns count that is available locally without sending network requests, returning -1 if the number of messages is unknown.

Returns:



1702
1703
1704
1705
1706
1707
# File 'lib/tdlib/client_methods.rb', line 1702

def get_chat_message_count(chat_id:, filter:, return_local:)
  broadcast('@type'        => 'getChatMessageCount',
            'chat_id'      => chat_id,
            'filter'       => filter,
            'return_local' => return_local)
end

#get_chat_notification_settings_exceptions(scope:, compare_sound:) ⇒ TD::Types::Chats

Returns list of chats with non-default notification settings.

Parameters:

  • scope (TD::Types::NotificationSettingsScope)

    If specified, only chats from the specified scope will be returned.

  • compare_sound (Boolean)

    If true, also chats with non-default sound will be returned.

Returns:



1715
1716
1717
1718
1719
# File 'lib/tdlib/client_methods.rb', line 1715

def get_chat_notification_settings_exceptions(scope:, compare_sound:)
  broadcast('@type'         => 'getChatNotificationSettingsExceptions',
            'scope'         => scope,
            'compare_sound' => compare_sound)
end

#get_chat_pinned_message(chat_id:) ⇒ TD::Types::Message

Returns information about a newest pinned message in the chat.

Parameters:

  • chat_id (Integer)

    Identifier of the chat the message belongs to.

Returns:



1725
1726
1727
1728
# File 'lib/tdlib/client_methods.rb', line 1725

def get_chat_pinned_message(chat_id:)
  broadcast('@type'   => 'getChatPinnedMessage',
            'chat_id' => chat_id)
end

#get_chat_scheduled_messages(chat_id:) ⇒ TD::Types::Messages

Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id).

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



1735
1736
1737
1738
# File 'lib/tdlib/client_methods.rb', line 1735

def get_chat_scheduled_messages(chat_id:)
  broadcast('@type'   => 'getChatScheduledMessages',
            'chat_id' => chat_id)
end

#get_chat_statistics(chat_id:, is_dark:) ⇒ TD::Types::ChatStatistics

Returns detailed statistics about a chat. Currently this method can be used only for supergroups and channels. Can be used only if SupergroupFullInfo.can_get_statistics == true.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • is_dark (Boolean)

    Pass true if a dark theme is used by the application.

Returns:



1747
1748
1749
1750
1751
# File 'lib/tdlib/client_methods.rb', line 1747

def get_chat_statistics(chat_id:, is_dark:)
  broadcast('@type'   => 'getChatStatistics',
            'chat_id' => chat_id,
            'is_dark' => is_dark)
end

#get_chat_statistics_url(chat_id:, parameters:, is_dark:) ⇒ TD::Types::HttpUrl

Returns an HTTP URL with the chat statistics. Currently this method of getting the statistics are disabled and can be deleted in the future.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • parameters (TD::Types::String)

    Parameters from “tg://statsrefresh?params=******” link.

  • is_dark (Boolean)

    Pass true if a URL with the dark theme must be returned.

Returns:



1760
1761
1762
1763
1764
1765
# File 'lib/tdlib/client_methods.rb', line 1760

def get_chat_statistics_url(chat_id:, parameters:, is_dark:)
  broadcast('@type'      => 'getChatStatisticsUrl',
            'chat_id'    => chat_id,
            'parameters' => parameters,
            'is_dark'    => is_dark)
end

#get_chats(chat_list:, offset_order:, offset_chat_id:, limit:) ⇒ TD::Types::Chats

Returns an ordered list of chats in a chat list. Chats are sorted by the pair (chat.position.order, chat.id) in descending 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.

Parameters:

  • chat_list (TD::Types::ChatList)

    The chat list in which to return chats.

  • offset_order (Integer)

    Chat order to return chats from.

  • offset_chat_id (Integer)

    Chat identifier to return chats from.

  • limit (Integer)

    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.

Returns:



1779
1780
1781
1782
1783
1784
1785
# File 'lib/tdlib/client_methods.rb', line 1779

def get_chats(chat_list:, offset_order:, offset_chat_id:, limit:)
  broadcast('@type'          => 'getChats',
            'chat_list'      => chat_list,
            'offset_order'   => offset_order,
            'offset_chat_id' => offset_chat_id,
            'limit'          => limit)
end

#get_connected_websitesTD::Types::ConnectedWebsites

Returns all website where the current user used Telegram to log in.



1790
1791
1792
# File 'lib/tdlib/client_methods.rb', line 1790

def get_connected_websites
  broadcast('@type' => 'getConnectedWebsites')
end

#get_contactsTD::Types::Users

Returns all user contacts.

Returns:



1797
1798
1799
# File 'lib/tdlib/client_methods.rb', line 1797

def get_contacts
  broadcast('@type' => 'getContacts')
end

#get_countriesTD::Types::Countries

Returns information about existing countries. Can be called before authorization.



1805
1806
1807
# File 'lib/tdlib/client_methods.rb', line 1805

def get_countries
  broadcast('@type' => 'getCountries')
end

#get_country_codeTD::Types::Text

Uses the current IP address to find the current country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization.

Returns:



1814
1815
1816
# File 'lib/tdlib/client_methods.rb', line 1814

def get_country_code
  broadcast('@type' => 'getCountryCode')
end

#get_created_public_chats(type:) ⇒ TD::Types::Chats

Returns a list of public chats of the specified type, owned by the user.

Parameters:

Returns:



1822
1823
1824
1825
# File 'lib/tdlib/client_methods.rb', line 1822

def get_created_public_chats(type:)
  broadcast('@type' => 'getCreatedPublicChats',
            'type'  => type)
end

#get_current_stateTD::Types::Updates

Returns all updates needed to restore current TDLib state, i.e. all actual UpdateAuthorizationState/UpdateUser/UpdateNewChat and others. This is especially useful if TDLib is run in a separate process. Can be called before initialization.

Returns:



1833
1834
1835
# File 'lib/tdlib/client_methods.rb', line 1833

def get_current_state
  broadcast('@type' => 'getCurrentState')
end

#get_database_statisticsTD::Types::DatabaseStatistics

Returns database statistics.



1840
1841
1842
# File 'lib/tdlib/client_methods.rb', line 1840

def get_database_statistics
  broadcast('@type' => 'getDatabaseStatistics')
end

Returns information about a tg:// deep link. Use “tg://need_update_for_some_feature” or “tg:some_unsupported_feature” for testing. Returns a 404 error for unknown links. Can be called before authorization.

Parameters:

  • link (TD::Types::String)

    The link.

Returns:



1851
1852
1853
1854
# File 'lib/tdlib/client_methods.rb', line 1851

def get_deep_link_info(link:)
  broadcast('@type' => 'getDeepLinkInfo',
            'link'  => link)
end

#get_emoji_suggestions_url(language_code:) ⇒ TD::Types::HttpUrl

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.

Parameters:

  • language_code (TD::Types::String)

    Language code for which the emoji replacements will be suggested.

Returns:



1862
1863
1864
1865
# File 'lib/tdlib/client_methods.rb', line 1862

def get_emoji_suggestions_url(language_code:)
  broadcast('@type'         => 'getEmojiSuggestionsUrl',
            'language_code' => language_code)
end

Returns an HTTP URL which can be used to automatically authorize the current user on a website after clicking an

HTTP link.

Use the method getExternalLinkInfo to find whether a prior user confirmation is needed.

Parameters:

  • link (TD::Types::String)

    The HTTP link.

  • allow_write_access (Boolean)

    True, if the current user allowed the bot, returned in getExternalLinkInfo, to send them messages.

Returns:



1875
1876
1877
1878
1879
# File 'lib/tdlib/client_methods.rb', line 1875

def get_external_link(link:, allow_write_access:)
  broadcast('@type'              => 'getExternalLink',
            'link'               => link,
            'allow_write_access' => allow_write_access)
end

Returns information about an action to be done when the current user clicks an HTTP link. This method can be used to automatically authorize the current user on a website. Don’t use this method for links from secret chats if link preview is disabled in secret chats.

Parameters:

  • link (TD::Types::String)

    The HTTP link.

Returns:



1887
1888
1889
1890
# File 'lib/tdlib/client_methods.rb', line 1887

def get_external_link_info(link:)
  broadcast('@type' => 'getExternalLinkInfo',
            'link'  => link)
end

#get_favorite_stickersTD::Types::Stickers

Returns favorite stickers.

Returns:



1895
1896
1897
# File 'lib/tdlib/client_methods.rb', line 1895

def get_favorite_stickers
  broadcast('@type' => 'getFavoriteStickers')
end

#get_file(file_id:) ⇒ TD::Types::File

Returns information about a file; this is an offline request.

Parameters:

  • file_id (Integer)

    Identifier of the file to get.

Returns:



1903
1904
1905
1906
# File 'lib/tdlib/client_methods.rb', line 1903

def get_file(file_id:)
  broadcast('@type'   => 'getFile',
            'file_id' => file_id)
end

#get_file_downloaded_prefix_size(file_id:, offset:) ⇒ TD::Types::Count

Returns file downloaded prefix size from a given offset.

Parameters:

  • file_id (Integer)

    Identifier of the file.

  • offset (Integer)

    Offset from which downloaded prefix size should be calculated.

Returns:



1913
1914
1915
1916
1917
# File 'lib/tdlib/client_methods.rb', line 1913

def get_file_downloaded_prefix_size(file_id:, offset:)
  broadcast('@type'   => 'getFileDownloadedPrefixSize',
            'file_id' => file_id,
            'offset'  => offset)
end

#get_file_extension(mime_type:) ⇒ TD::Types::Text

Returns the extension of a file, guessed by its MIME type. Returns an empty string on failure. Can be called synchronously.

Parameters:

  • mime_type (TD::Types::String)

    The MIME type of the file.

Returns:



1925
1926
1927
1928
# File 'lib/tdlib/client_methods.rb', line 1925

def get_file_extension(mime_type:)
  broadcast('@type'     => 'getFileExtension',
            'mime_type' => mime_type)
end

#get_file_mime_type(file_name:) ⇒ TD::Types::Text

Returns the MIME type of a file, guessed by its extension. Returns an empty string on failure. Can be called synchronously.

Parameters:

  • file_name (TD::Types::String)

    The name of the file or path to the file.

Returns:



1936
1937
1938
1939
# File 'lib/tdlib/client_methods.rb', line 1936

def get_file_mime_type(file_name:)
  broadcast('@type'     => 'getFileMimeType',
            'file_name' => file_name)
end

#get_game_high_scores(chat_id:, message_id:, user_id:) ⇒ TD::Types::GameHighScores

Returns the high scores for a game and some part of the high score table in the range of the specified user; for

bots only.

Parameters:

  • chat_id (Integer)

    The chat that contains the message with the game.

  • message_id (Integer)

    Identifier of the message.

  • user_id (Integer)

    User identifier.

Returns:



1948
1949
1950
1951
1952
1953
# File 'lib/tdlib/client_methods.rb', line 1948

def get_game_high_scores(chat_id:, message_id:, user_id:)
  broadcast('@type'      => 'getGameHighScores',
            'chat_id'    => chat_id,
            'message_id' => message_id,
            'user_id'    => user_id)
end

#get_group_call(group_call_id:) ⇒ TD::Types::GroupCall

Returns information about a group call.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

Returns:



1959
1960
1961
1962
# File 'lib/tdlib/client_methods.rb', line 1959

def get_group_call(group_call_id:)
  broadcast('@type'         => 'getGroupCall',
            'group_call_id' => group_call_id)
end

Returns invite link to a voice chat in a public chat.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • can_self_unmute (Boolean)

    Pass true if the invite_link should contain an invite hash, passing which to joinGroupCall would allow the invited user to unmute themself. Requires groupCall.can_be_managed group call flag.

Returns:



1971
1972
1973
1974
1975
# File 'lib/tdlib/client_methods.rb', line 1971

def get_group_call_invite_link(group_call_id:, can_self_unmute:)
  broadcast('@type'           => 'getGroupCallInviteLink',
            'group_call_id'   => group_call_id,
            'can_self_unmute' => can_self_unmute)
end

#get_group_call_stream_segment(group_call_id:, time_offset:, scale:) ⇒ TD::Types::FilePart

Returns a file with a segment of a group call stream in a modified OGG format.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • time_offset (Integer)

    Point in time when the stream segment begins; Unix timestamp in milliseconds.

  • scale (Integer)

    Segment duration scale; 0-1. Segment’s duration is 1000/(2**scale) milliseconds.

Returns:



1984
1985
1986
1987
1988
1989
# File 'lib/tdlib/client_methods.rb', line 1984

def get_group_call_stream_segment(group_call_id:, time_offset:, scale:)
  broadcast('@type'         => 'getGroupCallStreamSegment',
            'group_call_id' => group_call_id,
            'time_offset'   => time_offset,
            'scale'         => scale)
end

#get_groups_in_common(user_id:, offset_chat_id:, limit:) ⇒ TD::Types::Chats

Returns a list of common group chats with a given user. Chats are sorted by their type and creation date.

Parameters:

  • user_id (Integer)

    User identifier.

  • offset_chat_id (Integer)

    Chat identifier starting from which to return chats; use 0 for the first request.

  • limit (Integer)

    The maximum number of chats to be returned; up to 100.

Returns:



1998
1999
2000
2001
2002
2003
# File 'lib/tdlib/client_methods.rb', line 1998

def get_groups_in_common(user_id:, offset_chat_id:, limit:)
  broadcast('@type'          => 'getGroupsInCommon',
            'user_id'        => user_id,
            'offset_chat_id' => offset_chat_id,
            'limit'          => limit)
end

#get_imported_contact_countTD::Types::Count

Returns the total number of imported contacts.

Returns:



2008
2009
2010
# File 'lib/tdlib/client_methods.rb', line 2008

def get_imported_contact_count
  broadcast('@type' => 'getImportedContactCount')
end

#get_inactive_supergroup_chatsTD::Types::Chats

Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH

error.

Returns:



2017
2018
2019
# File 'lib/tdlib/client_methods.rb', line 2017

def get_inactive_supergroup_chats
  broadcast('@type' => 'getInactiveSupergroupChats')
end

#get_inline_game_high_scores(inline_message_id:, user_id:) ⇒ TD::Types::GameHighScores

Returns game high scores and some part of the high score table in the range of the specified user; for bots only.

Parameters:

  • inline_message_id (TD::Types::String)

    Inline message identifier.

  • user_id (Integer)

    User identifier.

Returns:



2026
2027
2028
2029
2030
# File 'lib/tdlib/client_methods.rb', line 2026

def get_inline_game_high_scores(inline_message_id:, user_id:)
  broadcast('@type'             => 'getInlineGameHighScores',
            'inline_message_id' => inline_message_id,
            'user_id'           => user_id)
end

#get_inline_query_results(bot_user_id:, chat_id:, user_location:, query:, offset:) ⇒ TD::Types::InlineQueryResults

Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires.

Parameters:

  • bot_user_id (Integer)

    The identifier of the target bot.

  • chat_id (Integer)

    Identifier of the chat where the query was sent.

  • user_location (TD::Types::Location)

    Location of the user, only if needed.

  • query (TD::Types::String)

    Text of the query.

  • offset (TD::Types::String)

    Offset of the first entry to return.

Returns:



2041
2042
2043
2044
2045
2046
2047
2048
# File 'lib/tdlib/client_methods.rb', line 2041

def get_inline_query_results(bot_user_id:, chat_id:, user_location:, query:, offset:)
  broadcast('@type'         => 'getInlineQueryResults',
            'bot_user_id'   => bot_user_id,
            'chat_id'       => chat_id,
            'user_location' => user_location,
            'query'         => query,
            'offset'        => offset)
end

#get_installed_sticker_sets(is_masks:) ⇒ TD::Types::StickerSets

Returns a list of installed sticker sets.

Parameters:

  • is_masks (Boolean)

    Pass true to return mask sticker sets; pass false to return ordinary sticker sets.

Returns:



2054
2055
2056
2057
# File 'lib/tdlib/client_methods.rb', line 2054

def get_installed_sticker_sets(is_masks:)
  broadcast('@type'    => 'getInstalledStickerSets',
            'is_masks' => is_masks)
end

#get_invite_textTD::Types::Text

Returns the default text for invitation messages to be used as a placeholder when the current user invites friends

to Telegram.

Returns:



2063
2064
2065
# File 'lib/tdlib/client_methods.rb', line 2063

def get_invite_text
  broadcast('@type' => 'getInviteText')
end

#get_json_string(json_value:) ⇒ TD::Types::Text

Converts a JsonValue object to corresponding JSON-serialized string. Can be called synchronously.

Parameters:

Returns:



2072
2073
2074
2075
# File 'lib/tdlib/client_methods.rb', line 2072

def get_json_string(json_value:)
  broadcast('@type'      => 'getJsonString',
            'json_value' => json_value)
end

#get_json_value(json:) ⇒ TD::Types::JsonValue

Converts a JSON-serialized string to corresponding JsonValue object. Can be called synchronously.

Parameters:

  • json (TD::Types::String)

    The JSON-serialized string.

Returns:



2082
2083
2084
2085
# File 'lib/tdlib/client_methods.rb', line 2082

def get_json_value(json:)
  broadcast('@type' => 'getJsonValue',
            'json'  => json)
end

#get_language_pack_info(language_pack_id:) ⇒ TD::Types::LanguagePackInfo

Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization.

Parameters:

  • language_pack_id (TD::Types::String)

    Language pack identifier.

Returns:



2093
2094
2095
2096
# File 'lib/tdlib/client_methods.rb', line 2093

def get_language_pack_info(language_pack_id:)
  broadcast('@type'            => 'getLanguagePackInfo',
            'language_pack_id' => language_pack_id)
end

#get_language_pack_string(language_pack_database_path:, localization_target:, language_pack_id:, key:) ⇒ TD::Types::LanguagePackStringValue

Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. Can be called synchronously.

Parameters:

  • language_pack_database_path (TD::Types::String)

    Path to the language pack database in which strings are stored.

  • localization_target (TD::Types::String)

    Localization target to which the language pack belongs.

  • language_pack_id (TD::Types::String)

    Language pack identifier.

  • key (TD::Types::String)

    Language pack key of the string to be returned.

Returns:



2108
2109
2110
2111
2112
2113
2114
# File 'lib/tdlib/client_methods.rb', line 2108

def get_language_pack_string(language_pack_database_path:, localization_target:, language_pack_id:, key:)
  broadcast('@type'                       => 'getLanguagePackString',
            'language_pack_database_path' => language_pack_database_path,
            'localization_target'         => localization_target,
            'language_pack_id'            => language_pack_id,
            'key'                         => key)
end

#get_language_pack_strings(language_pack_id:, keys:) ⇒ TD::Types::LanguagePackStrings

Returns strings from a language pack in the current localization target by their keys. Can be called before authorization.

Parameters:

  • language_pack_id (TD::Types::String)

    Language pack identifier of the strings to be returned.

  • keys (Array<TD::Types::String>)

    Language pack keys of the strings to be returned; leave empty to request all available strings.

Returns:



2123
2124
2125
2126
2127
# File 'lib/tdlib/client_methods.rb', line 2123

def get_language_pack_strings(language_pack_id:, keys:)
  broadcast('@type'            => 'getLanguagePackStrings',
            'language_pack_id' => language_pack_id,
            'keys'             => keys)
end

#get_localization_target_info(only_local:) ⇒ TD::Types::LocalizationTargetInfo

Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization.

Parameters:

  • only_local (Boolean)

    If true, returns only locally available information without sending network requests.

Returns:



2135
2136
2137
2138
# File 'lib/tdlib/client_methods.rb', line 2135

def get_localization_target_info(only_local:)
  broadcast('@type'      => 'getLocalizationTargetInfo',
            'only_local' => only_local)
end

#get_log_streamTD::Types::LogStream

Returns information about currently used log stream for internal logging of TDLib. Can be called synchronously.



2144
2145
2146
# File 'lib/tdlib/client_methods.rb', line 2144

def get_log_stream
  broadcast('@type' => 'getLogStream')
end

#get_log_tag_verbosity_level(tag:) ⇒ TD::Types::LogVerbosityLevel

Returns current verbosity level for a specified TDLib internal log tag. Can be called synchronously.

Parameters:

  • tag (TD::Types::String)

    Logging tag to change verbosity level.

Returns:



2153
2154
2155
2156
# File 'lib/tdlib/client_methods.rb', line 2153

def get_log_tag_verbosity_level(tag:)
  broadcast('@type' => 'getLogTagVerbosityLevel',
            'tag'   => tag)
end

#get_log_tagsTD::Types::LogTags

Returns list of available TDLib internal log tags, for example, [“actor”, “binlog”, “connections”, “notifications”,

"proxy"].

Can be called synchronously.

Returns:



2163
2164
2165
# File 'lib/tdlib/client_methods.rb', line 2163

def get_log_tags
  broadcast('@type' => 'getLogTags')
end

#get_log_verbosity_levelTD::Types::LogVerbosityLevel

Returns current verbosity level of the internal logging of TDLib. Can be called synchronously.



2171
2172
2173
# File 'lib/tdlib/client_methods.rb', line 2171

def get_log_verbosity_level
  broadcast('@type' => 'getLogVerbosityLevel')
end

#get_login_url(chat_id:, message_id:, button_id:, allow_write_access:) ⇒ TD::Types::HttpUrl

Returns an HTTP URL which can be used to automatically authorize the user on a website after clicking an inline

button of type inlineKeyboardButtonTypeLoginUrl.

Use the method getLoginUrlInfo to find whether a prior user confirmation is needed. If an error is returned, then the button must be handled as an ordinary URL button.

Parameters:

  • chat_id (Integer)

    Chat identifier of the message with the button.

  • message_id (Integer)

    Message identifier of the message with the button.

  • button_id (Integer)

    Button identifier.

  • allow_write_access (Boolean)

    True, if the user allowed the bot to send them messages.

Returns:



2185
2186
2187
2188
2189
2190
2191
# File 'lib/tdlib/client_methods.rb', line 2185

def (chat_id:, message_id:, button_id:, allow_write_access:)
  broadcast('@type'              => 'getLoginUrl',
            'chat_id'            => chat_id,
            'message_id'         => message_id,
            'button_id'          => button_id,
            'allow_write_access' => allow_write_access)
end

#get_login_url_info(chat_id:, message_id:, button_id:) ⇒ TD::Types::LoginUrlInfo

Returns information about a button of type inlineKeyboardButtonTypeLoginUrl. The method needs to be called when the user presses the button.

Parameters:

  • chat_id (Integer)

    Chat identifier of the message with the button.

  • message_id (Integer)

    Message identifier of the message with the button.

  • button_id (Integer)

    Button identifier.

Returns:



2200
2201
2202
2203
2204
2205
# File 'lib/tdlib/client_methods.rb', line 2200

def (chat_id:, message_id:, button_id:)
  broadcast('@type'      => 'getLoginUrlInfo',
            'chat_id'    => chat_id,
            'message_id' => message_id,
            'button_id'  => button_id)
end

#get_map_thumbnail_file(location:, zoom:, width:, height:, scale:, chat_id:) ⇒ TD::Types::File

Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded.

Parameters:

  • location (TD::Types::Location)

    Location of the map center.

  • zoom (Integer)

    Map zoom level; 13-20.

  • width (Integer)

    Map width in pixels before applying scale; 16-1024.

  • height (Integer)

    Map height in pixels before applying scale; 16-1024.

  • scale (Integer)

    Map scale; 1-3.

  • chat_id (Integer)

    Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown.

Returns:



2218
2219
2220
2221
2222
2223
2224
2225
2226
# File 'lib/tdlib/client_methods.rb', line 2218

def get_map_thumbnail_file(location:, zoom:, width:, height:, scale:, chat_id:)
  broadcast('@type'    => 'getMapThumbnailFile',
            'location' => location,
            'zoom'     => zoom,
            'width'    => width,
            'height'   => height,
            'scale'    => scale,
            'chat_id'  => chat_id)
end

#get_markdown_text(text:) ⇒ TD::Types::FormattedText

Replaces text entities with Markdown formatting in a human-friendly format. Entities that can’t be represented in Markdown unambiguously are kept as is. Can be called synchronously.

Parameters:

Returns:



2234
2235
2236
2237
# File 'lib/tdlib/client_methods.rb', line 2234

def get_markdown_text(text:)
  broadcast('@type' => 'getMarkdownText',
            'text'  => text)
end

#get_meTD::Types::User

Returns the current user.

Returns:



2242
2243
2244
# File 'lib/tdlib/client_methods.rb', line 2242

def get_me
  broadcast('@type' => 'getMe')
end

#get_message(chat_id:, message_id:) ⇒ TD::Types::Message

Returns information about a message.

Parameters:

  • chat_id (Integer)

    Identifier of the chat the message belongs to.

  • message_id (Integer)

    Identifier of the message to get.

Returns:



2251
2252
2253
2254
2255
# File 'lib/tdlib/client_methods.rb', line 2251

def get_message(chat_id:, message_id:)
  broadcast('@type'      => 'getMessage',
            'chat_id'    => chat_id,
            'message_id' => message_id)
end

#get_message_embedding_code(chat_id:, message_id:, for_album:) ⇒ TD::Types::Text

Returns an HTML code for embedding the message. Available only for messages in supergroups and channels with a username.

Parameters:

  • chat_id (Integer)

    Identifier of the chat to which the message belongs.

  • message_id (Integer)

    Identifier of the message.

  • for_album (Boolean)

    Pass true to return an HTML code for embedding of the whole media album.

Returns:



2264
2265
2266
2267
2268
2269
# File 'lib/tdlib/client_methods.rb', line 2264

def get_message_embedding_code(chat_id:, message_id:, for_album:)
  broadcast('@type'      => 'getMessageEmbeddingCode',
            'chat_id'    => chat_id,
            'message_id' => message_id,
            'for_album'  => for_album)
end

#get_message_file_type(message_file_head:) ⇒ TD::Types::MessageFileType

Returns information about a file with messages exported from another app.

Parameters:

  • message_file_head (TD::Types::String)

    Beginning of the message file; up to 100 first lines.

Returns:



2275
2276
2277
2278
# File 'lib/tdlib/client_methods.rb', line 2275

def get_message_file_type(message_file_head:)
  broadcast('@type'             => 'getMessageFileType',
            'message_file_head' => message_file_head)
end

#get_message_import_confirmation_text(chat_id:) ⇒ TD::Types::Text

Returns a confirmation text to be shown to the user before starting message import.

Parameters:

  • chat_id (Integer)

    Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info administrator right.

Returns:



2286
2287
2288
2289
# File 'lib/tdlib/client_methods.rb', line 2286

def get_message_import_confirmation_text(chat_id:)
  broadcast('@type'   => 'getMessageImportConfirmationText',
            'chat_id' => chat_id)
end

Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels. This is an offline request.

Parameters:

  • chat_id (Integer)

    Identifier of the chat to which the message belongs.

  • message_id (Integer)

    Identifier of the message.

  • for_album (Boolean)

    Pass true to create a link for the whole media album.

  • for_comment (Boolean)

    Pass true to create a link to the message as a channel post comment, or from a message thread.

Returns:



2301
2302
2303
2304
2305
2306
2307
# File 'lib/tdlib/client_methods.rb', line 2301

def get_message_link(chat_id:, message_id:, for_album:, for_comment:)
  broadcast('@type'       => 'getMessageLink',
            'chat_id'     => chat_id,
            'message_id'  => message_id,
            'for_album'   => for_album,
            'for_comment' => for_comment)
end

Returns information about a public or private message link.

Parameters:

  • url (TD::Types::String)

    The message link in the format “t.me/c/…”, or “tg://privatepost?…”, or “t.me/username/…”, or “tg://resolve?…”.

Returns:



2314
2315
2316
2317
# File 'lib/tdlib/client_methods.rb', line 2314

def get_message_link_info(url:)
  broadcast('@type' => 'getMessageLinkInfo',
            'url'   => url)
end

#get_message_locally(chat_id:, message_id:) ⇒ TD::Types::Message

Returns information about a message, if it is available locally without sending network request. This is an offline request.

Parameters:

  • chat_id (Integer)

    Identifier of the chat the message belongs to.

  • message_id (Integer)

    Identifier of the message to get.

Returns:



2325
2326
2327
2328
2329
# File 'lib/tdlib/client_methods.rb', line 2325

def get_message_locally(chat_id:, message_id:)
  broadcast('@type'      => 'getMessageLocally',
            'chat_id'    => chat_id,
            'message_id' => message_id)
end

#get_message_public_forwards(chat_id:, message_id:, offset:, limit:) ⇒ TD::Types::FoundMessages

Returns forwarded copies of a channel message to different public channels. For optimal performance the number of returned messages is chosen by the library.

Parameters:

  • chat_id (Integer)

    Chat identifier of the message.

  • message_id (Integer)

    Message identifier.

  • offset (TD::Types::String)

    Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results.

  • limit (Integer)

    The maximum number of messages to be returned; must be positive and can’t be greater than 100. Fewer messages may be returned than specified by the limit, even if the end of the list has not been reached.

Returns:



2342
2343
2344
2345
2346
2347
2348
# File 'lib/tdlib/client_methods.rb', line 2342

def get_message_public_forwards(chat_id:, message_id:, offset:, limit:)
  broadcast('@type'      => 'getMessagePublicForwards',
            'chat_id'    => chat_id,
            'message_id' => message_id,
            'offset'     => offset,
            'limit'      => limit)
end

#get_message_statistics(chat_id:, message_id:, is_dark:) ⇒ TD::Types::MessageStatistics

Returns detailed statistics about a message. Can be used only if Message.can_get_statistics == true.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • message_id (Integer)

    Message identifier.

  • is_dark (Boolean)

    Pass true if a dark theme is used by the application.

Returns:



2357
2358
2359
2360
2361
2362
# File 'lib/tdlib/client_methods.rb', line 2357

def get_message_statistics(chat_id:, message_id:, is_dark:)
  broadcast('@type'      => 'getMessageStatistics',
            'chat_id'    => chat_id,
            'message_id' => message_id,
            'is_dark'    => is_dark)
end

#get_message_thread(chat_id:, message_id:) ⇒ TD::Types::MessageThreadInfo

Returns information about a message thread. Can be used only if message.can_get_message_thread == true.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • message_id (Integer)

    Identifier of the message.

Returns:



2370
2371
2372
2373
2374
# File 'lib/tdlib/client_methods.rb', line 2370

def get_message_thread(chat_id:, message_id:)
  broadcast('@type'      => 'getMessageThread',
            'chat_id'    => chat_id,
            'message_id' => message_id)
end

#get_message_thread_history(chat_id:, message_id:, from_message_id:, offset:, limit:) ⇒ TD::Types::Messages

Returns messages in a message thread of a message. Can be used only if message.can_get_message_thread == true. Message thread of a channel message is in the channel’s linked supergroup. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • message_id (Integer)

    Message identifier, which thread history needs to be returned.

  • from_message_id (Integer)

    Identifier of the message starting from which history must be fetched; use 0 to get results from the last message.

  • offset (Integer)

    Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages.

  • limit (Integer)

    The maximum number of messages to be returned; must be positive and can’t be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. Fewer messages may be returned than specified by the limit, even if the end of the message thread history has not been reached.

Returns:



2394
2395
2396
2397
2398
2399
2400
2401
# File 'lib/tdlib/client_methods.rb', line 2394

def get_message_thread_history(chat_id:, message_id:, from_message_id:, offset:, limit:)
  broadcast('@type'           => 'getMessageThreadHistory',
            'chat_id'         => chat_id,
            'message_id'      => message_id,
            'from_message_id' => from_message_id,
            'offset'          => offset,
            'limit'           => limit)
end

#get_messages(chat_id:, message_ids:) ⇒ TD::Types::Messages

Returns information about messages. If a message is not found, returns null on the corresponding position of the result.

Parameters:

  • chat_id (Integer)

    Identifier of the chat the messages belong to.

  • message_ids (Array<Integer>)

    Identifiers of the messages to get.

Returns:



2409
2410
2411
2412
2413
# File 'lib/tdlib/client_methods.rb', line 2409

def get_messages(chat_id:, message_ids:)
  broadcast('@type'       => 'getMessages',
            'chat_id'     => chat_id,
            'message_ids' => message_ids)
end

#get_network_statistics(only_current:) ⇒ TD::Types::NetworkStatistics

Returns network data usage statistics. Can be called before authorization.

Parameters:

  • only_current (Boolean)

    If true, returns only data for the current library launch.

Returns:



2420
2421
2422
2423
# File 'lib/tdlib/client_methods.rb', line 2420

def get_network_statistics(only_current:)
  broadcast('@type'        => 'getNetworkStatistics',
            'only_current' => only_current)
end

#get_option(name:) ⇒ TD::Types::OptionValue

Returns the value of an option by its name. (Check the list of available options on core.telegram.org/tdlib/options.) Can be called before

authorization.

Parameters:

  • name (TD::Types::String)

    The name of the option.

Returns:



2431
2432
2433
2434
# File 'lib/tdlib/client_methods.rb', line 2431

def get_option(name:)
  broadcast('@type' => 'getOption',
            'name'  => name)
end

#get_passport_authorization_form(bot_user_id:, scope:, public_key:, nonce:) ⇒ TD::Types::PassportAuthorizationForm

Returns a Telegram Passport authorization form for sharing data with a service.

Parameters:

  • bot_user_id (Integer)

    User identifier of the service’s bot.

  • scope (TD::Types::String)

    Telegram Passport element types requested by the service.

  • public_key (TD::Types::String)

    Service’s public_key.

  • nonce (TD::Types::String)

    Authorization form nonce provided by the service.

Returns:



2443
2444
2445
2446
2447
2448
2449
# File 'lib/tdlib/client_methods.rb', line 2443

def get_passport_authorization_form(bot_user_id:, scope:, public_key:, nonce:)
  broadcast('@type'       => 'getPassportAuthorizationForm',
            'bot_user_id' => bot_user_id,
            'scope'       => scope,
            'public_key'  => public_key,
            'nonce'       => nonce)
end

#get_passport_authorization_form_available_elements(autorization_form_id:, password:) ⇒ TD::Types::PassportElementsWithErrors

Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization

form.

Result can be received only once for each authorization form.

Parameters:

  • autorization_form_id (Integer)

    Authorization form identifier.

  • password (TD::Types::String)

    Password of the current user.

Returns:



2458
2459
2460
2461
2462
# File 'lib/tdlib/client_methods.rb', line 2458

def get_passport_authorization_form_available_elements(autorization_form_id:, password:)
  broadcast('@type'                => 'getPassportAuthorizationFormAvailableElements',
            'autorization_form_id' => autorization_form_id,
            'password'             => password)
end

#get_passport_element(type:, password:) ⇒ TD::Types::PassportElement

Returns one of the available Telegram Passport elements.

Parameters:

Returns:



2469
2470
2471
2472
2473
# File 'lib/tdlib/client_methods.rb', line 2469

def get_passport_element(type:, password:)
  broadcast('@type'    => 'getPassportElement',
            'type'     => type,
            'password' => password)
end

#get_password_stateTD::Types::PasswordState

Returns the current state of 2-step verification.



2478
2479
2480
# File 'lib/tdlib/client_methods.rb', line 2478

def get_password_state
  broadcast('@type' => 'getPasswordState')
end

#get_payment_form(chat_id:, message_id:, theme:) ⇒ TD::Types::PaymentForm

Returns an invoice payment form. This method should be called when the user presses inlineKeyboardButtonBuy.

Parameters:

  • chat_id (Integer)

    Chat identifier of the Invoice message.

  • message_id (Integer)

    Message identifier.

  • theme (TD::Types::PaymentFormTheme)

    Preferred payment form theme.

Returns:



2489
2490
2491
2492
2493
2494
# File 'lib/tdlib/client_methods.rb', line 2489

def get_payment_form(chat_id:, message_id:, theme:)
  broadcast('@type'      => 'getPaymentForm',
            'chat_id'    => chat_id,
            'message_id' => message_id,
            'theme'      => theme)
end

#get_payment_receipt(chat_id:, message_id:) ⇒ TD::Types::PaymentReceipt

Returns information about a successful payment.

Parameters:

  • chat_id (Integer)

    Chat identifier of the PaymentSuccessful message.

  • message_id (Integer)

    Message identifier.

Returns:



2501
2502
2503
2504
2505
# File 'lib/tdlib/client_methods.rb', line 2501

def get_payment_receipt(chat_id:, message_id:)
  broadcast('@type'      => 'getPaymentReceipt',
            'chat_id'    => chat_id,
            'message_id' => message_id)
end

#get_phone_number_info(phone_number_prefix:) ⇒ TD::Types::PhoneNumberInfo

Returns information about a phone number by its prefix. Can be called before authorization.

Parameters:

  • phone_number_prefix (TD::Types::String)

    The phone number prefix.

Returns:



2512
2513
2514
2515
# File 'lib/tdlib/client_methods.rb', line 2512

def get_phone_number_info(phone_number_prefix:)
  broadcast('@type'               => 'getPhoneNumberInfo',
            'phone_number_prefix' => phone_number_prefix)
end

#get_poll_voters(chat_id:, message_id:, option_id:, offset:, limit:) ⇒ TD::Types::Users

Returns users voted for the specified option in a non-anonymous polls. For the optimal performance the number of returned users is chosen by the library.

Parameters:

  • chat_id (Integer)

    Identifier of the chat to which the poll belongs.

  • message_id (Integer)

    Identifier of the message containing the poll.

  • option_id (Integer)

    0-based identifier of the answer option.

  • offset (Integer)

    Number of users to skip in the result; must be non-negative.

  • limit (Integer)

    The maximum number of users to be returned; must be positive and can’t be greater than 50. Fewer users may be returned than specified by the limit, even if the end of the voter list has not been reached.

Returns:



2527
2528
2529
2530
2531
2532
2533
2534
# File 'lib/tdlib/client_methods.rb', line 2527

def get_poll_voters(chat_id:, message_id:, option_id:, offset:, limit:)
  broadcast('@type'      => 'getPollVoters',
            'chat_id'    => chat_id,
            'message_id' => message_id,
            'option_id'  => option_id,
            'offset'     => offset,
            'limit'      => limit)
end

#get_preferred_country_language(country_code:) ⇒ TD::Types::Text

Returns an IETF language tag of the language preferred in the country, which should be used to fill native fields

in Telegram Passport personal details.

Returns a 404 error if unknown.

Parameters:

  • country_code (TD::Types::String)

    A two-letter ISO 3166-1 alpha-2 country code.

Returns:



2542
2543
2544
2545
# File 'lib/tdlib/client_methods.rb', line 2542

def get_preferred_country_language(country_code:)
  broadcast('@type'        => 'getPreferredCountryLanguage',
            'country_code' => country_code)
end

#get_proxiesTD::Types::Proxies

Returns list of proxies that are currently set up. Can be called before authorization.

Returns:



2551
2552
2553
# File 'lib/tdlib/client_methods.rb', line 2551

def get_proxies
  broadcast('@type' => 'getProxies')
end

Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization.

Parameters:

  • proxy_id (Integer)

    Proxy identifier.

Returns:



2561
2562
2563
2564
# File 'lib/tdlib/client_methods.rb', line 2561

def get_proxy_link(proxy_id:)
  broadcast('@type'    => 'getProxyLink',
            'proxy_id' => proxy_id)
end

#get_push_receiver_id(payload:) ⇒ TD::Types::PushReceiverId

Returns a globally unique push notification subscription identifier for identification of an account, which has

received a push notification.

Can be called synchronously.

Parameters:

  • payload (TD::Types::String)

    JSON-encoded push notification payload.

Returns:



2572
2573
2574
2575
# File 'lib/tdlib/client_methods.rb', line 2572

def get_push_receiver_id(payload:)
  broadcast('@type'   => 'getPushReceiverId',
            'payload' => payload)
end

#get_recent_inline_botsTD::Types::Users

Returns up to 20 recently used inline bots in the order of their last usage.

Returns:



2580
2581
2582
# File 'lib/tdlib/client_methods.rb', line 2580

def get_recent_inline_bots
  broadcast('@type' => 'getRecentInlineBots')
end

#get_recent_stickers(is_attached:) ⇒ TD::Types::Stickers

Returns a list of recently used stickers.

Parameters:

  • is_attached (Boolean)

    Pass true to return stickers and masks that were recently attached to photos or video files; pass false to return recently sent stickers.

Returns:



2589
2590
2591
2592
# File 'lib/tdlib/client_methods.rb', line 2589

def get_recent_stickers(is_attached:)
  broadcast('@type'       => 'getRecentStickers',
            'is_attached' => is_attached)
end

#get_recently_visited_t_me_urls(referrer:) ⇒ TD::Types::TMeUrls

Returns t.me URLs recently visited by a newly registered user.

Parameters:

  • referrer (TD::Types::String)

    Google Play referrer to identify the user.

Returns:



2598
2599
2600
2601
# File 'lib/tdlib/client_methods.rb', line 2598

def get_recently_visited_t_me_urls(referrer:)
  broadcast('@type'    => 'getRecentlyVisitedTMeUrls',
            'referrer' => referrer)
end

Returns recommended chat filters for the current user.



2606
2607
2608
# File 'lib/tdlib/client_methods.rb', line 2606

def get_recommended_chat_filters
  broadcast('@type' => 'getRecommendedChatFilters')
end

#get_recovery_email_address(password:) ⇒ TD::Types::RecoveryEmailAddress

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.

Parameters:

  • password (TD::Types::String)

    The password for the current user.

Returns:



2615
2616
2617
2618
# File 'lib/tdlib/client_methods.rb', line 2615

def get_recovery_email_address(password:)
  broadcast('@type'    => 'getRecoveryEmailAddress',
            'password' => password)
end

#get_remote_file(remote_file_id:, file_type:) ⇒ TD::Types::File

Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application.

Parameters:

  • remote_file_id (TD::Types::String)

    Remote identifier of the file to get.

  • file_type (TD::Types::FileType)

    File type, if known.

Returns:



2629
2630
2631
2632
2633
# File 'lib/tdlib/client_methods.rb', line 2629

def get_remote_file(remote_file_id:, file_type:)
  broadcast('@type'          => 'getRemoteFile',
            'remote_file_id' => remote_file_id,
            'file_type'      => file_type)
end

#get_replied_message(chat_id:, message_id:) ⇒ TD::Types::Message

Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, and the invoice message for messages of the types

messagePinMessage, messageGameScore, and messagePaymentSuccessful respectively.

Parameters:

  • chat_id (Integer)

    Identifier of the chat the message belongs to.

  • message_id (Integer)

    Identifier of the message reply to which to get.

Returns:



2642
2643
2644
2645
2646
# File 'lib/tdlib/client_methods.rb', line 2642

def get_replied_message(chat_id:, message_id:)
  broadcast('@type'      => 'getRepliedMessage',
            'chat_id'    => chat_id,
            'message_id' => message_id)
end

#get_saved_animationsTD::Types::Animations

Returns saved animations.



2651
2652
2653
# File 'lib/tdlib/client_methods.rb', line 2651

def get_saved_animations
  broadcast('@type' => 'getSavedAnimations')
end

#get_saved_order_infoTD::Types::OrderInfo

Returns saved order info, if any.



2658
2659
2660
# File 'lib/tdlib/client_methods.rb', line 2658

def get_saved_order_info
  broadcast('@type' => 'getSavedOrderInfo')
end

#get_scope_notification_settings(scope:) ⇒ TD::Types::ScopeNotificationSettings

Returns the notification settings for chats of a given type.

Parameters:

Returns:



2667
2668
2669
2670
# File 'lib/tdlib/client_methods.rb', line 2667

def get_scope_notification_settings(scope:)
  broadcast('@type' => 'getScopeNotificationSettings',
            'scope' => scope)
end

#get_secret_chat(secret_chat_id:) ⇒ TD::Types::SecretChat

Returns information about a secret chat by its identifier. This is an offline request.

Parameters:

  • secret_chat_id (Integer)

    Secret chat identifier.

Returns:



2677
2678
2679
2680
# File 'lib/tdlib/client_methods.rb', line 2677

def get_secret_chat(secret_chat_id:)
  broadcast('@type'          => 'getSecretChat',
            'secret_chat_id' => secret_chat_id)
end

#get_statistical_graph(chat_id:, token:, x:) ⇒ TD::Types::StatisticalGraph

Loads an asynchronous or a zoomed in statistical graph.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • token (TD::Types::String)

    The token for graph loading.

  • x (Integer)

    X-value for zoomed in graph or 0 otherwise.

Returns:



2688
2689
2690
2691
2692
2693
# File 'lib/tdlib/client_methods.rb', line 2688

def get_statistical_graph(chat_id:, token:, x:)
  broadcast('@type'   => 'getStatisticalGraph',
            'chat_id' => chat_id,
            'token'   => token,
            'x'       => x)
end

#get_sticker_emojis(sticker:) ⇒ TD::Types::Emojis

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.

Parameters:

Returns:



2701
2702
2703
2704
# File 'lib/tdlib/client_methods.rb', line 2701

def get_sticker_emojis(sticker:)
  broadcast('@type'   => 'getStickerEmojis',
            'sticker' => sticker)
end

#get_sticker_set(set_id:) ⇒ TD::Types::StickerSet

Returns information about a sticker set by its identifier.

Parameters:

  • set_id (Integer)

    Identifier of the sticker set.

Returns:



2710
2711
2712
2713
# File 'lib/tdlib/client_methods.rb', line 2710

def get_sticker_set(set_id:)
  broadcast('@type'  => 'getStickerSet',
            'set_id' => set_id)
end

#get_stickers(emoji:, limit:) ⇒ TD::Types::Stickers

Returns stickers from the installed sticker sets that correspond to a given emoji. If the emoji is not empty, favorite and recently used stickers may also be returned.

Parameters:

  • emoji (TD::Types::String)

    String representation of emoji. If empty, returns all known installed stickers.

  • limit (Integer)

    The maximum number of stickers to be returned.

Returns:



2722
2723
2724
2725
2726
# File 'lib/tdlib/client_methods.rb', line 2722

def get_stickers(emoji:, limit:)
  broadcast('@type' => 'getStickers',
            'emoji' => emoji,
            'limit' => limit)
end

#get_storage_statistics(chat_limit:) ⇒ TD::Types::StorageStatistics

Returns storage usage statistics. Can be called before authorization.

Parameters:

  • chat_limit (Integer)

    The maximum number of chats with the largest storage usage for which separate statistics should be returned. All other chats will be grouped in entries with chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is always set to 0.

Returns:



2736
2737
2738
2739
# File 'lib/tdlib/client_methods.rb', line 2736

def get_storage_statistics(chat_limit:)
  broadcast('@type'      => 'getStorageStatistics',
            'chat_limit' => chat_limit)
end

#get_storage_statistics_fastTD::Types::StorageStatisticsFast

Quickly returns approximate storage usage statistics. Can be called before authorization.



2745
2746
2747
# File 'lib/tdlib/client_methods.rb', line 2745

def get_storage_statistics_fast
  broadcast('@type' => 'getStorageStatisticsFast')
end

#get_suitable_discussion_chatsTD::Types::Chats

Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. Returned basic group chats must be first upgraded to supergroups before they can be set as a discussion group. To set a returned supergroup as a discussion group, access to its old messages must be enabled using

toggleSupergroupIsAllHistoryAvailable first.

Returns:



2755
2756
2757
# File 'lib/tdlib/client_methods.rb', line 2755

def get_suitable_discussion_chats
  broadcast('@type' => 'getSuitableDiscussionChats')
end

#get_supergroup(supergroup_id:) ⇒ TD::Types::Supergroup

Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot.

Parameters:

  • supergroup_id (Integer)

    Supergroup or channel identifier.

Returns:



2764
2765
2766
2767
# File 'lib/tdlib/client_methods.rb', line 2764

def get_supergroup(supergroup_id:)
  broadcast('@type'         => 'getSupergroup',
            'supergroup_id' => supergroup_id)
end

#get_supergroup_full_info(supergroup_id:) ⇒ TD::Types::SupergroupFullInfo

Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute.

Parameters:

  • supergroup_id (Integer)

    Supergroup or channel identifier.

Returns:



2773
2774
2775
2776
# File 'lib/tdlib/client_methods.rb', line 2773

def get_supergroup_full_info(supergroup_id:)
  broadcast('@type'         => 'getSupergroupFullInfo',
            'supergroup_id' => supergroup_id)
end

#get_supergroup_members(supergroup_id:, filter:, offset:, limit:) ⇒ TD::Types::ChatMembers

Returns information about members or banned users in a supergroup or channel. Can be used only if SupergroupFullInfo.can_get_members == true; additionally, administrator privileges may be

required for some filters.

Parameters:

  • supergroup_id (Integer)

    Identifier of the supergroup or channel.

  • filter (TD::Types::SupergroupMembersFilter)

    The type of users to return. By default, supergroupMembersFilterRecent.

  • offset (Integer)

    Number of users to skip.

  • limit (Integer)

    The maximum number of users be returned; up to 200.

Returns:



2788
2789
2790
2791
2792
2793
2794
# File 'lib/tdlib/client_methods.rb', line 2788

def get_supergroup_members(supergroup_id:, filter:, offset:, limit:)
  broadcast('@type'         => 'getSupergroupMembers',
            'supergroup_id' => supergroup_id,
            'filter'        => filter,
            'offset'        => offset,
            'limit'         => limit)
end

#get_support_userTD::Types::User

Returns a user that can be contacted to get support.

Returns:



2799
2800
2801
# File 'lib/tdlib/client_methods.rb', line 2799

def get_support_user
  broadcast('@type' => 'getSupportUser')
end

#get_temporary_password_stateTD::Types::TemporaryPasswordState

Returns information about the current temporary password.



2806
2807
2808
# File 'lib/tdlib/client_methods.rb', line 2806

def get_temporary_password_state
  broadcast('@type' => 'getTemporaryPasswordState')
end

#get_text_entities(text:) ⇒ TD::Types::TextEntities

Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses)

contained in the text.

Can be called synchronously.

Parameters:

  • text (TD::Types::String)

    The text in which to look for entites.

Returns:



2816
2817
2818
2819
# File 'lib/tdlib/client_methods.rb', line 2816

def get_text_entities(text:)
  broadcast('@type' => 'getTextEntities',
            'text'  => text)
end

#get_top_chats(category:, limit:) ⇒ TD::Types::Chats

Returns a list of frequently used chats. Supported only if the chat info database is enabled.

Parameters:

  • category (TD::Types::TopChatCategory)

    Category of chats to be returned.

  • limit (Integer)

    The maximum number of chats to be returned; up to 30.

Returns:



2827
2828
2829
2830
2831
# File 'lib/tdlib/client_methods.rb', line 2827

def get_top_chats(category:, limit:)
  broadcast('@type'    => 'getTopChats',
            'category' => category,
            'limit'    => limit)
end

Returns a list of trending sticker sets. For the optimal performance the number of returned sticker sets is chosen by the library.

Parameters:

  • offset (Integer)

    The offset from which to return the sticker sets; must be non-negative.

  • limit (Integer)

    The maximum number of sticker sets to be returned; must be non-negative. Fewer sticker sets may be returned than specified by the limit, even if the end of the list has not been reached.

Returns:



2840
2841
2842
2843
2844
# File 'lib/tdlib/client_methods.rb', line 2840

def get_trending_sticker_sets(offset:, limit:)
  broadcast('@type'  => 'getTrendingStickerSets',
            'offset' => offset,
            'limit'  => limit)
end

#get_user(user_id:) ⇒ TD::Types::User

Returns information about a user by their identifier. This is an offline request if the current user is not a bot.

Parameters:

  • user_id (Integer)

    User identifier.

Returns:



2851
2852
2853
2854
# File 'lib/tdlib/client_methods.rb', line 2851

def get_user(user_id:)
  broadcast('@type'   => 'getUser',
            'user_id' => user_id)
end

#get_user_full_info(user_id:) ⇒ TD::Types::UserFullInfo

Returns full information about a user by their identifier.

Parameters:

  • user_id (Integer)

    User identifier.

Returns:



2860
2861
2862
2863
# File 'lib/tdlib/client_methods.rb', line 2860

def get_user_full_info(user_id:)
  broadcast('@type'   => 'getUserFullInfo',
            'user_id' => user_id)
end

#get_user_privacy_setting_rules(setting:) ⇒ TD::Types::UserPrivacySettingRules

Returns the current privacy settings.

Parameters:

Returns:



2869
2870
2871
2872
# File 'lib/tdlib/client_methods.rb', line 2869

def get_user_privacy_setting_rules(setting:)
  broadcast('@type'   => 'getUserPrivacySettingRules',
            'setting' => setting)
end

#get_user_profile_photos(user_id:, offset:, limit:) ⇒ TD::Types::ChatPhotos

Returns the profile photos of a user. The result of this query may be outdated: some photos might have been deleted already.

Parameters:

  • user_id (Integer)

    User identifier.

  • offset (Integer)

    The number of photos to skip; must be non-negative.

  • limit (Integer)

    The maximum number of photos to be returned; up to 100.

Returns:



2881
2882
2883
2884
2885
2886
# File 'lib/tdlib/client_methods.rb', line 2881

def (user_id:, offset:, limit:)
  broadcast('@type'   => 'getUserProfilePhotos',
            'user_id' => user_id,
            'offset'  => offset,
            'limit'   => limit)
end

#get_voice_chat_available_participants(chat_id:) ⇒ TD::Types::MessageSenders

Returns list of participant identifiers, which can be used to join voice chats in a chat.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



2892
2893
2894
2895
# File 'lib/tdlib/client_methods.rb', line 2892

def get_voice_chat_available_participants(chat_id:)
  broadcast('@type'   => 'getVoiceChatAvailableParticipants',
            'chat_id' => chat_id)
end

#get_web_page_instant_view(url:, force_full:) ⇒ TD::Types::WebPageInstantView

Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page.

Parameters:

  • url (TD::Types::String)

    The web page URL.

  • force_full (Boolean)

    If true, the full instant view for the web page will be returned.

Returns:



2903
2904
2905
2906
2907
# File 'lib/tdlib/client_methods.rb', line 2903

def get_web_page_instant_view(url:, force_full:)
  broadcast('@type'      => 'getWebPageInstantView',
            'url'        => url,
            'force_full' => force_full)
end

#get_web_page_preview(text:) ⇒ TD::Types::WebPage

Returns a web page preview by the text of the message. Do not call this function too often. Returns a 404 error if the web page has no preview.

Parameters:

Returns:



2915
2916
2917
2918
# File 'lib/tdlib/client_methods.rb', line 2915

def get_web_page_preview(text:)
  broadcast('@type' => 'getWebPagePreview',
            'text'  => text)
end

#hide_suggested_action(action:) ⇒ TD::Types::Ok

Hides a suggested action.

Parameters:

Returns:



2924
2925
2926
2927
# File 'lib/tdlib/client_methods.rb', line 2924

def hide_suggested_action(action:)
  broadcast('@type'  => 'hideSuggestedAction',
            'action' => action)
end

#import_contacts(contacts:) ⇒ TD::Types::ImportedContacts

Adds new contacts or edits existing contacts by their phone numbers; contacts’ user identifiers are ignored.

Parameters:

  • contacts (Array<TD::Types::Contact>)

    The list of contacts to import or edit; contacts’ vCard are ignored and are not imported.

Returns:



2934
2935
2936
2937
# File 'lib/tdlib/client_methods.rb', line 2934

def import_contacts(contacts:)
  broadcast('@type'    => 'importContacts',
            'contacts' => contacts)
end

#import_messages(chat_id:, message_file:, attached_files:) ⇒ TD::Types::Ok

Imports messages exported from another app.

Parameters:

Returns:



2951
2952
2953
2954
2955
2956
# File 'lib/tdlib/client_methods.rb', line 2951

def import_messages(chat_id:, message_file:, attached_files:)
  broadcast('@type'          => 'importMessages',
            'chat_id'        => chat_id,
            'message_file'   => message_file,
            'attached_files' => attached_files)
end

#invite_group_call_participants(group_call_id:, user_ids:) ⇒ TD::Types::Ok

Invites users to an active group call. Sends a service message of type messageInviteToGroupCall for voice chats.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • user_ids (Array<Integer>)

    User identifiers. At most 10 users can be invited simultaneously.

Returns:



2965
2966
2967
2968
2969
# File 'lib/tdlib/client_methods.rb', line 2965

def invite_group_call_participants(group_call_id:, user_ids:)
  broadcast('@type'         => 'inviteGroupCallParticipants',
            'group_call_id' => group_call_id,
            'user_ids'      => user_ids)
end

#join_chat(chat_id:) ⇒ TD::Types::Ok

Adds the current user as a new member to a chat. Private and secret chats can’t be joined using this method.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



2976
2977
2978
2979
# File 'lib/tdlib/client_methods.rb', line 2976

def join_chat(chat_id:)
  broadcast('@type'   => 'joinChat',
            'chat_id' => chat_id)
end

Uses an invite link to add the current user to the chat if possible.

Parameters:

  • invite_link (TD::Types::String)

    Invite link to import; must have URL “t.me”, “telegram.me”, or “telegram.dog” and query beginning with “/joinchat/” or “/+”.

Returns:



2986
2987
2988
2989
# File 'lib/tdlib/client_methods.rb', line 2986

def join_chat_by_invite_link(invite_link:)
  broadcast('@type'       => 'joinChatByInviteLink',
            'invite_link' => invite_link)
end

#join_group_call(group_call_id:, participant_id:, payload:, source:, is_muted:, invite_hash:) ⇒ TD::Types::GroupCallJoinResponse

Joins an active group call.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • participant_id (TD::Types::MessageSender)

    Identifier of a group call participant, which will be used to join the call; voice chats only.

  • payload (TD::Types::GroupCallPayload)

    Group join payload; received from tgcalls.

  • source (Integer)

    Caller synchronization source identifier; received from tgcalls.

  • is_muted (Boolean)

    True, if the user’s microphone is muted.

  • invite_hash (TD::Types::String)

    If non-empty, invite hash to be used to join the group call without being muted by administrators.

Returns:



3002
3003
3004
3005
3006
3007
3008
3009
3010
# File 'lib/tdlib/client_methods.rb', line 3002

def join_group_call(group_call_id:, participant_id:, payload:, source:, is_muted:, invite_hash:)
  broadcast('@type'          => 'joinGroupCall',
            'group_call_id'  => group_call_id,
            'participant_id' => participant_id,
            'payload'        => payload,
            'source'         => source,
            'is_muted'       => is_muted,
            'invite_hash'    => invite_hash)
end

#leave_chat(chat_id:) ⇒ TD::Types::Ok

Removes the current user from chat members. Private and secret chats can’t be left using this method.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



3017
3018
3019
3020
# File 'lib/tdlib/client_methods.rb', line 3017

def leave_chat(chat_id:)
  broadcast('@type'   => 'leaveChat',
            'chat_id' => chat_id)
end

#leave_group_call(group_call_id:) ⇒ TD::Types::Ok

Leaves a group call.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

Returns:



3026
3027
3028
3029
# File 'lib/tdlib/client_methods.rb', line 3026

def leave_group_call(group_call_id:)
  broadcast('@type'         => 'leaveGroupCall',
            'group_call_id' => group_call_id)
end

#load_group_call_participants(group_call_id:, limit:) ⇒ TD::Types::Ok

Loads more participants of a group call. The loaded participants will be received through updates. Use the field groupCall.loaded_all_participants to check whether all participants has already been loaded.

Parameters:

  • group_call_id (Integer)

    Group call identifier. The group call must be previously received through getGroupCall and must be joined or being joined.

  • limit (Integer)

    The maximum number of participants to load.

Returns:



3039
3040
3041
3042
3043
# File 'lib/tdlib/client_methods.rb', line 3039

def load_group_call_participants(group_call_id:, limit:)
  broadcast('@type'         => 'loadGroupCallParticipants',
            'group_call_id' => group_call_id,
            'limit'         => limit)
end

#log_outTD::Types::Ok

Closes the TDLib instance after a proper logout. Requires an available network connection. All local data will be destroyed. After the logout completes, updateAuthorizationState with authorizationStateClosed will be sent.

Returns:



3051
3052
3053
# File 'lib/tdlib/client_methods.rb', line 3051

def log_out
  broadcast('@type' => 'logOut')
end

#open_chat(chat_id:) ⇒ TD::Types::Ok

Informs TDLib that the chat is opened by the user. Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are

received only for opened chats).

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



3061
3062
3063
3064
# File 'lib/tdlib/client_methods.rb', line 3061

def open_chat(chat_id:)
  broadcast('@type'   => 'openChat',
            'chat_id' => chat_id)
end

#open_message_content(chat_id:, message_id:) ⇒ TD::Types::Ok

Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document,

location or venue, or has listened to an audio file or voice note message).

An updateMessageContentOpened update will be generated if something has changed.

Parameters:

  • chat_id (Integer)

    Chat identifier of the message.

  • message_id (Integer)

    Identifier of the message with the opened content.

Returns:



3073
3074
3075
3076
3077
# File 'lib/tdlib/client_methods.rb', line 3073

def open_message_content(chat_id:, message_id:)
  broadcast('@type'      => 'openMessageContent',
            'chat_id'    => chat_id,
            'message_id' => message_id)
end

#optimize_storage(size:, ttl:, count:, immunity_delay:, file_types:, chat_ids:, exclude_chat_ids:, return_deleted_file_statistics:, chat_limit:) ⇒ TD::Types::StorageStatistics

Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can’t be deleted.

Parameters:

  • size (Integer)

    Limit on the total size of files after deletion. Pass -1 to use the default limit.

  • ttl (Integer)

    Limit on the time that has passed since the last time a file was accessed (or creation time for some filesystems). Pass -1 to use the default limit.

  • count (Integer)

    Limit on the total count of files after deletion. Pass -1 to use the default limit.

  • immunity_delay (Integer)

    The amount of time after the creation of a file during which it can’t be deleted, in seconds. Pass -1 to use the default value.

  • file_types (Array<TD::Types::FileType>)

    If not empty, only files with the given type(s) are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted.

  • chat_ids (Array<Integer>)

    If not empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos).

  • exclude_chat_ids (Array<Integer>)

    If not empty, files from the given chats are excluded. Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos).

  • return_deleted_file_statistics (Boolean)

    Pass true if statistics about the files that were deleted must be returned instead of the whole storage usage statistics. Affects only returned statistics.

  • chat_limit (Integer)

    Same as in getStorageStatistics. Affects only returned statistics.

Returns:



3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
# File 'lib/tdlib/client_methods.rb', line 3105

def optimize_storage(size:, ttl:, count:, immunity_delay:, file_types:, chat_ids:, exclude_chat_ids:,
                     return_deleted_file_statistics:, chat_limit:)
  broadcast('@type'                          => 'optimizeStorage',
            'size'                           => size,
            'ttl'                            => ttl,
            'count'                          => count,
            'immunity_delay'                 => immunity_delay,
            'file_types'                     => file_types,
            'chat_ids'                       => chat_ids,
            'exclude_chat_ids'               => exclude_chat_ids,
            'return_deleted_file_statistics' => return_deleted_file_statistics,
            'chat_limit'                     => chat_limit)
end

#parse_markdown(text:) ⇒ TD::Types::FormattedText

Parses Markdown entities in a human-friendly format, ignoring markup errors. Can be called synchronously.

Parameters:

  • text (TD::Types::FormattedText)

    The text to parse. For example, “__italic__ ~~strikethrough~~ bold ‘code` “`pre“` [italic text_url](telegram.org) __italic**bold italic__bold**”.

Returns:



3126
3127
3128
3129
# File 'lib/tdlib/client_methods.rb', line 3126

def parse_markdown(text:)
  broadcast('@type' => 'parseMarkdown',
            'text'  => text)
end

#parse_text_entities(text:, parse_mode:) ⇒ TD::Types::FormattedText

Parses Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities contained in

the text.

Can be called synchronously.

Parameters:

Returns:



3138
3139
3140
3141
3142
# File 'lib/tdlib/client_methods.rb', line 3138

def parse_text_entities(text:, parse_mode:)
  broadcast('@type'      => 'parseTextEntities',
            'text'       => text,
            'parse_mode' => parse_mode)
end

#pin_chat_message(chat_id:, message_id:, disable_notification:, only_for_self:) ⇒ TD::Types::Ok

Pins a message in a chat; requires can_pin_messages rights or can_edit_messages rights in the channel.

Parameters:

  • chat_id (Integer)

    Identifier of the chat.

  • message_id (Integer)

    Identifier of the new pinned message.

  • disable_notification (Boolean)

    True, if there should be no notification about the pinned message. Notifications are always disabled in channels and private chats.

  • only_for_self (Boolean)

    True, if the message needs to be pinned for one side only; private chats only.

Returns:



3152
3153
3154
3155
3156
3157
3158
# File 'lib/tdlib/client_methods.rb', line 3152

def pin_chat_message(chat_id:, message_id:, disable_notification:, only_for_self:)
  broadcast('@type'                => 'pinChatMessage',
            'chat_id'              => chat_id,
            'message_id'           => message_id,
            'disable_notification' => disable_notification,
            'only_for_self'        => only_for_self)
end

#ping_proxy(proxy_id:) ⇒ TD::Types::Seconds

Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization.

Parameters:

  • proxy_id (Integer)

    Proxy identifier. Use 0 to ping a Telegram server without a proxy.

Returns:



3166
3167
3168
3169
# File 'lib/tdlib/client_methods.rb', line 3166

def ping_proxy(proxy_id:)
  broadcast('@type'    => 'pingProxy',
            'proxy_id' => proxy_id)
end

#process_push_notification(payload:) ⇒ TD::Types::Ok

Handles a push notification. Returns error with code 406 if the push notification is not supported and connection to the server is required to

fetch new data.

Can be called before authorization.

Parameters:

  • payload (TD::Types::String)

    JSON-encoded push notification payload with all fields sent by the server, and “google.sent_time” and “google.notification.sound” fields added.

Returns:



3179
3180
3181
3182
# File 'lib/tdlib/client_methods.rb', line 3179

def process_push_notification(payload:)
  broadcast('@type'   => 'processPushNotification',
            'payload' => payload)
end

#read_all_chat_mentions(chat_id:) ⇒ TD::Types::Ok

Marks all mentions in a chat as read.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



3188
3189
3190
3191
# File 'lib/tdlib/client_methods.rb', line 3188

def read_all_chat_mentions(chat_id:)
  broadcast('@type'   => 'readAllChatMentions',
            'chat_id' => chat_id)
end

#read_file_part(file_id:, offset:, count:) ⇒ TD::Types::FilePart

Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the application has no direct access to TDLib’s file system, because it

is usually slower than a direct read from the file.

Parameters:

  • file_id (Integer)

    Identifier of the file. The file must be located in the TDLib file cache.

  • offset (Integer)

    The offset from which to read the file.

  • count (Integer)

    Number of bytes to read. An error will be returned if there are not enough bytes available in the file from the specified position. Pass 0 to read all available data from the specified position.

Returns:



3204
3205
3206
3207
3208
3209
# File 'lib/tdlib/client_methods.rb', line 3204

def read_file_part(file_id:, offset:, count:)
  broadcast('@type'   => 'readFilePart',
            'file_id' => file_id,
            'offset'  => offset,
            'count'   => count)
end

#recover_authentication_password(recovery_code:) ⇒ TD::Types::Ok

Recovers the password with a password recovery code sent to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword.

Parameters:

  • recovery_code (TD::Types::String)

    Recovery code to check.

Returns:



3216
3217
3218
3219
# File 'lib/tdlib/client_methods.rb', line 3216

def recover_authentication_password(recovery_code:)
  broadcast('@type'         => 'recoverAuthenticationPassword',
            'recovery_code' => recovery_code)
end

#recover_password(recovery_code:) ⇒ TD::Types::PasswordState

Recovers the password using a recovery code sent to an email address that was previously set up.

Parameters:

  • recovery_code (TD::Types::String)

    Recovery code to check.

Returns:



3225
3226
3227
3228
# File 'lib/tdlib/client_methods.rb', line 3225

def recover_password(recovery_code:)
  broadcast('@type'         => 'recoverPassword',
            'recovery_code' => recovery_code)
end

#register_device(device_token:, other_user_ids:) ⇒ TD::Types::PushReceiverId

Registers the currently used device for receiving push notifications. Returns a globally unique identifier of the push notification subscription.

Parameters:

  • device_token (TD::Types::DeviceToken)

    Device token.

  • other_user_ids (Array<Integer>)

    List of user identifiers of other users currently using the application.

Returns:



3236
3237
3238
3239
3240
# File 'lib/tdlib/client_methods.rb', line 3236

def register_device(device_token:, other_user_ids:)
  broadcast('@type'          => 'registerDevice',
            'device_token'   => device_token,
            'other_user_ids' => other_user_ids)
end

#register_user(first_name:, last_name:) ⇒ TD::Types::Ok

Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration.

Parameters:

  • first_name (TD::Types::String)

    The first name of the user; 1-64 characters.

  • last_name (TD::Types::String)

    The last name of the user; 0-64 characters.

Returns:



3248
3249
3250
3251
3252
# File 'lib/tdlib/client_methods.rb', line 3248

def register_user(first_name:, last_name:)
  broadcast('@type'      => 'registerUser',
            'first_name' => first_name,
            'last_name'  => last_name)
end

#remove_background(background_id:) ⇒ TD::Types::Ok

Removes background from the list of installed backgrounds.

Parameters:

  • background_id (Integer)

    The background identifier.

Returns:



3258
3259
3260
3261
# File 'lib/tdlib/client_methods.rb', line 3258

def remove_background(background_id:)
  broadcast('@type'         => 'removeBackground',
            'background_id' => background_id)
end

#remove_chat_action_bar(chat_id:) ⇒ TD::Types::Ok

Removes a chat action bar without any other action.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



3267
3268
3269
3270
# File 'lib/tdlib/client_methods.rb', line 3267

def remove_chat_action_bar(chat_id:)
  broadcast('@type'   => 'removeChatActionBar',
            'chat_id' => chat_id)
end

#remove_contacts(user_ids:) ⇒ TD::Types::Ok

Removes users from the contact list.

Parameters:

  • user_ids (Array<Integer>)

    Identifiers of users to be deleted.

Returns:



3276
3277
3278
3279
# File 'lib/tdlib/client_methods.rb', line 3276

def remove_contacts(user_ids:)
  broadcast('@type'    => 'removeContacts',
            'user_ids' => user_ids)
end

#remove_favorite_sticker(sticker:) ⇒ TD::Types::Ok

Removes a sticker from the list of favorite stickers.

Parameters:

Returns:



3285
3286
3287
3288
# File 'lib/tdlib/client_methods.rb', line 3285

def remove_favorite_sticker(sticker:)
  broadcast('@type'   => 'removeFavoriteSticker',
            'sticker' => sticker)
end

#remove_notification(notification_group_id:, notification_id:) ⇒ TD::Types::Ok

Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user.

Parameters:

  • notification_group_id (Integer)

    Identifier of notification group to which the notification belongs.

  • notification_id (Integer)

    Identifier of removed notification.

Returns:



3296
3297
3298
3299
3300
# File 'lib/tdlib/client_methods.rb', line 3296

def remove_notification(notification_group_id:, notification_id:)
  broadcast('@type'                 => 'removeNotification',
            'notification_group_id' => notification_group_id,
            'notification_id'       => notification_id)
end

#remove_notification_group(notification_group_id:, max_notification_id:) ⇒ TD::Types::Ok

Removes a group of active notifications. Needs to be called only if the notification group is removed by the current user.

Parameters:

  • notification_group_id (Integer)

    Notification group identifier.

  • max_notification_id (Integer)

    The maximum identifier of removed notifications.

Returns:



3308
3309
3310
3311
3312
# File 'lib/tdlib/client_methods.rb', line 3308

def remove_notification_group(notification_group_id:, max_notification_id:)
  broadcast('@type'                 => 'removeNotificationGroup',
            'notification_group_id' => notification_group_id,
            'max_notification_id'   => max_notification_id)
end

#remove_proxy(proxy_id:) ⇒ TD::Types::Ok

Removes a proxy server. Can be called before authorization.

Parameters:

  • proxy_id (Integer)

    Proxy identifier.

Returns:



3319
3320
3321
3322
# File 'lib/tdlib/client_methods.rb', line 3319

def remove_proxy(proxy_id:)
  broadcast('@type'    => 'removeProxy',
            'proxy_id' => proxy_id)
end

#remove_recent_hashtag(hashtag:) ⇒ TD::Types::Ok

Removes a hashtag from the list of recently used hashtags.

Parameters:

  • hashtag (TD::Types::String)

    Hashtag to delete.

Returns:



3328
3329
3330
3331
# File 'lib/tdlib/client_methods.rb', line 3328

def remove_recent_hashtag(hashtag:)
  broadcast('@type'   => 'removeRecentHashtag',
            'hashtag' => hashtag)
end

#remove_recent_sticker(is_attached:, sticker:) ⇒ TD::Types::Ok

Removes a sticker from the list of recently used stickers.

Parameters:

  • is_attached (Boolean)

    Pass true to remove the sticker from the list of stickers recently attached to photo or video files; pass false to remove the sticker from the list of recently sent stickers.

  • sticker (TD::Types::InputFile)

    Sticker file to delete.

Returns:



3339
3340
3341
3342
3343
# File 'lib/tdlib/client_methods.rb', line 3339

def remove_recent_sticker(is_attached:, sticker:)
  broadcast('@type'       => 'removeRecentSticker',
            'is_attached' => is_attached,
            'sticker'     => sticker)
end

#remove_recently_found_chat(chat_id:) ⇒ TD::Types::Ok

Removes a chat from the list of recently found chats.

Parameters:

  • chat_id (Integer)

    Identifier of the chat to be removed.

Returns:



3349
3350
3351
3352
# File 'lib/tdlib/client_methods.rb', line 3349

def remove_recently_found_chat(chat_id:)
  broadcast('@type'   => 'removeRecentlyFoundChat',
            'chat_id' => chat_id)
end

#remove_saved_animation(animation:) ⇒ TD::Types::Ok

Removes an animation from the list of saved animations.

Parameters:

Returns:



3358
3359
3360
3361
# File 'lib/tdlib/client_methods.rb', line 3358

def remove_saved_animation(animation:)
  broadcast('@type'     => 'removeSavedAnimation',
            'animation' => animation)
end

#remove_sticker_from_set(sticker:) ⇒ TD::Types::Ok

Removes a sticker from the set to which it belongs; for bots only. The sticker set must have been created by the bot.

Parameters:

Returns:



3368
3369
3370
3371
# File 'lib/tdlib/client_methods.rb', line 3368

def remove_sticker_from_set(sticker:)
  broadcast('@type'   => 'removeStickerFromSet',
            'sticker' => sticker)
end

#remove_top_chat(category:, chat_id:) ⇒ TD::Types::Ok

Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled.

Parameters:

Returns:



3379
3380
3381
3382
3383
# File 'lib/tdlib/client_methods.rb', line 3379

def remove_top_chat(category:, chat_id:)
  broadcast('@type'    => 'removeTopChat',
            'category' => category,
            'chat_id'  => chat_id)
end

#reorder_chat_filters(chat_filter_ids:) ⇒ TD::Types::Ok

Changes the order of chat filters.

Parameters:

  • chat_filter_ids (Array<Integer>)

    Identifiers of chat filters in the new correct order.

Returns:



3389
3390
3391
3392
# File 'lib/tdlib/client_methods.rb', line 3389

def reorder_chat_filters(chat_filter_ids:)
  broadcast('@type'           => 'reorderChatFilters',
            'chat_filter_ids' => chat_filter_ids)
end

#reorder_installed_sticker_sets(is_masks:, sticker_set_ids:) ⇒ TD::Types::Ok

Changes the order of installed sticker sets.

Parameters:

  • is_masks (Boolean)

    Pass true to change the order of mask sticker sets; pass false to change the order of ordinary sticker sets.

  • sticker_set_ids (Array<Integer>)

    Identifiers of installed sticker sets in the new correct order.

Returns:



3400
3401
3402
3403
3404
# File 'lib/tdlib/client_methods.rb', line 3400

def reorder_installed_sticker_sets(is_masks:, sticker_set_ids:)
  broadcast('@type'           => 'reorderInstalledStickerSets',
            'is_masks'        => is_masks,
            'sticker_set_ids' => sticker_set_ids)
end

Replaces current primary invite link for a chat with a new primary invite link. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



3412
3413
3414
3415
# File 'lib/tdlib/client_methods.rb', line 3412

def replace_primary_chat_invite_link(chat_id:)
  broadcast('@type'   => 'replacePrimaryChatInviteLink',
            'chat_id' => chat_id)
end

#report_chat(chat_id:, message_ids:, reason:, text:) ⇒ TD::Types::Ok

Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if this is a private chat with a bot, a private chat with

a user sharing their location, a supergroup, or a channel, since other chats can't be checked by moderators.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • message_ids (Array<Integer>)

    Identifiers of reported messages, if any.

  • reason (TD::Types::ChatReportReason)

    The reason for reporting the chat.

  • text (TD::Types::String)

    Additional report details; 0-1024 characters.

Returns:



3426
3427
3428
3429
3430
3431
3432
# File 'lib/tdlib/client_methods.rb', line 3426

def report_chat(chat_id:, message_ids:, reason:, text:)
  broadcast('@type'       => 'reportChat',
            'chat_id'     => chat_id,
            'message_ids' => message_ids,
            'reason'      => reason,
            'text'        => text)
end

#report_chat_photo(chat_id:, file_id:, reason:, text:) ⇒ TD::Types::Ok

Reports a chat photo to the Telegram moderators. A chat photo can be reported only if this is a private chat with a bot, a private chat with a user sharing their

location, a supergroup, or a channel, since other chats can't be checked by moderators.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • file_id (Integer)

    Identifier of the photo to report. Only full photos from Types::ChatPhoto can be reported.

  • reason (TD::Types::ChatReportReason)

    The reason for reporting the chat photo.

  • text (TD::Types::String)

    Additional report details; 0-1024 characters.

Returns:



3444
3445
3446
3447
3448
3449
3450
# File 'lib/tdlib/client_methods.rb', line 3444

def report_chat_photo(chat_id:, file_id:, reason:, text:)
  broadcast('@type'   => 'reportChatPhoto',
            'chat_id' => chat_id,
            'file_id' => file_id,
            'reason'  => reason,
            'text'    => text)
end

#report_supergroup_spam(supergroup_id:, user_id:, message_ids:) ⇒ TD::Types::Ok

Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup.

Parameters:

  • supergroup_id (Integer)

    Supergroup identifier.

  • user_id (Integer)

    User identifier.

  • message_ids (Array<Integer>)

    Identifiers of messages sent in the supergroup by the user. This list must be non-empty.

Returns:



3459
3460
3461
3462
3463
3464
# File 'lib/tdlib/client_methods.rb', line 3459

def report_supergroup_spam(supergroup_id:, user_id:, message_ids:)
  broadcast('@type'         => 'reportSupergroupSpam',
            'supergroup_id' => supergroup_id,
            'user_id'       => user_id,
            'message_ids'   => message_ids)
end

#request_authentication_password_recoveryTD::Types::Ok

Requests to send a password recovery code to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword.

Returns:



3470
3471
3472
# File 'lib/tdlib/client_methods.rb', line 3470

def request_authentication_password_recovery
  broadcast('@type' => 'requestAuthenticationPasswordRecovery')
end

#request_password_recoveryTD::Types::EmailAddressAuthenticationCodeInfo

Requests to send a password recovery code to an email address that was previously set up.



3477
3478
3479
# File 'lib/tdlib/client_methods.rb', line 3477

def request_password_recovery
  broadcast('@type' => 'requestPasswordRecovery')
end

#request_qr_code_authentication(other_user_ids:) ⇒ TD::Types::Ok

Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending

authentication query and the current authorization state is authorizationStateWaitCode,
authorizationStateWaitRegistration, or authorizationStateWaitPassword.

Parameters:

  • other_user_ids (Array<Integer>)

    List of user identifiers of other users currently using the application.

Returns:



3488
3489
3490
3491
# File 'lib/tdlib/client_methods.rb', line 3488

def request_qr_code_authentication(other_user_ids:)
  broadcast('@type'          => 'requestQrCodeAuthentication',
            'other_user_ids' => other_user_ids)
end

#resend_authentication_codeTD::Types::Ok

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.

Returns:



3498
3499
3500
# File 'lib/tdlib/client_methods.rb', line 3498

def resend_authentication_code
  broadcast('@type' => 'resendAuthenticationCode')
end

#resend_change_phone_number_codeTD::Types::AuthenticationCodeInfo

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.



3506
3507
3508
# File 'lib/tdlib/client_methods.rb', line 3506

def resend_change_phone_number_code
  broadcast('@type' => 'resendChangePhoneNumberCode')
end

#resend_email_address_verification_codeTD::Types::EmailAddressAuthenticationCodeInfo

Re-sends the code to verify an email address to be added to a user’s Telegram Passport.



3513
3514
3515
# File 'lib/tdlib/client_methods.rb', line 3513

def resend_email_address_verification_code
  broadcast('@type' => 'resendEmailAddressVerificationCode')
end

#resend_messages(chat_id:, message_ids:) ⇒ TD::Types::Messages

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.

Parameters:

  • chat_id (Integer)

    Identifier of the chat to send messages.

  • message_ids (Array<Integer>)

    Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order.

Returns:



3528
3529
3530
3531
3532
# File 'lib/tdlib/client_methods.rb', line 3528

def resend_messages(chat_id:, message_ids:)
  broadcast('@type'       => 'resendMessages',
            'chat_id'     => chat_id,
            'message_ids' => message_ids)
end

#resend_phone_number_confirmation_codeTD::Types::AuthenticationCodeInfo

Resends phone number confirmation code.



3537
3538
3539
# File 'lib/tdlib/client_methods.rb', line 3537

def resend_phone_number_confirmation_code
  broadcast('@type' => 'resendPhoneNumberConfirmationCode')
end

#resend_phone_number_verification_codeTD::Types::AuthenticationCodeInfo

Re-sends the code to verify a phone number to be added to a user’s Telegram Passport.



3544
3545
3546
# File 'lib/tdlib/client_methods.rb', line 3544

def resend_phone_number_verification_code
  broadcast('@type' => 'resendPhoneNumberVerificationCode')
end

#resend_recovery_email_address_codeTD::Types::PasswordState

Resends the 2-step verification recovery email address verification code.



3551
3552
3553
# File 'lib/tdlib/client_methods.rb', line 3551

def resend_recovery_email_address_code
  broadcast('@type' => 'resendRecoveryEmailAddressCode')
end

#reset_all_notification_settingsTD::Types::Ok

Resets all notification settings to their default values. By default, all chats are unmuted, the sound is set to “default” and message previews are shown.

Returns:



3559
3560
3561
# File 'lib/tdlib/client_methods.rb', line 3559

def reset_all_notification_settings
  broadcast('@type' => 'resetAllNotificationSettings')
end

#reset_backgroundsTD::Types::Ok

Resets list of installed backgrounds to its default value.

Returns:



3566
3567
3568
# File 'lib/tdlib/client_methods.rb', line 3566

def reset_backgrounds
  broadcast('@type' => 'resetBackgrounds')
end

#reset_network_statisticsTD::Types::Ok

Resets all network data usage statistics to zero. Can be called before authorization.

Returns:



3574
3575
3576
# File 'lib/tdlib/client_methods.rb', line 3574

def reset_network_statistics
  broadcast('@type' => 'resetNetworkStatistics')
end

Revokes invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for

other links.

If a primary link is revoked, then additionally to the revoked link returns new primary link.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • invite_link (TD::Types::String)

    Invite link to be revoked.

Returns:



3587
3588
3589
3590
3591
# File 'lib/tdlib/client_methods.rb', line 3587

def revoke_chat_invite_link(chat_id:, invite_link:)
  broadcast('@type'       => 'revokeChatInviteLink',
            'chat_id'     => chat_id,
            'invite_link' => invite_link)
end

Revokes invite link for a group call. Requires groupCall.can_be_managed group call flag.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

Returns:



3598
3599
3600
3601
# File 'lib/tdlib/client_methods.rb', line 3598

def revoke_group_call_invite_link(group_call_id:)
  broadcast('@type'         => 'revokeGroupCallInviteLink',
            'group_call_id' => group_call_id)
end

#save_application_log_event(type:, chat_id:, data:) ⇒ TD::Types::Ok

Saves application log event on the server. Can be called before authorization.

Parameters:

  • type (TD::Types::String)

    Event type.

  • chat_id (Integer)

    Optional chat identifier, associated with the event.

  • data (TD::Types::JsonValue)

    The log event data.

Returns:



3610
3611
3612
3613
3614
3615
# File 'lib/tdlib/client_methods.rb', line 3610

def save_application_log_event(type:, chat_id:, data:)
  broadcast('@type'   => 'saveApplicationLogEvent',
            'type'    => type,
            'chat_id' => chat_id,
            'data'    => data)
end

#search_background(name:) ⇒ TD::Types::Background

Searches for a background by its name.

Parameters:

  • name (TD::Types::String)

    The name of the background.

Returns:



3621
3622
3623
3624
# File 'lib/tdlib/client_methods.rb', line 3621

def search_background(name:)
  broadcast('@type' => 'searchBackground',
            'name'  => name)
end

#search_call_messages(from_message_id:, limit:, only_missed:) ⇒ TD::Types::Messages

Searches for call messages. Returns the results in reverse chronological order (i. e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library.

Parameters:

  • from_message_id (Integer)

    Identifier of the message from which to search; use 0 to get results from the last message.

  • limit (Integer)

    The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached.

  • only_missed (Boolean)

    If true, returns only messages with missed calls.

Returns:



3638
3639
3640
3641
3642
3643
# File 'lib/tdlib/client_methods.rb', line 3638

def search_call_messages(from_message_id:, limit:, only_missed:)
  broadcast('@type'           => 'searchCallMessages',
            'from_message_id' => from_message_id,
            'limit'           => limit,
            'only_missed'     => only_missed)
end

#search_chat_members(chat_id:, query:, limit:, filter:) ⇒ TD::Types::ChatMembers

Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • query (TD::Types::String)

    Query to search for.

  • limit (Integer)

    The maximum number of users to be returned.

  • filter (TD::Types::ChatMembersFilter)

    The type of users to return. By default, chatMembersFilterMembers.

Returns:



3654
3655
3656
3657
3658
3659
3660
# File 'lib/tdlib/client_methods.rb', line 3654

def search_chat_members(chat_id:, query:, limit:, filter:)
  broadcast('@type'   => 'searchChatMembers',
            'chat_id' => chat_id,
            'query'   => query,
            'limit'   => limit,
            'filter'  => filter)
end

#search_chat_messages(chat_id:, query:, sender:, from_message_id:, offset:, limit:, filter:, message_thread_id:) ⇒ TD::Types::Messages

Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages should be used instead), or without an

enabled message database.

For optimal performance the number of returned messages is chosen by the library.

Parameters:

  • chat_id (Integer)

    Identifier of the chat in which to search messages.

  • query (TD::Types::String)

    Query to search for.

  • sender (TD::Types::MessageSender)

    If not null, only messages sent by the specified sender will be returned. Not supported in secret chats.

  • from_message_id (Integer)

    Identifier of the message starting from which history must be fetched; use 0 to get results from the last message.

  • offset (Integer)

    Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages.

  • limit (Integer)

    The maximum number of messages to be returned; must be positive and can’t be greater than 100. If the offset is negative, the limit must be greater than -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached.

  • filter (TD::Types::SearchMessagesFilter)

    Filter for message content in the search results.

  • message_thread_id (Integer)

    If not 0, only messages in the specified thread will be returned; supergroups only.

Returns:



3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
# File 'lib/tdlib/client_methods.rb', line 3686

def search_chat_messages(chat_id:, query:, sender:, from_message_id:, offset:, limit:, filter:, message_thread_id:)
  broadcast('@type'             => 'searchChatMessages',
            'chat_id'           => chat_id,
            'query'             => query,
            'sender'            => sender,
            'from_message_id'   => from_message_id,
            'offset'            => offset,
            'limit'             => limit,
            'filter'            => filter,
            'message_thread_id' => message_thread_id)
end

#search_chat_recent_location_messages(chat_id:, limit:) ⇒ TD::Types::Messages

Returns information about the recent locations of chat members that were sent to the chat. Returns up to 1 location message per user.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • limit (Integer)

    The maximum number of messages to be returned.

Returns:



3704
3705
3706
3707
3708
# File 'lib/tdlib/client_methods.rb', line 3704

def search_chat_recent_location_messages(chat_id:, limit:)
  broadcast('@type'   => 'searchChatRecentLocationMessages',
            'chat_id' => chat_id,
            'limit'   => limit)
end

#search_chats(query:, limit:) ⇒ TD::Types::Chats

Searches for the specified query in the title and username of already known chats, this is an offline request. Returns chats in the order seen in the main chat list.

Parameters:

  • query (TD::Types::String)

    Query to search for. If the query is empty, returns up to 20 recently found chats.

  • limit (Integer)

    The maximum number of chats to be returned.

Returns:



3717
3718
3719
3720
3721
# File 'lib/tdlib/client_methods.rb', line 3717

def search_chats(query:, limit:)
  broadcast('@type' => 'searchChats',
            'query' => query,
            'limit' => limit)
end

#search_chats_nearby(location:) ⇒ TD::Types::ChatsNearby

Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. The request should be sent again every 25 seconds with adjusted location to not miss new chats.

Parameters:

Returns:



3729
3730
3731
3732
# File 'lib/tdlib/client_methods.rb', line 3729

def search_chats_nearby(location:)
  broadcast('@type'    => 'searchChatsNearby',
            'location' => location)
end

#search_chats_on_server(query:, limit:) ⇒ TD::Types::Chats

Searches for the specified query in the title and username of already known chats via request to the server. Returns chats in the order seen in the main chat list.

Parameters:

  • query (TD::Types::String)

    Query to search for.

  • limit (Integer)

    The maximum number of chats to be returned.

Returns:



3740
3741
3742
3743
3744
# File 'lib/tdlib/client_methods.rb', line 3740

def search_chats_on_server(query:, limit:)
  broadcast('@type' => 'searchChatsOnServer',
            'query' => query,
            'limit' => limit)
end

#search_contacts(query: nil, limit:) ⇒ TD::Types::Users

Searches for the specified query in the first names, last names and usernames of the known user contacts.

Parameters:

  • query (TD::Types::String, nil) (defaults to: nil)

    Query to search for; may be empty to return all contacts.

  • limit (Integer)

    The maximum number of users to be returned.

Returns:



3751
3752
3753
3754
3755
# File 'lib/tdlib/client_methods.rb', line 3751

def search_contacts(query: nil, limit:)
  broadcast('@type' => 'searchContacts',
            'query' => query,
            'limit' => limit)
end

#search_emojis(text:, exact_match:, input_language_codes: nil) ⇒ TD::Types::Emojis

Searches for emojis by keywords. Supported only if the file database is enabled.

Parameters:

  • text (TD::Types::String)

    Text to search for.

  • exact_match (Boolean)

    True, if only emojis, which exactly match text needs to be returned.

  • input_language_codes (Array<TD::Types::String>, nil) (defaults to: nil)

    List of possible IETF language tags of the user’s input language; may be empty if unknown.

Returns:



3765
3766
3767
3768
3769
3770
# File 'lib/tdlib/client_methods.rb', line 3765

def search_emojis(text:, exact_match:, input_language_codes: nil)
  broadcast('@type'                => 'searchEmojis',
            'text'                 => text,
            'exact_match'          => exact_match,
            'input_language_codes' => input_language_codes)
end

#search_hashtags(prefix:, limit:) ⇒ TD::Types::Hashtags

Searches for recently used hashtags by their prefix.

Parameters:

  • prefix (TD::Types::String)

    Hashtag prefix to search for.

  • limit (Integer)

    The maximum number of hashtags to be returned.

Returns:



3777
3778
3779
3780
3781
# File 'lib/tdlib/client_methods.rb', line 3777

def search_hashtags(prefix:, limit:)
  broadcast('@type'  => 'searchHashtags',
            'prefix' => prefix,
            'limit'  => limit)
end

#search_installed_sticker_sets(is_masks:, query:, limit:) ⇒ TD::Types::StickerSets

Searches for installed sticker sets by looking for specified query in their title and name.

Parameters:

  • is_masks (Boolean)

    Pass true to return mask sticker sets; pass false to return ordinary sticker sets.

  • query (TD::Types::String)

    Query to search for.

  • limit (Integer)

    The maximum number of sticker sets to return.

Returns:



3789
3790
3791
3792
3793
3794
# File 'lib/tdlib/client_methods.rb', line 3789

def search_installed_sticker_sets(is_masks:, query:, limit:)
  broadcast('@type'    => 'searchInstalledStickerSets',
            'is_masks' => is_masks,
            'query'    => query,
            'limit'    => limit)
end

#search_messages(chat_list:, query:, offset_date:, offset_chat_id:, offset_message_id:, limit:, filter:, min_date:, max_date:) ⇒ TD::Types::Messages

Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). For optimal performance the number of returned messages is chosen by the library.

Parameters:

  • chat_list (TD::Types::ChatList)

    Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported.

  • query (TD::Types::String)

    Query to search for.

  • offset_date (Integer)

    The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message.

  • offset_chat_id (Integer)

    The chat identifier of the last found message, or 0 for the first request.

  • offset_message_id (Integer)

    The message identifier of the last found message, or 0 for the first request.

  • limit (Integer)

    The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached.

  • filter (TD::Types::SearchMessagesFilter)

    Filter for message content in the search results; searchMessagesFilterCall, searchMessagesFilterMissedCall, searchMessagesFilterMention, searchMessagesFilterUnreadMention, Types::SearchMessagesFilter::FailedToSend and Types::SearchMessagesFilter::Pinned are unsupported in this function.

  • min_date (Integer)

    If not 0, the minimum date of the messages to return.

  • max_date (Integer)

    If not 0, the maximum date of the messages to return.

Returns:



3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
# File 'lib/tdlib/client_methods.rb', line 3818

def search_messages(chat_list:, query:, offset_date:, offset_chat_id:, offset_message_id:, limit:, filter:, min_date:,
                    max_date:)
  broadcast('@type'             => 'searchMessages',
            'chat_list'         => chat_list,
            'query'             => query,
            'offset_date'       => offset_date,
            'offset_chat_id'    => offset_chat_id,
            'offset_message_id' => offset_message_id,
            'limit'             => limit,
            'filter'            => filter,
            'min_date'          => min_date,
            'max_date'          => max_date)
end

#search_public_chat(username:) ⇒ TD::Types::Chat

Searches a public chat by its username. Currently only private chats, supergroups and channels can be public. Returns the chat if found; otherwise an error is returned.

Parameters:

  • username (TD::Types::String)

    Username to be resolved.

Returns:



3838
3839
3840
3841
# File 'lib/tdlib/client_methods.rb', line 3838

def search_public_chat(username:)
  broadcast('@type'    => 'searchPublicChat',
            'username' => username)
end

#search_public_chats(query:) ⇒ TD::Types::Chats

Searches public chats by looking for specified query in their username and title. Currently only private chats, supergroups and channels can be public. Returns a meaningful number of results. Returns nothing if the length of the searched username prefix is less than 5. Excludes private chats with contacts and chats from the chat list from the results.

Parameters:

  • query (TD::Types::String)

    Query to search for.

Returns:



3851
3852
3853
3854
# File 'lib/tdlib/client_methods.rb', line 3851

def search_public_chats(query:)
  broadcast('@type' => 'searchPublicChats',
            'query' => query)
end

#search_secret_messages(chat_id:, query:, offset:, limit:, filter:) ⇒ TD::Types::FoundMessages

Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance the number of returned messages is chosen by the library.

Parameters:

  • chat_id (Integer)

    Identifier of the chat in which to search. Specify 0 to search in all secret chats.

  • query (TD::Types::String)

    Query to search for. If empty, searchChatMessages should be used instead.

  • offset (TD::Types::String)

    Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results.

  • limit (Integer)

    The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached.

  • filter (TD::Types::SearchMessagesFilter)

    A filter for message content in the search results.

Returns:



3871
3872
3873
3874
3875
3876
3877
3878
# File 'lib/tdlib/client_methods.rb', line 3871

def search_secret_messages(chat_id:, query:, offset:, limit:, filter:)
  broadcast('@type'   => 'searchSecretMessages',
            'chat_id' => chat_id,
            'query'   => query,
            'offset'  => offset,
            'limit'   => limit,
            'filter'  => filter)
end

#search_sticker_set(name:) ⇒ TD::Types::StickerSet

Searches for a sticker set by its name.

Parameters:

  • name (TD::Types::String)

    Name of the sticker set.

Returns:



3884
3885
3886
3887
# File 'lib/tdlib/client_methods.rb', line 3884

def search_sticker_set(name:)
  broadcast('@type' => 'searchStickerSet',
            'name'  => name)
end

#search_sticker_sets(query:) ⇒ TD::Types::StickerSets

Searches for ordinary sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results.

Parameters:

  • query (TD::Types::String)

    Query to search for.

Returns:



3894
3895
3896
3897
# File 'lib/tdlib/client_methods.rb', line 3894

def search_sticker_sets(query:)
  broadcast('@type' => 'searchStickerSets',
            'query' => query)
end

#search_stickers(emoji:, limit: nil) ⇒ TD::Types::Stickers

Searches for stickers from public sticker sets that correspond to a given emoji.

Parameters:

  • emoji (TD::Types::String)

    String representation of emoji; must be non-empty.

  • limit (Integer, nil) (defaults to: nil)

    The maximum number of stickers to be returned.

Returns:



3904
3905
3906
3907
3908
# File 'lib/tdlib/client_methods.rb', line 3904

def search_stickers(emoji:, limit: nil)
  broadcast('@type' => 'searchStickers',
            'emoji' => emoji,
            'limit' => limit)
end

#send_bot_start_message(bot_user_id:, chat_id:, parameter:) ⇒ TD::Types::Message

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.

Parameters:

  • bot_user_id (Integer)

    Identifier of the bot.

  • chat_id (Integer)

    Identifier of the target chat.

  • parameter (TD::Types::String)

    A hidden parameter sent to the bot for deep linking purposes (core.telegram.org/bots#deep-linking).

Returns:



3920
3921
3922
3923
3924
3925
# File 'lib/tdlib/client_methods.rb', line 3920

def send_bot_start_message(bot_user_id:, chat_id:, parameter:)
  broadcast('@type'       => 'sendBotStartMessage',
            'bot_user_id' => bot_user_id,
            'chat_id'     => chat_id,
            'parameter'   => parameter)
end

#send_call_debug_information(call_id:, debug_information:) ⇒ TD::Types::Ok

Sends debug information for a call.

Parameters:

  • call_id (Integer)

    Call identifier.

  • debug_information (TD::Types::String)

    Debug information in application-specific format.

Returns:



3932
3933
3934
3935
3936
# File 'lib/tdlib/client_methods.rb', line 3932

def send_call_debug_information(call_id:, debug_information:)
  broadcast('@type'             => 'sendCallDebugInformation',
            'call_id'           => call_id,
            'debug_information' => debug_information)
end

#send_call_rating(call_id:, rating:, comment:, problems:) ⇒ TD::Types::Ok

Sends a call rating.

Parameters:

  • call_id (Integer)

    Call identifier.

  • rating (Integer)

    Call rating; 1-5.

  • comment (TD::Types::String)

    An optional user comment if the rating is less than 5.

  • problems (Array<TD::Types::CallProblem>)

    List of the exact types of problems with the call, specified by the user.

Returns:



3946
3947
3948
3949
3950
3951
3952
# File 'lib/tdlib/client_methods.rb', line 3946

def send_call_rating(call_id:, rating:, comment:, problems:)
  broadcast('@type'    => 'sendCallRating',
            'call_id'  => call_id,
            'rating'   => rating,
            'comment'  => comment,
            'problems' => problems)
end

#send_call_signaling_data(call_id:, data:) ⇒ TD::Types::Ok

Sends call signaling data.

Parameters:

  • call_id (Integer)

    Call identifier.

  • data (String)

    The data.

Returns:



3959
3960
3961
3962
3963
# File 'lib/tdlib/client_methods.rb', line 3959

def send_call_signaling_data(call_id:, data:)
  broadcast('@type'   => 'sendCallSignalingData',
            'call_id' => call_id,
            'data'    => data)
end

#send_chat_action(chat_id:, message_thread_id:, action:) ⇒ TD::Types::Ok

Sends a notification about user activity in a chat.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • message_thread_id (Integer)

    If not 0, a message thread identifier in which the action was performed.

  • action (TD::Types::ChatAction)

    The action description.

Returns:



3971
3972
3973
3974
3975
3976
# File 'lib/tdlib/client_methods.rb', line 3971

def send_chat_action(chat_id:, message_thread_id:, action:)
  broadcast('@type'             => 'sendChatAction',
            'chat_id'           => chat_id,
            'message_thread_id' => message_thread_id,
            'action'            => action)
end

#send_chat_screenshot_taken_notification(chat_id:) ⇒ TD::Types::Ok

Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats.

Parameters:

  • chat_id (Integer)

    Chat identifier.

Returns:



3983
3984
3985
3986
# File 'lib/tdlib/client_methods.rb', line 3983

def send_chat_screenshot_taken_notification(chat_id:)
  broadcast('@type'   => 'sendChatScreenshotTakenNotification',
            'chat_id' => chat_id)
end

#send_custom_request(method:, parameters:) ⇒ TD::Types::CustomRequestResult

Sends a custom request; for bots only.

Parameters:

  • method (TD::Types::String)

    The method name.

  • parameters (TD::Types::String)

    JSON-serialized method parameters.

Returns:



3993
3994
3995
3996
3997
# File 'lib/tdlib/client_methods.rb', line 3993

def send_custom_request(method:, parameters:)
  broadcast('@type'      => 'sendCustomRequest',
            'method'     => method,
            'parameters' => parameters)
end

#send_email_address_verification_code(email_address:) ⇒ TD::Types::EmailAddressAuthenticationCodeInfo

Sends a code to verify an email address to be added to a user’s Telegram Passport.

Parameters:

  • email_address (TD::Types::String)

    Email address.

Returns:



4003
4004
4005
4006
# File 'lib/tdlib/client_methods.rb', line 4003

def send_email_address_verification_code(email_address:)
  broadcast('@type'         => 'sendEmailAddressVerificationCode',
            'email_address' => email_address)
end

#send_inline_query_result_message(chat_id:, message_thread_id:, reply_to_message_id:, options:, query_id:, result_id:, hide_via_bot:) ⇒ TD::Types::Message

Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message.

Parameters:

  • chat_id (Integer)

    Target chat.

  • message_thread_id (Integer)

    If not 0, a message thread identifier in which the message will be sent.

  • reply_to_message_id (Integer)

    Identifier of a message to reply to or 0.

  • options (TD::Types::MessageSendOptions)

    Options to be used to send the message.

  • query_id (Integer)

    Identifier of the inline query.

  • result_id (TD::Types::String)

    Identifier of the inline result.

  • hide_via_bot (Boolean)

    If true, there will be no mention of a bot, via which the message is sent. Can be used only for bots GetOption(“animation_search_bot_username”), GetOption(“photo_search_bot_username”) and GetOption(“venue_search_bot_username”).

Returns:



4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
# File 'lib/tdlib/client_methods.rb', line 4022

def send_inline_query_result_message(chat_id:, message_thread_id:, reply_to_message_id:, options:, query_id:,
                                     result_id:, hide_via_bot:)
  broadcast('@type'               => 'sendInlineQueryResultMessage',
            'chat_id'             => chat_id,
            'message_thread_id'   => message_thread_id,
            'reply_to_message_id' => reply_to_message_id,
            'options'             => options,
            'query_id'            => query_id,
            'result_id'           => result_id,
            'hide_via_bot'        => hide_via_bot)
end

#send_message(chat_id:, message_thread_id:, reply_to_message_id:, options:, reply_markup:, input_message_content:) ⇒ TD::Types::Message

Sends a message. Returns the sent message.

Parameters:

  • chat_id (Integer)

    Target chat.

  • message_thread_id (Integer)

    If not 0, a message thread identifier in which the message will be sent.

  • reply_to_message_id (Integer)

    Identifier of the message to reply to or 0.

  • options (TD::Types::MessageSendOptions)

    Options to be used to send the message.

  • reply_markup (TD::Types::ReplyMarkup)

    Markup for replying to the message; for bots only.

  • input_message_content (TD::Types::InputMessageContent)

    The content of the message to be sent.

Returns:



4044
4045
4046
4047
4048
4049
4050
4051
4052
# File 'lib/tdlib/client_methods.rb', line 4044

def send_message(chat_id:, message_thread_id:, reply_to_message_id:, options:, reply_markup:, input_message_content:)
  broadcast('@type'                 => 'sendMessage',
            'chat_id'               => chat_id,
            'message_thread_id'     => message_thread_id,
            'reply_to_message_id'   => reply_to_message_id,
            'options'               => options,
            'reply_markup'          => reply_markup,
            'input_message_content' => input_message_content)
end

#send_message_album(chat_id:, message_thread_id:, reply_to_message_id:, options:, input_message_contents:) ⇒ TD::Types::Messages

Sends 2-10 messages grouped together into an album. Currently only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages.

Parameters:

  • chat_id (Integer)

    Target chat.

  • message_thread_id (Integer)

    If not 0, a message thread identifier in which the messages will be sent.

  • reply_to_message_id (Integer)

    Identifier of a message to reply to or 0.

  • options (TD::Types::MessageSendOptions)

    Options to be used to send the messages.

  • input_message_contents (Array<TD::Types::InputMessageContent>)

    Contents of messages to be sent. At most 10 messages can be added to an album.

Returns:



4066
4067
4068
4069
4070
4071
4072
4073
# File 'lib/tdlib/client_methods.rb', line 4066

def send_message_album(chat_id:, message_thread_id:, reply_to_message_id:, options:, input_message_contents:)
  broadcast('@type'                  => 'sendMessageAlbum',
            'chat_id'                => chat_id,
            'message_thread_id'      => message_thread_id,
            'reply_to_message_id'    => reply_to_message_id,
            'options'                => options,
            'input_message_contents' => input_message_contents)
end

#send_passport_authorization_form(autorization_form_id:, types:) ⇒ TD::Types::Ok

Sends a Telegram Passport authorization form, effectively sharing data with the service. This method must be called after getPassportAuthorizationFormAvailableElements if some previously available

elements are going to be reused.

Parameters:

  • autorization_form_id (Integer)

    Authorization form identifier.

  • types (Array<TD::Types::PassportElementType>)

    Types of Telegram Passport elements chosen by user to complete the authorization form.

Returns:



4083
4084
4085
4086
4087
# File 'lib/tdlib/client_methods.rb', line 4083

def send_passport_authorization_form(autorization_form_id:, types:)
  broadcast('@type'                => 'sendPassportAuthorizationForm',
            'autorization_form_id' => autorization_form_id,
            'types'                => types)
end

#send_payment_form(chat_id:, message_id:, payment_form_id:, order_info_id:, shipping_option_id:, credentials:, tip_amount:) ⇒ TD::Types::PaymentResult

Sends a filled-out payment form to the bot for final verification.

Parameters:

  • chat_id (Integer)

    Chat identifier of the Invoice message.

  • message_id (Integer)

    Message identifier.

  • payment_form_id (Integer)

    Payment form identifier returned by getPaymentForm.

  • order_info_id (TD::Types::String)

    Identifier returned by validateOrderInfo, or an empty string.

  • shipping_option_id (TD::Types::String)

    Identifier of a chosen shipping option, if applicable.

  • credentials (TD::Types::InputCredentials)

    The credentials chosen by user for payment.

  • tip_amount (Integer)

    Chosen by the user amount of tip in the smallest units of the currency.

Returns:



4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
# File 'lib/tdlib/client_methods.rb', line 4099

def send_payment_form(chat_id:, message_id:, payment_form_id:, order_info_id:, shipping_option_id:, credentials:,
                      tip_amount:)
  broadcast('@type'              => 'sendPaymentForm',
            'chat_id'            => chat_id,
            'message_id'         => message_id,
            'payment_form_id'    => payment_form_id,
            'order_info_id'      => order_info_id,
            'shipping_option_id' => shipping_option_id,
            'credentials'        => credentials,
            'tip_amount'         => tip_amount)
end

#send_phone_number_confirmation_code(hash:, phone_number:, settings:) ⇒ TD::Types::AuthenticationCodeInfo

Sends phone number confirmation code. Should be called when user presses “t.me/confirmphone?phone=*******&hash=**********” or

"tg://confirmphone?phone=*******&hash=**********" link.

Parameters:

  • hash (TD::Types::String)

    Value of the “hash” parameter from the link.

  • phone_number (TD::Types::String)

    Value of the “phone” parameter from the link.

  • settings (TD::Types::PhoneNumberAuthenticationSettings)

    Settings for the authentication of the user’s phone number.

Returns:



4120
4121
4122
4123
4124
4125
# File 'lib/tdlib/client_methods.rb', line 4120

def send_phone_number_confirmation_code(hash:, phone_number:, settings:)
  broadcast('@type'        => 'sendPhoneNumberConfirmationCode',
            'hash'         => hash,
            'phone_number' => phone_number,
            'settings'     => settings)
end

#send_phone_number_verification_code(phone_number:, settings:) ⇒ TD::Types::AuthenticationCodeInfo

Sends a code to verify a phone number to be added to a user’s Telegram Passport.

Parameters:

Returns:



4133
4134
4135
4136
4137
# File 'lib/tdlib/client_methods.rb', line 4133

def send_phone_number_verification_code(phone_number:, settings:)
  broadcast('@type'        => 'sendPhoneNumberVerificationCode',
            'phone_number' => phone_number,
            'settings'     => settings)
end

#set_account_ttl(ttl:) ⇒ TD::Types::Ok

Changes the period of inactivity after which the account of the current user will automatically be deleted.

Parameters:

Returns:



4143
4144
4145
4146
# File 'lib/tdlib/client_methods.rb', line 4143

def (ttl:)
  broadcast('@type' => 'setAccountTtl',
            'ttl'   => ttl)
end

#set_alarm(seconds:) ⇒ TD::Types::Ok

Succeeds after a specified amount of time has passed. Can be called before initialization.

Parameters:

  • seconds (Float)

    Number of seconds before the function returns.

Returns:



4153
4154
4155
4156
# File 'lib/tdlib/client_methods.rb', line 4153

def set_alarm(seconds:)
  broadcast('@type'   => 'setAlarm',
            'seconds' => seconds)
end

#set_authentication_phone_number(phone_number:, settings:) ⇒ TD::Types::Ok

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,
authorizationStateWaitRegistration, or authorizationStateWaitPassword.

Parameters:

Returns:



4167
4168
4169
4170
4171
# File 'lib/tdlib/client_methods.rb', line 4167

def set_authentication_phone_number(phone_number:, settings:)
  broadcast('@type'        => 'setAuthenticationPhoneNumber',
            'phone_number' => phone_number,
            'settings'     => settings)
end

#set_auto_download_settings(settings:, type:) ⇒ TD::Types::Ok

Sets auto-download settings.

Parameters:

Returns:



4178
4179
4180
4181
4182
# File 'lib/tdlib/client_methods.rb', line 4178

def set_auto_download_settings(settings:, type:)
  broadcast('@type'    => 'setAutoDownloadSettings',
            'settings' => settings,
            'type'     => type)
end

#set_background(background:, type:, for_dark_theme:) ⇒ TD::Types::Background

Changes the background selected by the user; adds background to the list of installed backgrounds.

Parameters:

  • background (TD::Types::InputBackground)

    The input background to use, null for filled backgrounds.

  • type (TD::Types::BackgroundType)

    Background type; null for default background. The method will return error 404 if type is null.

  • for_dark_theme (Boolean)

    True, if the background is chosen for dark theme.

Returns:



4191
4192
4193
4194
4195
4196
# File 'lib/tdlib/client_methods.rb', line 4191

def set_background(background:, type:, for_dark_theme:)
  broadcast('@type'          => 'setBackground',
            'background'     => background,
            'type'           => type,
            'for_dark_theme' => for_dark_theme)
end

#set_bio(bio:) ⇒ TD::Types::Ok

Changes the bio of the current user.

Parameters:

  • bio (TD::Types::String)

    The new value of the user bio; 0-70 characters without line feeds.

Returns:



4202
4203
4204
4205
# File 'lib/tdlib/client_methods.rb', line 4202

def set_bio(bio:)
  broadcast('@type' => 'setBio',
            'bio'   => bio)
end

#set_bot_updates_status(pending_update_count:, error_message:) ⇒ TD::Types::Ok

Informs the server about the number of pending bot updates if they haven’t been processed for a long time; for bots

only.

Parameters:

  • pending_update_count (Integer)

    The number of pending updates.

  • error_message (TD::Types::String)

    The last error message.

Returns:



4213
4214
4215
4216
4217
# File 'lib/tdlib/client_methods.rb', line 4213

def set_bot_updates_status(pending_update_count:, error_message:)
  broadcast('@type'                => 'setBotUpdatesStatus',
            'pending_update_count' => pending_update_count,
            'error_message'        => error_message)
end

#set_chat_client_data(chat_id:, client_data:) ⇒ TD::Types::Ok

Changes application-specific data associated with a chat.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • client_data (TD::Types::String)

    New value of client_data.

Returns:



4224
4225
4226
4227
4228
# File 'lib/tdlib/client_methods.rb', line 4224

def set_chat_client_data(chat_id:, client_data:)
  broadcast('@type'       => 'setChatClientData',
            'chat_id'     => chat_id,
            'client_data' => client_data)
end

#set_chat_description(chat_id:, description:) ⇒ TD::Types::Ok

Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right.

Parameters:

  • chat_id (Integer)

    Identifier of the chat.

  • description (TD::Types::String)

    New chat description; 0-255 characters.

Returns:



4237
4238
4239
4240
4241
# File 'lib/tdlib/client_methods.rb', line 4237

def set_chat_description(chat_id:, description:)
  broadcast('@type'       => 'setChatDescription',
            'chat_id'     => chat_id,
            'description' => description)
end

#set_chat_discussion_group(chat_id:, discussion_chat_id:) ⇒ TD::Types::Ok

Changes the discussion group of a channel chat; requires can_change_info administrator right in the channel if it

is specified.

Parameters:

  • chat_id (Integer)

    Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup).

  • discussion_chat_id (Integer)

    Identifier of a new channel’s discussion group. Use 0 to remove the discussion group. Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats must be first upgraded to supergroup chats. If new chat members don’t have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that.

Returns:



4256
4257
4258
4259
4260
# File 'lib/tdlib/client_methods.rb', line 4256

def set_chat_discussion_group(chat_id:, discussion_chat_id:)
  broadcast('@type'              => 'setChatDiscussionGroup',
            'chat_id'            => chat_id,
            'discussion_chat_id' => discussion_chat_id)
end

#set_chat_draft_message(chat_id:, message_thread_id:, draft_message: nil) ⇒ TD::Types::Ok

Changes the draft message in a chat.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • message_thread_id (Integer)

    If not 0, a message thread identifier in which the draft was changed.

  • draft_message (TD::Types::DraftMessage, nil) (defaults to: nil)

    New draft message; may be null.

Returns:



4268
4269
4270
4271
4272
4273
# File 'lib/tdlib/client_methods.rb', line 4268

def set_chat_draft_message(chat_id:, message_thread_id:, draft_message: nil)
  broadcast('@type'             => 'setChatDraftMessage',
            'chat_id'           => chat_id,
            'message_thread_id' => message_thread_id,
            'draft_message'     => draft_message)
end

#set_chat_location(chat_id:, location:) ⇒ TD::Types::Ok

Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the

method is allowed to use.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • location (TD::Types::ChatLocation)

    New location for the chat; must be valid and not null.

Returns:



4282
4283
4284
4285
4286
# File 'lib/tdlib/client_methods.rb', line 4282

def set_chat_location(chat_id:, location:)
  broadcast('@type'    => 'setChatLocation',
            'chat_id'  => chat_id,
            'location' => location)
end

#set_chat_member_status(chat_id:, member_id:, status:) ⇒ TD::Types::Ok

Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for adding new members to the chat and transferring chat ownership;

instead, use addChatMember or transferChatOwnership.

Parameters:

Returns:



4297
4298
4299
4300
4301
4302
# File 'lib/tdlib/client_methods.rb', line 4297

def set_chat_member_status(chat_id:, member_id:, status:)
  broadcast('@type'     => 'setChatMemberStatus',
            'chat_id'   => chat_id,
            'member_id' => member_id,
            'status'    => status)
end

#set_chat_message_ttl_setting(chat_id:, ttl:) ⇒ TD::Types::Ok

Changes the message TTL setting (sets a new self-destruct timer) in a chat. Requires can_delete_messages administrator right in basic groups, supergroups and channels Message TTL setting of a

chat with the current user (Saved Messages) and the chat 777000 (Telegram) can't be changed.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • ttl (Integer)

    New TTL value, in seconds; must be one of 0, 86400, 604800 unless chat is secret.

Returns:



4311
4312
4313
4314
4315
# File 'lib/tdlib/client_methods.rb', line 4311

def set_chat_message_ttl_setting(chat_id:, ttl:)
  broadcast('@type'   => 'setChatMessageTtlSetting',
            'chat_id' => chat_id,
            'ttl'     => ttl)
end

#set_chat_notification_settings(chat_id:, notification_settings:) ⇒ TD::Types::Ok

Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can’t be changed.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • notification_settings (TD::Types::ChatNotificationSettings)

    New notification settings for the chat. If the chat is muted for more than 1 week, it is considered to be muted forever.

Returns:



4324
4325
4326
4327
4328
# File 'lib/tdlib/client_methods.rb', line 4324

def set_chat_notification_settings(chat_id:, notification_settings:)
  broadcast('@type'                 => 'setChatNotificationSettings',
            'chat_id'               => chat_id,
            'notification_settings' => notification_settings)
end

#set_chat_permissions(chat_id:, permissions:) ⇒ TD::Types::Ok

Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • permissions (TD::Types::ChatPermissions)

    New non-administrator members permissions in the chat.

Returns:



4337
4338
4339
4340
4341
# File 'lib/tdlib/client_methods.rb', line 4337

def set_chat_permissions(chat_id:, permissions:)
  broadcast('@type'       => 'setChatPermissions',
            'chat_id'     => chat_id,
            'permissions' => permissions)
end

#set_chat_photo(chat_id:, photo:) ⇒ TD::Types::Ok

Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • photo (TD::Types::InputChatPhoto)

    New chat photo. Pass null to delete the chat photo.

Returns:



4351
4352
4353
4354
4355
# File 'lib/tdlib/client_methods.rb', line 4351

def set_chat_photo(chat_id:, photo:)
  broadcast('@type'   => 'setChatPhoto',
            'chat_id' => chat_id,
            'photo'   => photo)
end

#set_chat_slow_mode_delay(chat_id:, slow_mode_delay:) ⇒ TD::Types::Ok

Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members rights.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • slow_mode_delay (Integer)

    New slow mode delay for the chat; must be one of 0, 10, 30, 60, 300, 900, 3600.

Returns:



4363
4364
4365
4366
4367
# File 'lib/tdlib/client_methods.rb', line 4363

def set_chat_slow_mode_delay(chat_id:, slow_mode_delay:)
  broadcast('@type'           => 'setChatSlowModeDelay',
            'chat_id'         => chat_id,
            'slow_mode_delay' => slow_mode_delay)
end

#set_chat_title(chat_id:, title:) ⇒ TD::Types::Ok

Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • title (TD::Types::String)

    New title of the chat; 1-128 characters.

Returns:



4376
4377
4378
4379
4380
# File 'lib/tdlib/client_methods.rb', line 4376

def set_chat_title(chat_id:, title:)
  broadcast('@type'   => 'setChatTitle',
            'chat_id' => chat_id,
            'title'   => title)
end

#set_commands(commands:) ⇒ TD::Types::Ok

Sets the list of commands supported by the bot; for bots only.

Parameters:

Returns:



4386
4387
4388
4389
# File 'lib/tdlib/client_methods.rb', line 4386

def set_commands(commands:)
  broadcast('@type'    => 'setCommands',
            'commands' => commands)
end

#set_custom_language_pack(info:, strings:) ⇒ TD::Types::Ok

Adds or changes a custom local language pack to the current localization target.

Parameters:

  • info (TD::Types::LanguagePackInfo)

    Information about the language pack. Language pack ID must start with ‘X’, consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization.

  • strings (Array<TD::Types::LanguagePackString>)

    Strings of the new language pack.

Returns:



4399
4400
4401
4402
4403
# File 'lib/tdlib/client_methods.rb', line 4399

def set_custom_language_pack(info:, strings:)
  broadcast('@type'   => 'setCustomLanguagePack',
            'info'    => info,
            'strings' => strings)
end

#set_custom_language_pack_string(language_pack_id:, new_string:) ⇒ TD::Types::Ok

Adds, edits or deletes a string in a custom local language pack. Can be called before authorization.

Parameters:

  • language_pack_id (TD::Types::String)

    Identifier of a previously added custom local language pack in the current localization target.

  • new_string (TD::Types::LanguagePackString)

    New language pack string.

Returns:



4412
4413
4414
4415
4416
# File 'lib/tdlib/client_methods.rb', line 4412

def set_custom_language_pack_string(language_pack_id:, new_string:)
  broadcast('@type'            => 'setCustomLanguagePackString',
            'language_pack_id' => language_pack_id,
            'new_string'       => new_string)
end

#set_database_encryption_key(new_encryption_key:) ⇒ TD::Types::Ok

Changes the database encryption key. Usually the encryption key is never changed and is stored in some OS keychain.

Parameters:

  • new_encryption_key (String)

    New encryption key.

Returns:



4423
4424
4425
4426
# File 'lib/tdlib/client_methods.rb', line 4423

def set_database_encryption_key(new_encryption_key:)
  broadcast('@type'              => 'setDatabaseEncryptionKey',
            'new_encryption_key' => new_encryption_key)
end

#set_file_generation_progress(generation_id:, expected_size:, local_prefix_size:) ⇒ TD::Types::Ok

Informs TDLib on a file generation progress.

Parameters:

  • generation_id (Integer)

    The identifier of the generation process.

  • expected_size (Integer)

    Expected size of the generated file, in bytes; 0 if unknown.

  • local_prefix_size (Integer)

    The number of bytes already generated.

Returns:



4434
4435
4436
4437
4438
4439
# File 'lib/tdlib/client_methods.rb', line 4434

def set_file_generation_progress(generation_id:, expected_size:, local_prefix_size:)
  broadcast('@type'             => 'setFileGenerationProgress',
            'generation_id'     => generation_id,
            'expected_size'     => expected_size,
            'local_prefix_size' => local_prefix_size)
end

#set_game_score(chat_id:, message_id:, edit_message:, user_id:, score:, force:) ⇒ TD::Types::Message

Updates the game score of the specified user in the game; for bots only.

Parameters:

  • chat_id (Integer)

    The chat to which the message with the game belongs.

  • message_id (Integer)

    Identifier of the message.

  • edit_message (Boolean)

    True, if the message should be edited.

  • user_id (Integer)

    User identifier.

  • score (Integer)

    The new score.

  • force (Boolean)

    Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table.

Returns:



4451
4452
4453
4454
4455
4456
4457
4458
4459
# File 'lib/tdlib/client_methods.rb', line 4451

def set_game_score(chat_id:, message_id:, edit_message:, user_id:, score:, force:)
  broadcast('@type'        => 'setGameScore',
            'chat_id'      => chat_id,
            'message_id'   => message_id,
            'edit_message' => edit_message,
            'user_id'      => user_id,
            'score'        => score,
            'force'        => force)
end

#set_group_call_participant_is_speaking(group_call_id:, source:, is_speaking:) ⇒ TD::Types::Ok

Informs TDLib that a participant of an active group call speaking state has changed.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • source (Integer)

    Group call participant’s synchronization source identifier, or 0 for the current user.

  • is_speaking (Boolean)

    True, if the user is speaking.

Returns:



4467
4468
4469
4470
4471
4472
# File 'lib/tdlib/client_methods.rb', line 4467

def set_group_call_participant_is_speaking(group_call_id:, source:, is_speaking:)
  broadcast('@type'         => 'setGroupCallParticipantIsSpeaking',
            'group_call_id' => group_call_id,
            'source'        => source,
            'is_speaking'   => is_speaking)
end

#set_group_call_participant_volume_level(group_call_id:, participant_id:, volume_level:) ⇒ TD::Types::Ok

Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant’s volume level will be changed for all users

with default volume level.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • participant_id (TD::Types::MessageSender)

    Participant identifier.

  • volume_level (Integer)

    New participant’s volume level; 1-20000 in hundreds of percents.

Returns:



4482
4483
4484
4485
4486
4487
# File 'lib/tdlib/client_methods.rb', line 4482

def set_group_call_participant_volume_level(group_call_id:, participant_id:, volume_level:)
  broadcast('@type'          => 'setGroupCallParticipantVolumeLevel',
            'group_call_id'  => group_call_id,
            'participant_id' => participant_id,
            'volume_level'   => volume_level)
end

#set_group_call_title(group_call_id:, title:) ⇒ TD::Types::Ok

Sets group call title. Requires groupCall.can_be_managed group call flag.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • title (TD::Types::String)

    New group call title; 1-64 characters.

Returns:



4495
4496
4497
4498
4499
# File 'lib/tdlib/client_methods.rb', line 4495

def set_group_call_title(group_call_id:, title:)
  broadcast('@type'         => 'setGroupCallTitle',
            'group_call_id' => group_call_id,
            'title'         => title)
end

#set_inline_game_score(inline_message_id:, edit_message:, user_id:, score:, force:) ⇒ TD::Types::Ok

Updates the game score of the specified user in a game; for bots only.

Parameters:

  • inline_message_id (TD::Types::String)

    Inline message identifier.

  • edit_message (Boolean)

    True, if the message should be edited.

  • user_id (Integer)

    User identifier.

  • score (Integer)

    The new score.

  • force (Boolean)

    Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table.

Returns:



4510
4511
4512
4513
4514
4515
4516
4517
# File 'lib/tdlib/client_methods.rb', line 4510

def set_inline_game_score(inline_message_id:, edit_message:, user_id:, score:, force:)
  broadcast('@type'             => 'setInlineGameScore',
            'inline_message_id' => inline_message_id,
            'edit_message'      => edit_message,
            'user_id'           => user_id,
            'score'             => score,
            'force'             => force)
end

#set_location(location:) ⇒ TD::Types::Ok

Changes the location of the current user. Needs to be called if GetOption(“is_location_visible”) is true and location changes for more than 1 kilometer.

Parameters:

Returns:



4524
4525
4526
4527
# File 'lib/tdlib/client_methods.rb', line 4524

def set_location(location:)
  broadcast('@type'    => 'setLocation',
            'location' => location)
end

#set_log_stream(log_stream:) ⇒ TD::Types::Ok

Sets new log stream for internal logging of TDLib. Can be called synchronously.

Parameters:

Returns:



4534
4535
4536
4537
# File 'lib/tdlib/client_methods.rb', line 4534

def set_log_stream(log_stream:)
  broadcast('@type'      => 'setLogStream',
            'log_stream' => log_stream)
end

#set_log_tag_verbosity_level(tag:, new_verbosity_level:) ⇒ TD::Types::Ok

Sets the verbosity level for a specified TDLib internal log tag. Can be called synchronously.

Parameters:

  • tag (TD::Types::String)

    Logging tag to change verbosity level.

  • new_verbosity_level (Integer)

    New verbosity level; 1-1024.

Returns:



4545
4546
4547
4548
4549
# File 'lib/tdlib/client_methods.rb', line 4545

def set_log_tag_verbosity_level(tag:, new_verbosity_level:)
  broadcast('@type'               => 'setLogTagVerbosityLevel',
            'tag'                 => tag,
            'new_verbosity_level' => new_verbosity_level)
end

#set_log_verbosity_level(new_verbosity_level:) ⇒ TD::Types::Ok

Sets the verbosity level of the internal logging of TDLib. Can be called synchronously.

Parameters:

  • new_verbosity_level (Integer)

    New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1023 can be used to enable even more logging.

Returns:



4559
4560
4561
4562
# File 'lib/tdlib/client_methods.rb', line 4559

def set_log_verbosity_level(new_verbosity_level:)
  broadcast('@type'               => 'setLogVerbosityLevel',
            'new_verbosity_level' => new_verbosity_level)
end

#set_name(first_name:, last_name:) ⇒ TD::Types::Ok

Changes the first and last name of the current user.

Parameters:

  • first_name (TD::Types::String)

    The new value of the first name for the user; 1-64 characters.

  • last_name (TD::Types::String)

    The new value of the optional last name for the user; 0-64 characters.

Returns:



4569
4570
4571
4572
4573
# File 'lib/tdlib/client_methods.rb', line 4569

def set_name(first_name:, last_name:)
  broadcast('@type'      => 'setName',
            'first_name' => first_name,
            'last_name'  => last_name)
end

#set_network_type(type:) ⇒ TD::Types::Ok

Sets the current network type. Can be called before authorization. Calling this method forces all network connections to reopen, mitigating the delay in switching between different

networks, so it should be called whenever the network is changed, even if the network type remains the same.

Network type is used to check whether the library can use the network at all and also for collecting detailed

network data usage statistics.

Parameters:

Returns:



4585
4586
4587
4588
# File 'lib/tdlib/client_methods.rb', line 4585

def set_network_type(type:)
  broadcast('@type' => 'setNetworkType',
            'type'  => type)
end

#set_option(name:, value:) ⇒ TD::Types::Ok

Sets the value of an option. (Check the list of available options on core.telegram.org/tdlib/options.) Only writable options can be set. Can be called before authorization.

Parameters:

  • name (TD::Types::String)

    The name of the option.

  • value (TD::Types::OptionValue)

    The new value of the option.

Returns:



4597
4598
4599
4600
4601
# File 'lib/tdlib/client_methods.rb', line 4597

def set_option(name:, value:)
  broadcast('@type' => 'setOption',
            'name'  => name,
            'value' => value)
end

#set_passport_element(element:, password:) ⇒ TD::Types::PassportElement

Adds an element to the user’s Telegram Passport. May return an error with a message “PHONE_VERIFICATION_NEEDED” or “EMAIL_VERIFICATION_NEEDED” if the chosen phone

number or the chosen email address must be verified first.

Parameters:

Returns:



4610
4611
4612
4613
4614
# File 'lib/tdlib/client_methods.rb', line 4610

def set_passport_element(element:, password:)
  broadcast('@type'    => 'setPassportElement',
            'element'  => element,
            'password' => password)
end

#set_passport_element_errors(user_id:, errors:) ⇒ TD::Types::Ok

Informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed.

Parameters:

Returns:



4622
4623
4624
4625
4626
# File 'lib/tdlib/client_methods.rb', line 4622

def set_passport_element_errors(user_id:, errors:)
  broadcast('@type'   => 'setPassportElementErrors',
            'user_id' => user_id,
            'errors'  => errors)
end

#set_password(old_password:, new_password: nil, new_hint: nil, set_recovery_email_address: false, new_recovery_email_address: nil) ⇒ TD::Types::PasswordState

Changes the password for 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.

Parameters:

  • old_password (TD::Types::String)

    Previous password of the user.

  • new_password (TD::Types::String, nil) (defaults to: nil)

    New password of the user; may be empty to remove the password.

  • new_hint (TD::Types::String, nil) (defaults to: nil)

    New password hint; may be empty.

  • set_recovery_email_address (Boolean) (defaults to: false)

    Pass true if the recovery email address should be changed.

  • new_recovery_email_address (TD::Types::String, nil) (defaults to: nil)

    New recovery email address; may be empty.

Returns:



4638
4639
4640
4641
4642
4643
4644
4645
4646
# File 'lib/tdlib/client_methods.rb', line 4638

def set_password(old_password:, new_password: nil, new_hint: nil, set_recovery_email_address: false,
                 new_recovery_email_address: nil)
  broadcast('@type'                      => 'setPassword',
            'old_password'               => old_password,
            'new_password'               => new_password,
            'new_hint'                   => new_hint,
            'set_recovery_email_address' => set_recovery_email_address,
            'new_recovery_email_address' => new_recovery_email_address)
end

#set_pinned_chats(chat_list:, chat_ids:) ⇒ TD::Types::Ok

Changes the order of pinned chats.

Parameters:

  • chat_list (TD::Types::ChatList)

    Chat list in which to change the order of pinned chats.

  • chat_ids (Array<Integer>)

    The new list of pinned chats.

Returns:



4653
4654
4655
4656
4657
# File 'lib/tdlib/client_methods.rb', line 4653

def set_pinned_chats(chat_list:, chat_ids:)
  broadcast('@type'     => 'setPinnedChats',
            'chat_list' => chat_list,
            'chat_ids'  => chat_ids)
end

#set_poll_answer(chat_id:, message_id:, option_ids:) ⇒ TD::Types::Ok

Changes the user answer to a poll. A poll in quiz mode can be answered only once.

Parameters:

  • chat_id (Integer)

    Identifier of the chat to which the poll belongs.

  • message_id (Integer)

    Identifier of the message containing the poll.

  • option_ids (Array<Integer>)

    0-based identifiers of answer options, chosen by the user. User can choose more than 1 answer option only is the poll allows multiple answers.

Returns:



4667
4668
4669
4670
4671
4672
# File 'lib/tdlib/client_methods.rb', line 4667

def set_poll_answer(chat_id:, message_id:, option_ids:)
  broadcast('@type'      => 'setPollAnswer',
            'chat_id'    => chat_id,
            'message_id' => message_id,
            'option_ids' => option_ids)
end

#set_profile_photo(photo:) ⇒ TD::Types::Ok

Changes a profile photo for the current user.

Parameters:

Returns:



4678
4679
4680
4681
# File 'lib/tdlib/client_methods.rb', line 4678

def set_profile_photo(photo:)
  broadcast('@type' => 'setProfilePhoto',
            'photo' => photo)
end

#set_recovery_email_address(password:, new_recovery_email_address:) ⇒ TD::Types::PasswordState

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.

Parameters:

  • password (TD::Types::String)

    Password of the current user.

  • new_recovery_email_address (TD::Types::String)

    New recovery email address.

Returns:



4692
4693
4694
4695
4696
# File 'lib/tdlib/client_methods.rb', line 4692

def set_recovery_email_address(password:, new_recovery_email_address:)
  broadcast('@type'                      => 'setRecoveryEmailAddress',
            'password'                   => password,
            'new_recovery_email_address' => new_recovery_email_address)
end

#set_scope_notification_settings(scope:, notification_settings:) ⇒ TD::Types::Ok

Changes notification settings for chats of a given type.

Parameters:

Returns:



4704
4705
4706
4707
4708
# File 'lib/tdlib/client_methods.rb', line 4704

def set_scope_notification_settings(scope:, notification_settings:)
  broadcast('@type'                 => 'setScopeNotificationSettings',
            'scope'                 => scope,
            'notification_settings' => notification_settings)
end

#set_sticker_position_in_set(sticker:, position:) ⇒ TD::Types::Ok

Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot.

Parameters:

  • sticker (TD::Types::InputFile)

    Sticker.

  • position (Integer)

    New position of the sticker in the set, zero-based.

Returns:



4716
4717
4718
4719
4720
# File 'lib/tdlib/client_methods.rb', line 4716

def set_sticker_position_in_set(sticker:, position:)
  broadcast('@type'    => 'setStickerPositionInSet',
            'sticker'  => sticker,
            'position' => position)
end

#set_sticker_set_thumbnail(user_id:, name:, thumbnail:) ⇒ TD::Types::StickerSet

Sets a sticker set thumbnail; for bots only. Returns the sticker set.

Parameters:

  • user_id (Integer)

    Sticker set owner.

  • name (TD::Types::String)

    Sticker set name.

  • thumbnail (TD::Types::InputFile)

    Thumbnail to set in PNG or TGS format. Animated thumbnail must be set for animated sticker sets and only for them. Pass a zero InputFileId to delete the thumbnail.

Returns:



4731
4732
4733
4734
4735
4736
# File 'lib/tdlib/client_methods.rb', line 4731

def set_sticker_set_thumbnail(user_id:, name:, thumbnail:)
  broadcast('@type'     => 'setStickerSetThumbnail',
            'user_id'   => user_id,
            'name'      => name,
            'thumbnail' => thumbnail)
end

#set_supergroup_sticker_set(supergroup_id:, sticker_set_id:) ⇒ TD::Types::Ok

Changes the sticker set of a supergroup; requires can_change_info administrator right.

Parameters:

  • supergroup_id (Integer)

    Identifier of the supergroup.

  • sticker_set_id (Integer)

    New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set.

Returns:



4744
4745
4746
4747
4748
# File 'lib/tdlib/client_methods.rb', line 4744

def set_supergroup_sticker_set(supergroup_id:, sticker_set_id:)
  broadcast('@type'          => 'setSupergroupStickerSet',
            'supergroup_id'  => supergroup_id,
            'sticker_set_id' => sticker_set_id)
end

#set_supergroup_username(supergroup_id:, username:) ⇒ TD::Types::Ok

Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel.

Parameters:

  • supergroup_id (Integer)

    Identifier of the supergroup or channel.

  • username (TD::Types::String)

    New value of the username. Use an empty string to remove the username.

Returns:



4756
4757
4758
4759
4760
# File 'lib/tdlib/client_methods.rb', line 4756

def set_supergroup_username(supergroup_id:, username:)
  broadcast('@type'         => 'setSupergroupUsername',
            'supergroup_id' => supergroup_id,
            'username'      => username)
end

#set_tdlib_parameters(parameters:) ⇒ TD::Types::Ok

Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters.

Parameters:

Returns:



4767
4768
4769
4770
# File 'lib/tdlib/client_methods.rb', line 4767

def set_tdlib_parameters(parameters:)
  broadcast('@type'      => 'setTdlibParameters',
            'parameters' => parameters)
end

#set_user_privacy_setting_rules(setting:, rules:) ⇒ TD::Types::Ok

Changes user privacy settings.

Parameters:

Returns:



4777
4778
4779
4780
4781
# File 'lib/tdlib/client_methods.rb', line 4777

def set_user_privacy_setting_rules(setting:, rules:)
  broadcast('@type'   => 'setUserPrivacySettingRules',
            'setting' => setting,
            'rules'   => rules)
end

#set_username(username:) ⇒ TD::Types::Ok

Changes the username of the current user.

Parameters:

  • username (TD::Types::String)

    The new value of the username. Use an empty string to remove the username.

Returns:



4788
4789
4790
4791
# File 'lib/tdlib/client_methods.rb', line 4788

def set_username(username:)
  broadcast('@type'    => 'setUsername',
            'username' => username)
end

#set_voice_chat_default_participant(chat_id:, default_participant_id:) ⇒ TD::Types::Ok

Changes default participant identifier, which can be used to join voice chats in a chat.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • default_participant_id (TD::Types::MessageSender)

    Default group call participant identifier to join the voice chats.

Returns:



4799
4800
4801
4802
4803
# File 'lib/tdlib/client_methods.rb', line 4799

def set_voice_chat_default_participant(chat_id:, default_participant_id:)
  broadcast('@type'                  => 'setVoiceChatDefaultParticipant',
            'chat_id'                => chat_id,
            'default_participant_id' => default_participant_id)
end

#share_phone_number(user_id:) ⇒ TD::Types::Ok

Shares the phone number of the current user with a mutual contact. Supposed to be called when the user clicks on chatActionBarSharePhoneNumber.

Parameters:

  • user_id (Integer)

    Identifier of the user with whom to share the phone number. The user must be a mutual contact.

Returns:



4811
4812
4813
4814
# File 'lib/tdlib/client_methods.rb', line 4811

def share_phone_number(user_id:)
  broadcast('@type'   => 'sharePhoneNumber',
            'user_id' => user_id)
end

#start_group_call_recording(group_call_id:, title:) ⇒ TD::Types::Ok

Starts recording of an active group call. Requires groupCall.can_be_managed group call flag.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • title (TD::Types::String)

    Group call recording title; 0-64 characters.

Returns:



4822
4823
4824
4825
4826
# File 'lib/tdlib/client_methods.rb', line 4822

def start_group_call_recording(group_call_id:, title:)
  broadcast('@type'         => 'startGroupCallRecording',
            'group_call_id' => group_call_id,
            'title'         => title)
end

#start_scheduled_group_call(group_call_id:) ⇒ TD::Types::Ok

Starts a scheduled group call.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

Returns:



4832
4833
4834
4835
# File 'lib/tdlib/client_methods.rb', line 4832

def start_scheduled_group_call(group_call_id:)
  broadcast('@type'         => 'startScheduledGroupCall',
            'group_call_id' => group_call_id)
end

#stop_poll(chat_id:, message_id:, reply_markup:) ⇒ TD::Types::Ok

Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set.

Parameters:

  • chat_id (Integer)

    Identifier of the chat to which the poll belongs.

  • message_id (Integer)

    Identifier of the message containing the poll.

  • reply_markup (TD::Types::ReplyMarkup)

    The new message reply markup; for bots only.

Returns:



4844
4845
4846
4847
4848
4849
# File 'lib/tdlib/client_methods.rb', line 4844

def stop_poll(chat_id:, message_id:, reply_markup:)
  broadcast('@type'        => 'stopPoll',
            'chat_id'      => chat_id,
            'message_id'   => message_id,
            'reply_markup' => reply_markup)
end

#synchronize_language_pack(language_pack_id:) ⇒ TD::Types::Ok

Fetches the latest versions of all strings from a language pack in the current localization target from the server. This method shouldn’t be called explicitly for the current used/base language packs. Can be called before authorization.

Parameters:

  • language_pack_id (TD::Types::String)

    Language pack identifier.

Returns:



4857
4858
4859
4860
# File 'lib/tdlib/client_methods.rb', line 4857

def synchronize_language_pack(language_pack_id:)
  broadcast('@type'            => 'synchronizeLanguagePack',
            'language_pack_id' => language_pack_id)
end

#terminate_all_other_sessionsTD::Types::Ok

Terminates all other sessions of the current user.

Returns:



4865
4866
4867
# File 'lib/tdlib/client_methods.rb', line 4865

def terminate_all_other_sessions
  broadcast('@type' => 'terminateAllOtherSessions')
end

#terminate_session(session_id:) ⇒ TD::Types::Ok

Terminates a session of the current user.

Parameters:

  • session_id (Integer)

    Session identifier.

Returns:



4873
4874
4875
4876
# File 'lib/tdlib/client_methods.rb', line 4873

def terminate_session(session_id:)
  broadcast('@type'      => 'terminateSession',
            'session_id' => session_id)
end

#toggle_chat_default_disable_notification(chat_id:, default_disable_notification:) ⇒ TD::Types::Ok

Changes the value of the default disable_notification parameter, used when a message is sent to a chat.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • default_disable_notification (Boolean)

    New value of default_disable_notification.

Returns:



4883
4884
4885
4886
4887
# File 'lib/tdlib/client_methods.rb', line 4883

def toggle_chat_default_disable_notification(chat_id:, default_disable_notification:)
  broadcast('@type'                        => 'toggleChatDefaultDisableNotification',
            'chat_id'                      => chat_id,
            'default_disable_notification' => default_disable_notification)
end

#toggle_chat_is_marked_as_unread(chat_id:, is_marked_as_unread:) ⇒ TD::Types::Ok

Changes the marked as unread state of a chat.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • is_marked_as_unread (Boolean)

    New value of is_marked_as_unread.

Returns:



4894
4895
4896
4897
4898
# File 'lib/tdlib/client_methods.rb', line 4894

def toggle_chat_is_marked_as_unread(chat_id:, is_marked_as_unread:)
  broadcast('@type'               => 'toggleChatIsMarkedAsUnread',
            'chat_id'             => chat_id,
            'is_marked_as_unread' => is_marked_as_unread)
end

#toggle_chat_is_pinned(chat_list:, chat_id:, is_pinned:) ⇒ TD::Types::Ok

Changes the pinned state of a chat. There can be up to GetOption(“pinned_chat_count_max”)/GetOption(“pinned_archived_chat_count_max”) pinned non-secret

chats and the same number of secret chats in the main/arhive chat list.

Parameters:

  • chat_list (TD::Types::ChatList)

    Chat list in which to change the pinned state of the chat.

  • chat_id (Integer)

    Chat identifier.

  • is_pinned (Boolean)

    True, if the chat is pinned.

Returns:



4908
4909
4910
4911
4912
4913
# File 'lib/tdlib/client_methods.rb', line 4908

def toggle_chat_is_pinned(chat_list:, chat_id:, is_pinned:)
  broadcast('@type'     => 'toggleChatIsPinned',
            'chat_list' => chat_list,
            'chat_id'   => chat_id,
            'is_pinned' => is_pinned)
end

#toggle_group_call_enabled_start_notification(group_call_id:, enabled_start_notification:) ⇒ TD::Types::Ok

Toggles whether the current user will receive a notification when the group call will start; scheduled group calls

only.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • enabled_start_notification (Boolean)

    New value of the enabled_start_notification setting.

Returns:



4921
4922
4923
4924
4925
# File 'lib/tdlib/client_methods.rb', line 4921

def toggle_group_call_enabled_start_notification(group_call_id:, enabled_start_notification:)
  broadcast('@type'                      => 'toggleGroupCallEnabledStartNotification',
            'group_call_id'              => group_call_id,
            'enabled_start_notification' => enabled_start_notification)
end

#toggle_group_call_mute_new_participants(group_call_id:, mute_new_participants:) ⇒ TD::Types::Ok

Toggles whether new participants of a group call can be unmuted only by administrators of the group call. Requires groupCall.can_change_mute_new_participants group call flag.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • mute_new_participants (Boolean)

    New value of the mute_new_participants setting.

Returns:



4933
4934
4935
4936
4937
# File 'lib/tdlib/client_methods.rb', line 4933

def toggle_group_call_mute_new_participants(group_call_id:, mute_new_participants:)
  broadcast('@type'                 => 'toggleGroupCallMuteNewParticipants',
            'group_call_id'         => group_call_id,
            'mute_new_participants' => mute_new_participants)
end

#toggle_group_call_participant_is_hand_raised(group_call_id:, participant_id:, is_hand_raised:) ⇒ TD::Types::Ok

Toggles whether a group call participant hand is rased.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • participant_id (TD::Types::MessageSender)

    Participant identifier.

  • is_hand_raised (Boolean)

    Pass true if the user’s hand should be raised. Only self hand can be raised. Requires groupCall.can_be_managed group call flag to lower other’s hand.

Returns:



4947
4948
4949
4950
4951
4952
# File 'lib/tdlib/client_methods.rb', line 4947

def toggle_group_call_participant_is_hand_raised(group_call_id:, participant_id:, is_hand_raised:)
  broadcast('@type'          => 'toggleGroupCallParticipantIsHandRaised',
            'group_call_id'  => group_call_id,
            'participant_id' => participant_id,
            'is_hand_raised' => is_hand_raised)
end

#toggle_group_call_participant_is_muted(group_call_id:, participant_id:, is_muted:) ⇒ TD::Types::Ok

Toggles whether a participant of an active group call is muted, unmuted, or allowed to unmute themself.

Parameters:

  • group_call_id (Integer)

    Group call identifier.

  • participant_id (TD::Types::MessageSender)

    Participant identifier.

  • is_muted (Boolean)

    Pass true if the user must be muted and false otherwise.

Returns:



4960
4961
4962
4963
4964
4965
# File 'lib/tdlib/client_methods.rb', line 4960

def toggle_group_call_participant_is_muted(group_call_id:, participant_id:, is_muted:)
  broadcast('@type'          => 'toggleGroupCallParticipantIsMuted',
            'group_call_id'  => group_call_id,
            'participant_id' => participant_id,
            'is_muted'       => is_muted)
end

#toggle_message_sender_is_blocked(sender:, is_blocked:) ⇒ TD::Types::Ok

Changes the block state of a message sender. Currently, only users and supergroup chats can be blocked.

Parameters:

Returns:



4973
4974
4975
4976
4977
# File 'lib/tdlib/client_methods.rb', line 4973

def toggle_message_sender_is_blocked(sender:, is_blocked:)
  broadcast('@type'      => 'toggleMessageSenderIsBlocked',
            'sender'     => sender,
            'is_blocked' => is_blocked)
end

#toggle_supergroup_is_all_history_available(supergroup_id:, is_all_history_available:) ⇒ TD::Types::Ok

Toggles whether the message history of a supergroup is available to new members; requires can_change_info

administrator right.

Parameters:

  • supergroup_id (Integer)

    The identifier of the supergroup.

  • is_all_history_available (Boolean)

    The new value of is_all_history_available.

Returns:



4985
4986
4987
4988
4989
# File 'lib/tdlib/client_methods.rb', line 4985

def toggle_supergroup_is_all_history_available(supergroup_id:, is_all_history_available:)
  broadcast('@type'                    => 'toggleSupergroupIsAllHistoryAvailable',
            'supergroup_id'            => supergroup_id,
            'is_all_history_available' => is_all_history_available)
end

#toggle_supergroup_is_broadcast_group(supergroup_id:) ⇒ TD::Types::Ok

Upgrades supergroup to a broadcast group; requires owner privileges in the supergroup.

Parameters:

  • supergroup_id (Integer)

    Identifier of the supergroup.

Returns:



4995
4996
4997
4998
# File 'lib/tdlib/client_methods.rb', line 4995

def toggle_supergroup_is_broadcast_group(supergroup_id:)
  broadcast('@type'         => 'toggleSupergroupIsBroadcastGroup',
            'supergroup_id' => supergroup_id)
end

#toggle_supergroup_sign_messages(supergroup_id:, sign_messages:) ⇒ TD::Types::Ok

Toggles sender signatures messages sent in a channel; requires can_change_info administrator right.

Parameters:

  • supergroup_id (Integer)

    Identifier of the channel.

  • sign_messages (Boolean)

    New value of sign_messages.

Returns:



5005
5006
5007
5008
5009
# File 'lib/tdlib/client_methods.rb', line 5005

def toggle_supergroup_sign_messages(supergroup_id:, sign_messages:)
  broadcast('@type'         => 'toggleSupergroupSignMessages',
            'supergroup_id' => supergroup_id,
            'sign_messages' => sign_messages)
end

#transfer_chat_ownership(chat_id:, user_id:, password:) ⇒ TD::Types::Ok

Changes the owner of a chat. The current user must be a current owner of the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats.

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • user_id (Integer)

    Identifier of the user to which transfer the ownership. The ownership can’t be transferred to a bot or to a deleted user.

  • password (TD::Types::String)

    The password of the current user.

Returns:



5021
5022
5023
5024
5025
5026
# File 'lib/tdlib/client_methods.rb', line 5021

def transfer_chat_ownership(chat_id:, user_id:, password:)
  broadcast('@type'    => 'transferChatOwnership',
            'chat_id'  => chat_id,
            'user_id'  => user_id,
            'password' => password)
end

#unpin_all_chat_messages(chat_id:) ⇒ TD::Types::Ok

Removes all pinned messages from a chat; requires can_pin_messages rights in the group or can_edit_messages rights

in the channel.

Parameters:

  • chat_id (Integer)

    Identifier of the chat.

Returns:



5033
5034
5035
5036
# File 'lib/tdlib/client_methods.rb', line 5033

def unpin_all_chat_messages(chat_id:)
  broadcast('@type'   => 'unpinAllChatMessages',
            'chat_id' => chat_id)
end

#unpin_chat_message(chat_id:, message_id:) ⇒ TD::Types::Ok

Removes a pinned message from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in

the channel.

Parameters:

  • chat_id (Integer)

    Identifier of the chat.

  • message_id (Integer)

    Identifier of the removed pinned message.

Returns:



5044
5045
5046
5047
5048
# File 'lib/tdlib/client_methods.rb', line 5044

def unpin_chat_message(chat_id:, message_id:)
  broadcast('@type'      => 'unpinChatMessage',
            'chat_id'    => chat_id,
            'message_id' => message_id)
end

#upgrade_basic_group_chat_to_supergroup_chat(chat_id:) ⇒ TD::Types::Chat

Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and

messageChatUpgradeFrom; requires creator privileges.

Deactivates the original basic group.

Parameters:

  • chat_id (Integer)

    Identifier of the chat to upgrade.

Returns:



5056
5057
5058
5059
# File 'lib/tdlib/client_methods.rb', line 5056

def upgrade_basic_group_chat_to_supergroup_chat(chat_id:)
  broadcast('@type'   => 'upgradeBasicGroupChatToSupergroupChat',
            'chat_id' => chat_id)
end

#upload_file(file:, file_type:, priority:) ⇒ TD::Types::File

Asynchronously uploads a file to the cloud without sending it in a message. updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message.

Parameters:

  • file (TD::Types::InputFile)

    File to upload.

  • file_type (TD::Types::FileType)

    File type.

  • priority (Integer)

    Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which uploadFile was called will be uploaded first.

Returns:



5072
5073
5074
5075
5076
5077
# File 'lib/tdlib/client_methods.rb', line 5072

def upload_file(file:, file_type:, priority:)
  broadcast('@type'     => 'uploadFile',
            'file'      => file,
            'file_type' => file_type,
            'priority'  => priority)
end

#upload_sticker_file(user_id:, png_sticker:) ⇒ TD::Types::File

Uploads a PNG image with a sticker; for bots only; returns the uploaded file.

Parameters:

  • user_id (Integer)

    Sticker file owner.

  • png_sticker (TD::Types::InputFile)

    PNG image with the sticker; must be up to 512 KB in size and fit in 512x512 square.

Returns:



5085
5086
5087
5088
5089
# File 'lib/tdlib/client_methods.rb', line 5085

def upload_sticker_file(user_id:, png_sticker:)
  broadcast('@type'       => 'uploadStickerFile',
            'user_id'     => user_id,
            'png_sticker' => png_sticker)
end

#validate_order_info(chat_id:, message_id:, order_info:, allow_save:) ⇒ TD::Types::ValidatedOrderInfo

Validates the order information provided by a user and returns the available shipping options for a flexible

invoice.

Parameters:

  • chat_id (Integer)

    Chat identifier of the Invoice message.

  • message_id (Integer)

    Message identifier.

  • order_info (TD::Types::OrderInfo)

    The order information, provided by the user.

  • allow_save (Boolean)

    True, if the order information can be saved.

Returns:



5099
5100
5101
5102
5103
5104
5105
# File 'lib/tdlib/client_methods.rb', line 5099

def validate_order_info(chat_id:, message_id:, order_info:, allow_save:)
  broadcast('@type'      => 'validateOrderInfo',
            'chat_id'    => chat_id,
            'message_id' => message_id,
            'order_info' => order_info,
            'allow_save' => allow_save)
end

#view_messages(chat_id:, message_thread_id:, message_ids:, force_read:) ⇒ TD::Types::Ok

Informs TDLib that messages are being viewed by the user. Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as

read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels).

Parameters:

  • chat_id (Integer)

    Chat identifier.

  • message_thread_id (Integer)

    If not 0, a message thread identifier in which the messages are being viewed.

  • message_ids (Array<Integer>)

    The identifiers of the messages being viewed.

  • force_read (Boolean)

    True, if messages in closed chats should be marked as read by the request.

Returns:



5116
5117
5118
5119
5120
5121
5122
# File 'lib/tdlib/client_methods.rb', line 5116

def view_messages(chat_id:, message_thread_id:, message_ids:, force_read:)
  broadcast('@type'             => 'viewMessages',
            'chat_id'           => chat_id,
            'message_thread_id' => message_thread_id,
            'message_ids'       => message_ids,
            'force_read'        => force_read)
end

Informs the server that some trending sticker sets have been viewed by the user.

Parameters:

  • sticker_set_ids (Array<Integer>)

    Identifiers of viewed trending sticker sets.

Returns:



5128
5129
5130
5131
# File 'lib/tdlib/client_methods.rb', line 5128

def view_trending_sticker_sets(sticker_set_ids:)
  broadcast('@type'           => 'viewTrendingStickerSets',
            'sticker_set_ids' => sticker_set_ids)
end

#write_generated_file_part(generation_id:, offset:, data:) ⇒ TD::Types::Ok

Writes a part of a generated file. This method is intended to be used only if the application has no direct access to TDLib’s file system, because it

is usually slower than a direct write to the destination file.

Parameters:

  • generation_id (Integer)

    The identifier of the generation process.

  • offset (Integer)

    The offset from which to write the data to the file.

  • data (String)

    The data to write.

Returns:



5141
5142
5143
5144
5145
5146
# File 'lib/tdlib/client_methods.rb', line 5141

def write_generated_file_part(generation_id:, offset:, data:)
  broadcast('@type'         => 'writeGeneratedFilePart',
            'generation_id' => generation_id,
            'offset'        => offset,
            'data'          => data)
end