pytglib.api.functions package

Submodules

pytglib.api.functions.accept_call module

class pytglib.api.functions.accept_call.AcceptCall(call_id, protocol, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Accepts an incoming call

Attributes:
ID (str): AcceptCall
Args:
call_id (int):
Call identifier
protocol (telegram.api.types.callProtocol):
The call protocols supported by the application
Returns:
Ok
Raises:
telegram.Error
ID = 'acceptCall'
static read(q: dict, *args) → pytglib.api.functions.accept_call.AcceptCall

pytglib.api.functions.accept_terms_of_service module

class pytglib.api.functions.accept_terms_of_service.AcceptTermsOfService(terms_of_service_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Accepts Telegram terms of services

Attributes:
ID (str): AcceptTermsOfService
Args:
terms_of_service_id (str):
Terms of service identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'acceptTermsOfService'
static read(q: dict, *args) → pytglib.api.functions.accept_terms_of_service.AcceptTermsOfService

pytglib.api.functions.add_chat_member module

class pytglib.api.functions.add_chat_member.AddChatMember(chat_id, user_id, forward_limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddChatMember
Args:
chat_id (int):
Chat identifier
user_id (int):
Identifier of the user
forward_limit (int):
The number of earlier messages from the chat to be forwarded to the new member; up to 100Ignored for supergroups and channels, or if the added user is a bot
Returns:
Ok
Raises:
telegram.Error
ID = 'addChatMember'
static read(q: dict, *args) → pytglib.api.functions.add_chat_member.AddChatMember

pytglib.api.functions.add_chat_members module

class pytglib.api.functions.add_chat_members.AddChatMembers(chat_id, user_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddChatMembers
Args:
chat_id (int):
Chat identifier
user_ids (List of int):
Identifiers of the users to be added to the chatThe maximum number of added users is 20 for supergroups and 100 for channels
Returns:
Ok
Raises:
telegram.Error
ID = 'addChatMembers'
static read(q: dict, *args) → pytglib.api.functions.add_chat_members.AddChatMembers

pytglib.api.functions.add_contact module

class pytglib.api.functions.add_contact.AddContact(contact, share_phone_number, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddContact
Args:
contact (telegram.api.types.contact):
The contact to add or edit; phone number may be empty and needs to be specified only if known, vCard is ignored
share_phone_number (bool):
Pass true to share the current user’s phone number with the new contactA corresponding rule to userPrivacySettingShowPhoneNumber will be added if neededUse the field userFullInfoneed_phone_number_privacy_exception to check whether the current user needs to be asked to share their phone number
Returns:
Ok
Raises:
telegram.Error
ID = 'addContact'
static read(q: dict, *args) → pytglib.api.functions.add_contact.AddContact

pytglib.api.functions.add_custom_server_language_pack module

class pytglib.api.functions.add_custom_server_language_pack.AddCustomServerLanguagePack(language_pack_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddCustomServerLanguagePack
Args:
language_pack_id (str):
Identifier of a language pack to be added; may be different from a name that is used in an “https://tme/setlanguage/” link
Returns:
Ok
Raises:
telegram.Error
ID = 'addCustomServerLanguagePack'
static read(q: dict, *args) → pytglib.api.functions.add_custom_server_language_pack.AddCustomServerLanguagePack

pytglib.api.functions.add_favorite_sticker module

class pytglib.api.functions.add_favorite_sticker.AddFavoriteSticker(sticker, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddFavoriteSticker
Args:
sticker (telegram.api.types.InputFile):
Sticker file to add
Returns:
Ok
Raises:
telegram.Error
ID = 'addFavoriteSticker'
static read(q: dict, *args) → pytglib.api.functions.add_favorite_sticker.AddFavoriteSticker

pytglib.api.functions.add_local_message module

class pytglib.api.functions.add_local_message.AddLocalMessage(chat_id, sender_id, reply_to_message_id, disable_notification, input_message_content, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddLocalMessage
Args:
chat_id (int):
Target chat
sender_id (telegram.api.types.MessageSender):
Identifier of the sender of the message
reply_to_message_id (int):
Identifier of the replied message; 0 if none
disable_notification (bool):
Pass true to disable notification for the message
input_message_content (telegram.api.types.InputMessageContent):
The content of the message to be added
Returns:
Message
Raises:
telegram.Error
ID = 'addLocalMessage'
static read(q: dict, *args) → pytglib.api.functions.add_local_message.AddLocalMessage

pytglib.api.functions.add_log_message module

class pytglib.api.functions.add_log_message.AddLogMessage(verbosity_level, text, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddLogMessage
Args:
verbosity_level (int):
The minimum verbosity level needed for the message to be logged; 0-1023
text (str):
Text of a message to log
Returns:
Ok
Raises:
telegram.Error
ID = 'addLogMessage'
static read(q: dict, *args) → pytglib.api.functions.add_log_message.AddLogMessage

pytglib.api.functions.add_network_statistics module

class pytglib.api.functions.add_network_statistics.AddNetworkStatistics(entry, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddNetworkStatistics
Args:
entry (telegram.api.types.NetworkStatisticsEntry):
The network statistics entry with the data to be added to statistics
Returns:
Ok
Raises:
telegram.Error
ID = 'addNetworkStatistics'
static read(q: dict, *args) → pytglib.api.functions.add_network_statistics.AddNetworkStatistics

pytglib.api.functions.add_proxy module

class pytglib.api.functions.add_proxy.AddProxy(server, port, enable, type, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddProxy
Args:
server (str):
Proxy server IP address
port (int):
Proxy server port
enable (bool):
Pass true to immediately enable the proxy
type (telegram.api.types.ProxyType):
Proxy type
Returns:
Proxy
Raises:
telegram.Error
ID = 'addProxy'
static read(q: dict, *args) → pytglib.api.functions.add_proxy.AddProxy

pytglib.api.functions.add_recent_sticker module

class pytglib.api.functions.add_recent_sticker.AddRecentSticker(is_attached, sticker, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddRecentSticker
Args:
is_attached (bool):
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 (telegram.api.types.InputFile):
Sticker file to add
Returns:
Stickers
Raises:
telegram.Error
ID = 'addRecentSticker'
static read(q: dict, *args) → pytglib.api.functions.add_recent_sticker.AddRecentSticker

pytglib.api.functions.add_recently_found_chat module

class pytglib.api.functions.add_recently_found_chat.AddRecentlyFoundChat(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddRecentlyFoundChat
Args:
chat_id (int):
Identifier of the chat to add
Returns:
Ok
Raises:
telegram.Error
ID = 'addRecentlyFoundChat'
static read(q: dict, *args) → pytglib.api.functions.add_recently_found_chat.AddRecentlyFoundChat

pytglib.api.functions.add_saved_animation module

class pytglib.api.functions.add_saved_animation.AddSavedAnimation(animation, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddSavedAnimation
Args:
animation (telegram.api.types.InputFile):
The animation file to be addedOnly animations known to the server (ie, successfully sent via a message) can be added to the list
Returns:
Ok
Raises:
telegram.Error
ID = 'addSavedAnimation'
static read(q: dict, *args) → pytglib.api.functions.add_saved_animation.AddSavedAnimation

pytglib.api.functions.add_sticker_to_set module

class pytglib.api.functions.add_sticker_to_set.AddStickerToSet(user_id, name, sticker, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AddStickerToSet
Args:
user_id (int):
Sticker set owner
name (str):
Sticker set name
sticker (telegram.api.types.inputSticker):
Sticker to add to the set
Returns:
StickerSet
Raises:
telegram.Error
ID = 'addStickerToSet'
static read(q: dict, *args) → pytglib.api.functions.add_sticker_to_set.AddStickerToSet

pytglib.api.functions.answer_callback_query module

class pytglib.api.functions.answer_callback_query.AnswerCallbackQuery(callback_query_id, text, show_alert, url, cache_time, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sets the result of a callback query; for bots only

Attributes:
ID (str): AnswerCallbackQuery
Args:
callback_query_id (int):
Identifier of the callback query
text (str):
Text of the answer
show_alert (bool):
Pass true to show an alert to the user instead of a toast notification
url (str):
URL to be opened
cache_time (int):
Time during which the result of the query can be cached, in seconds
Returns:
Ok
Raises:
telegram.Error
ID = 'answerCallbackQuery'
static read(q: dict, *args) → pytglib.api.functions.answer_callback_query.AnswerCallbackQuery

pytglib.api.functions.answer_custom_query module

class pytglib.api.functions.answer_custom_query.AnswerCustomQuery(custom_query_id, data, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Answers a custom query; for bots only

Attributes:
ID (str): AnswerCustomQuery
Args:
custom_query_id (int):
Identifier of a custom query
data (str):
JSON-serialized answer to the query
Returns:
Ok
Raises:
telegram.Error
ID = 'answerCustomQuery'
static read(q: dict, *args) → pytglib.api.functions.answer_custom_query.AnswerCustomQuery

pytglib.api.functions.answer_inline_query module

class pytglib.api.functions.answer_inline_query.AnswerInlineQuery(inline_query_id, is_personal, results, cache_time, next_offset, switch_pm_text, switch_pm_parameter, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sets the result of an inline query; for bots only

Attributes:
ID (str): AnswerInlineQuery
Args:
inline_query_id (int):
Identifier of the inline query
is_personal (bool):
Pass true if results may be cached and returned only for the user that sent the queryBy default, results may be returned to any user who sends the same query
results (List of telegram.api.types.InputInlineQueryResult):
The results of the query
cache_time (int):
Allowed time to cache the results of the query, in seconds
next_offset (str):
Offset for the next inline query; pass an empty string if there are no more results
switch_pm_text (str):
If non-empty, this text must 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 (str):
The parameter for the bot start message
Returns:
Ok
Raises:
telegram.Error
ID = 'answerInlineQuery'
static read(q: dict, *args) → pytglib.api.functions.answer_inline_query.AnswerInlineQuery

pytglib.api.functions.answer_pre_checkout_query module

class pytglib.api.functions.answer_pre_checkout_query.AnswerPreCheckoutQuery(pre_checkout_query_id, error_message, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): AnswerPreCheckoutQuery
Args:
pre_checkout_query_id (int):
Identifier of the pre-checkout query
error_message (str):
An error message, empty on success
Returns:
Ok
Raises:
telegram.Error
ID = 'answerPreCheckoutQuery'
static read(q: dict, *args) → pytglib.api.functions.answer_pre_checkout_query.AnswerPreCheckoutQuery

pytglib.api.functions.answer_shipping_query module

class pytglib.api.functions.answer_shipping_query.AnswerShippingQuery(shipping_query_id, shipping_options, error_message, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sets the result of a shipping query; for bots only

Attributes:
ID (str): AnswerShippingQuery
Args:
shipping_query_id (int):
Identifier of the shipping query
shipping_options (List of telegram.api.types.shippingOption):
Available shipping options
error_message (str):
An error message, empty on success
Returns:
Ok
Raises:
telegram.Error
ID = 'answerShippingQuery'
static read(q: dict, *args) → pytglib.api.functions.answer_shipping_query.AnswerShippingQuery

pytglib.api.functions.block_user module

pytglib.api.functions.can_transfer_ownership module

class pytglib.api.functions.can_transfer_ownership.CanTransferOwnership(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CanTransferOwnership

No parameters required.

Returns:
CanTransferOwnershipResult
Raises:
telegram.Error
ID = 'canTransferOwnership'
static read(q: dict, *args) → pytglib.api.functions.can_transfer_ownership.CanTransferOwnership

pytglib.api.functions.cancel_download_file module

class pytglib.api.functions.cancel_download_file.CancelDownloadFile(file_id, only_if_pending, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CancelDownloadFile
Args:
file_id (int):
Identifier of a file to stop downloading
only_if_pending (bool):
Pass true to stop downloading only if it hasn’t been started, ierequest hasn’t been sent to server
Returns:
Ok
Raises:
telegram.Error
ID = 'cancelDownloadFile'
static read(q: dict, *args) → pytglib.api.functions.cancel_download_file.CancelDownloadFile

pytglib.api.functions.cancel_upload_file module

class pytglib.api.functions.cancel_upload_file.CancelUploadFile(file_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CancelUploadFile
Args:
file_id (int):
Identifier of the file to stop uploading
Returns:
Ok
Raises:
telegram.Error
ID = 'cancelUploadFile'
static read(q: dict, *args) → pytglib.api.functions.cancel_upload_file.CancelUploadFile

pytglib.api.functions.change_imported_contacts module

class pytglib.api.functions.change_imported_contacts.ChangeImportedContacts(contacts, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): ChangeImportedContacts
Args:
contacts (List of telegram.api.types.contact):
The new list of contacts, contact’s vCard are ignored and are not imported
Returns:
ImportedContacts
Raises:
telegram.Error
ID = 'changeImportedContacts'
static read(q: dict, *args) → pytglib.api.functions.change_imported_contacts.ChangeImportedContacts

pytglib.api.functions.change_phone_number module

class pytglib.api.functions.change_phone_number.ChangePhoneNumber(phone_number, settings, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): ChangePhoneNumber
Args:
phone_number (str):
The new phone number of the user in international format
settings (telegram.api.types.phoneNumberAuthenticationSettings):
Settings for the authentication of the user’s phone number; pass null to use default settings
Returns:
AuthenticationCodeInfo
Raises:
telegram.Error
ID = 'changePhoneNumber'
static read(q: dict, *args) → pytglib.api.functions.change_phone_number.ChangePhoneNumber

pytglib.api.functions.change_sticker_set module

class pytglib.api.functions.change_sticker_set.ChangeStickerSet(set_id, is_installed, is_archived, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Installs/uninstalls or activates/archives a sticker set

Attributes:
ID (str): ChangeStickerSet
Args:
set_id (int):
Identifier of the sticker set
is_installed (bool):
The new value of is_installed
is_archived (bool):
The new value of is_archivedA sticker set can’t be installed and archived simultaneously
Returns:
Ok
Raises:
telegram.Error
ID = 'changeStickerSet'
static read(q: dict, *args) → pytglib.api.functions.change_sticker_set.ChangeStickerSet

pytglib.api.functions.check_authentication_bot_token module

class pytglib.api.functions.check_authentication_bot_token.CheckAuthenticationBotToken(token, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CheckAuthenticationBotToken
Args:
token (str):
The bot token
Returns:
Ok
Raises:
telegram.Error
ID = 'checkAuthenticationBotToken'
static read(q: dict, *args) → pytglib.api.functions.check_authentication_bot_token.CheckAuthenticationBotToken

pytglib.api.functions.check_authentication_code module

class pytglib.api.functions.check_authentication_code.CheckAuthenticationCode(code, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CheckAuthenticationCode
Args:
code (str):
Authentication code to check
Returns:
Ok
Raises:
telegram.Error
ID = 'checkAuthenticationCode'
static read(q: dict, *args) → pytglib.api.functions.check_authentication_code.CheckAuthenticationCode

pytglib.api.functions.check_authentication_password module

class pytglib.api.functions.check_authentication_password.CheckAuthenticationPassword(password, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CheckAuthenticationPassword
Args:
password (str):
The password to check
Returns:
Ok
Raises:
telegram.Error
ID = 'checkAuthenticationPassword'
static read(q: dict, *args) → pytglib.api.functions.check_authentication_password.CheckAuthenticationPassword

pytglib.api.functions.check_change_phone_number_code module

class pytglib.api.functions.check_change_phone_number_code.CheckChangePhoneNumberCode(code, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CheckChangePhoneNumberCode
Args:
code (str):
Authentication code to check
Returns:
Ok
Raises:
telegram.Error
ID = 'checkChangePhoneNumberCode'
static read(q: dict, *args) → pytglib.api.functions.check_change_phone_number_code.CheckChangePhoneNumberCode

pytglib.api.functions.check_chat_username module

class pytglib.api.functions.check_chat_username.CheckChatUsername(chat_id, username, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Checks whether a username can be set for a chat

Attributes:
ID (str): CheckChatUsername
Args:
chat_id (int):
Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if the chat is being created
username (str):
Username to be checked
Returns:
CheckChatUsernameResult
Raises:
telegram.Error
ID = 'checkChatUsername'
static read(q: dict, *args) → pytglib.api.functions.check_chat_username.CheckChatUsername

pytglib.api.functions.check_created_public_chats_limit module

class pytglib.api.functions.check_created_public_chats_limit.CheckCreatedPublicChatsLimit(type, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Checks whether the maximum number of owned public chats has been reached. Returns corresponding error if the limit was reached. The limit can be increased with Telegram Premium

Attributes:
ID (str): CheckCreatedPublicChatsLimit
Args:
type (telegram.api.types.PublicChatType):
Type of the public chats, for which to check the limit
Returns:
Ok
Raises:
telegram.Error
ID = 'checkCreatedPublicChatsLimit'
static read(q: dict, *args) → pytglib.api.functions.check_created_public_chats_limit.CheckCreatedPublicChatsLimit

pytglib.api.functions.check_database_encryption_key module

class pytglib.api.functions.check_database_encryption_key.CheckDatabaseEncryptionKey(encryption_key, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CheckDatabaseEncryptionKey
Args:
encryption_key (bytes):
Encryption key to check or set up
Returns:
Ok
Raises:
telegram.Error
ID = 'checkDatabaseEncryptionKey'
static read(q: dict, *args) → pytglib.api.functions.check_database_encryption_key.CheckDatabaseEncryptionKey

pytglib.api.functions.check_email_address_verification_code module

class pytglib.api.functions.check_email_address_verification_code.CheckEmailAddressVerificationCode(code, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Checks the email address verification code for Telegram Passport

Attributes:
ID (str): CheckEmailAddressVerificationCode
Args:
code (str):
Verification code to check
Returns:
Ok
Raises:
telegram.Error
ID = 'checkEmailAddressVerificationCode'
static read(q: dict, *args) → pytglib.api.functions.check_email_address_verification_code.CheckEmailAddressVerificationCode

pytglib.api.functions.check_phone_number_confirmation_code module

class pytglib.api.functions.check_phone_number_confirmation_code.CheckPhoneNumberConfirmationCode(code, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Checks phone number confirmation code

Attributes:
ID (str): CheckPhoneNumberConfirmationCode
Args:
code (str):
Confirmation code to check
Returns:
Ok
Raises:
telegram.Error
ID = 'checkPhoneNumberConfirmationCode'
static read(q: dict, *args) → pytglib.api.functions.check_phone_number_confirmation_code.CheckPhoneNumberConfirmationCode

pytglib.api.functions.check_phone_number_verification_code module

class pytglib.api.functions.check_phone_number_verification_code.CheckPhoneNumberVerificationCode(code, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Checks the phone number verification code for Telegram Passport

Attributes:
ID (str): CheckPhoneNumberVerificationCode
Args:
code (str):
Verification code to check
Returns:
Ok
Raises:
telegram.Error
ID = 'checkPhoneNumberVerificationCode'
static read(q: dict, *args) → pytglib.api.functions.check_phone_number_verification_code.CheckPhoneNumberVerificationCode

pytglib.api.functions.check_recovery_email_address_code module

class pytglib.api.functions.check_recovery_email_address_code.CheckRecoveryEmailAddressCode(code, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Checks the 2-step verification recovery email address verification code

Attributes:
ID (str): CheckRecoveryEmailAddressCode
Args:
code (str):
Verification code to check
Returns:
PasswordState
Raises:
telegram.Error
ID = 'checkRecoveryEmailAddressCode'
static read(q: dict, *args) → pytglib.api.functions.check_recovery_email_address_code.CheckRecoveryEmailAddressCode

pytglib.api.functions.clean_file_name module

class pytglib.api.functions.clean_file_name.CleanFileName(file_name, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CleanFileName
Args:
file_name (str):
File name or path to the file
Returns:
Text
Raises:
telegram.Error
ID = 'cleanFileName'
static read(q: dict, *args) → pytglib.api.functions.clean_file_name.CleanFileName

pytglib.api.functions.clear_all_draft_messages module

class pytglib.api.functions.clear_all_draft_messages.ClearAllDraftMessages(exclude_secret_chats, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Clears message drafts in all chats

Attributes:
ID (str): ClearAllDraftMessages
Args:
exclude_secret_chats (bool):
Pass true to keep local message drafts in secret chats
Returns:
Ok
Raises:
telegram.Error
ID = 'clearAllDraftMessages'
static read(q: dict, *args) → pytglib.api.functions.clear_all_draft_messages.ClearAllDraftMessages

pytglib.api.functions.clear_imported_contacts module

class pytglib.api.functions.clear_imported_contacts.ClearImportedContacts(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Clears all imported contacts, contact list remains unchanged

Attributes:
ID (str): ClearImportedContacts

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'clearImportedContacts'
static read(q: dict, *args) → pytglib.api.functions.clear_imported_contacts.ClearImportedContacts

pytglib.api.functions.clear_recent_stickers module

class pytglib.api.functions.clear_recent_stickers.ClearRecentStickers(is_attached, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Clears the list of recently used stickers

Attributes:
ID (str): ClearRecentStickers
Args:
is_attached (bool):
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:
Ok
Raises:
telegram.Error
ID = 'clearRecentStickers'
static read(q: dict, *args) → pytglib.api.functions.clear_recent_stickers.ClearRecentStickers

pytglib.api.functions.clear_recently_found_chats module

class pytglib.api.functions.clear_recently_found_chats.ClearRecentlyFoundChats(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Clears the list of recently found chats

Attributes:
ID (str): ClearRecentlyFoundChats

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'clearRecentlyFoundChats'
static read(q: dict, *args) → pytglib.api.functions.clear_recently_found_chats.ClearRecentlyFoundChats

pytglib.api.functions.close module

class pytglib.api.functions.close.Close(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): Close

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'close'
static read(q: dict, *args) → pytglib.api.functions.close.Close

pytglib.api.functions.close_chat module

class pytglib.api.functions.close_chat.CloseChat(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CloseChat
Args:
chat_id (int):
Chat identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'closeChat'
static read(q: dict, *args) → pytglib.api.functions.close_chat.CloseChat

pytglib.api.functions.close_secret_chat module

class pytglib.api.functions.close_secret_chat.CloseSecretChat(secret_chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Closes a secret chat, effectively transferring its state to secretChatStateClosed

Attributes:
ID (str): CloseSecretChat
Args:
secret_chat_id (int):
Secret chat identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'closeSecretChat'
static read(q: dict, *args) → pytglib.api.functions.close_secret_chat.CloseSecretChat

pytglib.api.functions.confirm_qr_code_authentication module

class pytglib.api.functions.confirm_qr_code_authentication.ConfirmQrCodeAuthentication(link, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): ConfirmQrCodeAuthentication
Args:
link (str):
A link from a QR codeThe link must be scanned by the in-app camera
Returns:
Session
Raises:
telegram.Error
ID = 'confirmQrCodeAuthentication'
static read(q: dict, *args) → pytglib.api.functions.confirm_qr_code_authentication.ConfirmQrCodeAuthentication

pytglib.api.functions.create_basic_group_chat module

class pytglib.api.functions.create_basic_group_chat.CreateBasicGroupChat(basic_group_id, force, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns an existing chat corresponding to a known basic group

Attributes:
ID (str): CreateBasicGroupChat
Args:
basic_group_id (int):
Basic group identifier
force (bool):
Pass true to create the chat without a network requestIn this case all information about the chat except its type, title and photo can be incorrect
Returns:
Chat
Raises:
telegram.Error
ID = 'createBasicGroupChat'
static read(q: dict, *args) → pytglib.api.functions.create_basic_group_chat.CreateBasicGroupChat

pytglib.api.functions.create_call module

class pytglib.api.functions.create_call.CreateCall(user_id, protocol, is_video, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Creates a new call

Attributes:
ID (str): CreateCall
Args:
user_id (int):
Identifier of the user to be called
protocol (telegram.api.types.callProtocol):
The call protocols supported by the application
is_video (bool):
Pass true to create a video call
Returns:
CallId
Raises:
telegram.Error
ID = 'createCall'
static read(q: dict, *args) → pytglib.api.functions.create_call.CreateCall

pytglib.api.functions.create_new_basic_group_chat module

class pytglib.api.functions.create_new_basic_group_chat.CreateNewBasicGroupChat(user_ids, title, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CreateNewBasicGroupChat
Args:
user_ids (List of int):
Identifiers of users to be added to the basic group
title (str):
Title of the new basic group; 1-128 characters
Returns:
Chat
Raises:
telegram.Error
ID = 'createNewBasicGroupChat'
static read(q: dict, *args) → pytglib.api.functions.create_new_basic_group_chat.CreateNewBasicGroupChat

pytglib.api.functions.create_new_secret_chat module

class pytglib.api.functions.create_new_secret_chat.CreateNewSecretChat(user_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Creates a new secret chat. Returns the newly created chat

Attributes:
ID (str): CreateNewSecretChat
Args:
user_id (int):
Identifier of the target user
Returns:
Chat
Raises:
telegram.Error
ID = 'createNewSecretChat'
static read(q: dict, *args) → pytglib.api.functions.create_new_secret_chat.CreateNewSecretChat

pytglib.api.functions.create_new_sticker_set module

class pytglib.api.functions.create_new_sticker_set.CreateNewStickerSet(user_id, title, name, stickers, source, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Creates a new sticker set. Returns the newly created sticker set

Attributes:
ID (str): CreateNewStickerSet
Args:
user_id (int):
Sticker set owner; ignored for regular users
title (str):
Sticker set title; 1-64 characters
name (str):
Sticker set nameCan contain only English letters, digits and underscoresMust end with “_by_<bot username>” (<bot_username> is case insensitive) for bots; 1-64 characters
stickers (List of telegram.api.types.inputSticker):
List of stickers to be added to the set; must be non-emptyAll stickers must have the same formatFor TGS stickers, uploadStickerFile must be used before the sticker is shown
source (str):
Source of the sticker set; may be empty if unknown
Returns:
StickerSet
Raises:
telegram.Error
ID = 'createNewStickerSet'
static read(q: dict, *args) → pytglib.api.functions.create_new_sticker_set.CreateNewStickerSet

pytglib.api.functions.create_new_supergroup_chat module

class pytglib.api.functions.create_new_supergroup_chat.CreateNewSupergroupChat(title, is_channel, description, location, for_import, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): CreateNewSupergroupChat
Args:
title (str):
Title of the new chat; 1-128 characters
is_channel (bool):
Pass true to create a channel chat
description (str):
Chat description; 0-255 characters
location (telegram.api.types.chatLocation):
Chat location if a location-based supergroup is being created; pass null to create an ordinary supergroup chat
for_import (bool):
Pass true to create a supergroup for importing messages using importMessage
Returns:
Chat
Raises:
telegram.Error
ID = 'createNewSupergroupChat'
static read(q: dict, *args) → pytglib.api.functions.create_new_supergroup_chat.CreateNewSupergroupChat

pytglib.api.functions.create_private_chat module

class pytglib.api.functions.create_private_chat.CreatePrivateChat(user_id, force, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns an existing chat corresponding to a given user

Attributes:
ID (str): CreatePrivateChat
Args:
user_id (int):
User identifier
force (bool):
Pass true to create the chat without a network requestIn this case all information about the chat except its type, title and photo can be incorrect
Returns:
Chat
Raises:
telegram.Error
ID = 'createPrivateChat'
static read(q: dict, *args) → pytglib.api.functions.create_private_chat.CreatePrivateChat

pytglib.api.functions.create_secret_chat module

class pytglib.api.functions.create_secret_chat.CreateSecretChat(secret_chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns an existing chat corresponding to a known secret chat

Attributes:
ID (str): CreateSecretChat
Args:
secret_chat_id (int):
Secret chat identifier
Returns:
Chat
Raises:
telegram.Error
ID = 'createSecretChat'
static read(q: dict, *args) → pytglib.api.functions.create_secret_chat.CreateSecretChat

pytglib.api.functions.create_supergroup_chat module

class pytglib.api.functions.create_supergroup_chat.CreateSupergroupChat(supergroup_id, force, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns an existing chat corresponding to a known supergroup or channel

Attributes:
ID (str): CreateSupergroupChat
Args:
supergroup_id (int):
Supergroup or channel identifier
force (bool):
Pass true to create the chat without a network requestIn this case all information about the chat except its type, title and photo can be incorrect
Returns:
Chat
Raises:
telegram.Error
ID = 'createSupergroupChat'
static read(q: dict, *args) → pytglib.api.functions.create_supergroup_chat.CreateSupergroupChat

pytglib.api.functions.create_temporary_password module

class pytglib.api.functions.create_temporary_password.CreateTemporaryPassword(password, valid_for, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Creates a new temporary password for processing payments

Attributes:
ID (str): CreateTemporaryPassword
Args:
password (str):
Persistent user password
valid_for (int):
Time during which the temporary password will be valid, in seconds; must be between 60 and 86400
Returns:
TemporaryPasswordState
Raises:
telegram.Error
ID = 'createTemporaryPassword'
static read(q: dict, *args) → pytglib.api.functions.create_temporary_password.CreateTemporaryPassword

pytglib.api.functions.delete_account module

class pytglib.api.functions.delete_account.DeleteAccount(reason, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): DeleteAccount
Args:
reason (str):
The reason why the account was deleted; optional
Returns:
Ok
Raises:
telegram.Error
ID = 'deleteAccount'
static read(q: dict, *args) → pytglib.api.functions.delete_account.DeleteAccount

pytglib.api.functions.delete_chat_history module

class pytglib.api.functions.delete_chat_history.DeleteChatHistory(chat_id, remove_from_chat_list, revoke, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): DeleteChatHistory
Args:
chat_id (int):
Chat identifier
remove_from_chat_list (bool):
Pass true to remove the chat from all chat lists
revoke (bool):
Pass true to delete chat history for all users
Returns:
Ok
Raises:
telegram.Error
ID = 'deleteChatHistory'
static read(q: dict, *args) → pytglib.api.functions.delete_chat_history.DeleteChatHistory

pytglib.api.functions.delete_chat_messages_from_user module

pytglib.api.functions.delete_chat_reply_markup module

class pytglib.api.functions.delete_chat_reply_markup.DeleteChatReplyMarkup(chat_id, message_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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 is changed

Attributes:
ID (str): DeleteChatReplyMarkup
Args:
chat_id (int):
Chat identifier
message_id (int):
The message identifier of the used keyboard
Returns:
Ok
Raises:
telegram.Error
ID = 'deleteChatReplyMarkup'
static read(q: dict, *args) → pytglib.api.functions.delete_chat_reply_markup.DeleteChatReplyMarkup

pytglib.api.functions.delete_file module

class pytglib.api.functions.delete_file.DeleteFile(file_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Deletes a file from the TDLib file cache

Attributes:
ID (str): DeleteFile
Args:
file_id (int):
Identifier of the file to delete
Returns:
Ok
Raises:
telegram.Error
ID = 'deleteFile'
static read(q: dict, *args) → pytglib.api.functions.delete_file.DeleteFile

pytglib.api.functions.delete_language_pack module

class pytglib.api.functions.delete_language_pack.DeleteLanguagePack(language_pack_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): DeleteLanguagePack
Args:
language_pack_id (str):
Identifier of the language pack to delete
Returns:
Ok
Raises:
telegram.Error
ID = 'deleteLanguagePack'
static read(q: dict, *args) → pytglib.api.functions.delete_language_pack.DeleteLanguagePack

pytglib.api.functions.delete_messages module

class pytglib.api.functions.delete_messages.DeleteMessages(chat_id, message_ids, revoke, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Deletes messages

Attributes:
ID (str): DeleteMessages
Args:
chat_id (int):
Chat identifier
message_ids (List of int):
Identifiers of the messages to be deleted
revoke (bool):
Pass true to delete messages for all chat membersAlways true for supergroups, channels and secret chats
Returns:
Ok
Raises:
telegram.Error
ID = 'deleteMessages'
static read(q: dict, *args) → pytglib.api.functions.delete_messages.DeleteMessages

pytglib.api.functions.delete_passport_element module

class pytglib.api.functions.delete_passport_element.DeletePassportElement(type, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Deletes a Telegram Passport element

Attributes:
ID (str): DeletePassportElement
Args:
type (telegram.api.types.PassportElementType):
Element type
Returns:
Ok
Raises:
telegram.Error
ID = 'deletePassportElement'
static read(q: dict, *args) → pytglib.api.functions.delete_passport_element.DeletePassportElement

pytglib.api.functions.delete_profile_photo module

class pytglib.api.functions.delete_profile_photo.DeleteProfilePhoto(profile_photo_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Deletes a profile photo

Attributes:
ID (str): DeleteProfilePhoto
Args:
profile_photo_id (int):
Identifier of the profile photo to delete
Returns:
Ok
Raises:
telegram.Error
ID = 'deleteProfilePhoto'
static read(q: dict, *args) → pytglib.api.functions.delete_profile_photo.DeleteProfilePhoto

pytglib.api.functions.delete_saved_credentials module

class pytglib.api.functions.delete_saved_credentials.DeleteSavedCredentials(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Deletes saved credentials for all payment provider bots

Attributes:
ID (str): DeleteSavedCredentials

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'deleteSavedCredentials'
static read(q: dict, *args) → pytglib.api.functions.delete_saved_credentials.DeleteSavedCredentials

pytglib.api.functions.delete_saved_order_info module

class pytglib.api.functions.delete_saved_order_info.DeleteSavedOrderInfo(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Deletes saved order information

Attributes:
ID (str): DeleteSavedOrderInfo

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'deleteSavedOrderInfo'
static read(q: dict, *args) → pytglib.api.functions.delete_saved_order_info.DeleteSavedOrderInfo

pytglib.api.functions.delete_supergroup module

pytglib.api.functions.destroy module

class pytglib.api.functions.destroy.Destroy(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): Destroy

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'destroy'
static read(q: dict, *args) → pytglib.api.functions.destroy.Destroy

pytglib.api.functions.disable_proxy module

class pytglib.api.functions.disable_proxy.DisableProxy(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Disables the currently enabled proxy. Can be called before authorization

Attributes:
ID (str): DisableProxy

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'disableProxy'
static read(q: dict, *args) → pytglib.api.functions.disable_proxy.DisableProxy

pytglib.api.functions.discard_call module

class pytglib.api.functions.discard_call.DiscardCall(call_id, is_disconnected, duration, is_video, connection_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Discards a call

Attributes:
ID (str): DiscardCall
Args:
call_id (int):
Call identifier
is_disconnected (bool):
Pass true if the user was disconnected
duration (int):
The call duration, in seconds
is_video (bool):
Pass true if the call was a video call
connection_id (int):
Identifier of the connection used during the call
Returns:
Ok
Raises:
telegram.Error
ID = 'discardCall'
static read(q: dict, *args) → pytglib.api.functions.discard_call.DiscardCall

pytglib.api.functions.disconnect_all_websites module

class pytglib.api.functions.disconnect_all_websites.DisconnectAllWebsites(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Disconnects all websites from the current user’s Telegram account

Attributes:
ID (str): DisconnectAllWebsites

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'disconnectAllWebsites'
static read(q: dict, *args) → pytglib.api.functions.disconnect_all_websites.DisconnectAllWebsites

pytglib.api.functions.disconnect_website module

class pytglib.api.functions.disconnect_website.DisconnectWebsite(website_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Disconnects website from the current user’s Telegram account

Attributes:
ID (str): DisconnectWebsite
Args:
website_id (int):
Website identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'disconnectWebsite'
static read(q: dict, *args) → pytglib.api.functions.disconnect_website.DisconnectWebsite

pytglib.api.functions.download_file module

class pytglib.api.functions.download_file.DownloadFile(file_id, priority, offset, limit, synchronous, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): DownloadFile
Args:
file_id (int):
Identifier of the file to download
priority (int):
Priority of the download (1-32)The higher the priority, the earlier the file will be downloadedIf the priorities of two files are equal, then the last one for which downloadFile/addFileToDownloads was called will be downloaded first
offset (int):
The starting position from which the file needs to be downloaded
limit (int):
Number of bytes which need to be downloaded starting from the “offset” position before the download will automatically be canceled; use 0 to download without a limit
synchronous (bool):
Pass true to return response only after the file download has succeeded, has failed, has been canceled, or a new downloadFile request with different offset/limit parameters was sent; pass false to return file state immediately, just after the download has been started
Returns:
File
Raises:
telegram.Error
ID = 'downloadFile'
static read(q: dict, *args) → pytglib.api.functions.download_file.DownloadFile

pytglib.api.functions.edit_custom_language_pack_info module

class pytglib.api.functions.edit_custom_language_pack_info.EditCustomLanguagePackInfo(info, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditCustomLanguagePackInfo
Args:
info (telegram.api.types.languagePackInfo):
New information about the custom local language pack
Returns:
Ok
Raises:
telegram.Error
ID = 'editCustomLanguagePackInfo'
static read(q: dict, *args) → pytglib.api.functions.edit_custom_language_pack_info.EditCustomLanguagePackInfo

pytglib.api.functions.edit_inline_message_caption module

class pytglib.api.functions.edit_inline_message_caption.EditInlineMessageCaption(inline_message_id, reply_markup, caption, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditInlineMessageCaption
Args:
inline_message_id (str):
Inline message identifier
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none
caption (telegram.api.types.formattedText):
New message content caption; pass null to remove caption; 0-GetOption(“message_caption_length_max”) characters
Returns:
Ok
Raises:
telegram.Error
ID = 'editInlineMessageCaption'
static read(q: dict, *args) → pytglib.api.functions.edit_inline_message_caption.EditInlineMessageCaption

pytglib.api.functions.edit_inline_message_live_location module

class pytglib.api.functions.edit_inline_message_live_location.EditInlineMessageLiveLocation(inline_message_id, reply_markup, location, heading, proximity_alert_radius, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditInlineMessageLiveLocation
Args:
inline_message_id (str):
Inline message identifier
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none
location (telegram.api.types.location):
New location content of the message; pass null to stop sharing the live location
heading (int):
The new direction in which the location moves, in degrees; 1-360Pass 0 if unknown
proximity_alert_radius (int):
The new maximum distance for proximity alerts, in meters (0-100000)Pass 0 if the notification is disabled
Returns:
Ok
Raises:
telegram.Error
ID = 'editInlineMessageLiveLocation'
static read(q: dict, *args) → pytglib.api.functions.edit_inline_message_live_location.EditInlineMessageLiveLocation

pytglib.api.functions.edit_inline_message_media module

class pytglib.api.functions.edit_inline_message_media.EditInlineMessageMedia(inline_message_id, reply_markup, input_message_content, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditInlineMessageMedia
Args:
inline_message_id (str):
Inline message identifier
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none; for bots only
input_message_content (telegram.api.types.InputMessageContent):
New content of the messageMust be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo
Returns:
Ok
Raises:
telegram.Error
ID = 'editInlineMessageMedia'
static read(q: dict, *args) → pytglib.api.functions.edit_inline_message_media.EditInlineMessageMedia

pytglib.api.functions.edit_inline_message_reply_markup module

class pytglib.api.functions.edit_inline_message_reply_markup.EditInlineMessageReplyMarkup(inline_message_id, reply_markup, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditInlineMessageReplyMarkup
Args:
inline_message_id (str):
Inline message identifier
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none
Returns:
Ok
Raises:
telegram.Error
ID = 'editInlineMessageReplyMarkup'
static read(q: dict, *args) → pytglib.api.functions.edit_inline_message_reply_markup.EditInlineMessageReplyMarkup

pytglib.api.functions.edit_inline_message_text module

class pytglib.api.functions.edit_inline_message_text.EditInlineMessageText(inline_message_id, reply_markup, input_message_content, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditInlineMessageText
Args:
inline_message_id (str):
Inline message identifier
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none
input_message_content (telegram.api.types.InputMessageContent):
New text content of the messageMust be of type inputMessageText
Returns:
Ok
Raises:
telegram.Error
ID = 'editInlineMessageText'
static read(q: dict, *args) → pytglib.api.functions.edit_inline_message_text.EditInlineMessageText

pytglib.api.functions.edit_message_caption module

class pytglib.api.functions.edit_message_caption.EditMessageCaption(chat_id, message_id, reply_markup, caption, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditMessageCaption
Args:
chat_id (int):
The chat the message belongs to
message_id (int):
Identifier of the message
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none; for bots only
caption (telegram.api.types.formattedText):
New message content caption; 0-GetOption(“message_caption_length_max”) characters; pass null to remove caption
Returns:
Message
Raises:
telegram.Error
ID = 'editMessageCaption'
static read(q: dict, *args) → pytglib.api.functions.edit_message_caption.EditMessageCaption

pytglib.api.functions.edit_message_live_location module

class pytglib.api.functions.edit_message_live_location.EditMessageLiveLocation(chat_id, message_id, reply_markup, location, heading, proximity_alert_radius, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditMessageLiveLocation
Args:
chat_id (int):
The chat the message belongs to
message_id (int):
Identifier of the message
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none; for bots only
location (telegram.api.types.location):
New location content of the message; pass null to stop sharing the live location
heading (int):
The new direction in which the location moves, in degrees; 1-360Pass 0 if unknown
proximity_alert_radius (int):
The new maximum distance for proximity alerts, in meters (0-100000)Pass 0 if the notification is disabled
Returns:
Message
Raises:
telegram.Error
ID = 'editMessageLiveLocation'
static read(q: dict, *args) → pytglib.api.functions.edit_message_live_location.EditMessageLiveLocation

pytglib.api.functions.edit_message_media module

class pytglib.api.functions.edit_message_media.EditMessageMedia(chat_id, message_id, reply_markup, input_message_content, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead.The media can’t be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can’t be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side

Attributes:
ID (str): EditMessageMedia
Args:
chat_id (int):
The chat the message belongs to
message_id (int):
Identifier of the message
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none; for bots only
input_message_content (telegram.api.types.InputMessageContent):
New content of the messageMust be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo
Returns:
Message
Raises:
telegram.Error
ID = 'editMessageMedia'
static read(q: dict, *args) → pytglib.api.functions.edit_message_media.EditMessageMedia

pytglib.api.functions.edit_message_reply_markup module

class pytglib.api.functions.edit_message_reply_markup.EditMessageReplyMarkup(chat_id, message_id, reply_markup, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditMessageReplyMarkup
Args:
chat_id (int):
The chat the message belongs to
message_id (int):
Identifier of the message
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none
Returns:
Message
Raises:
telegram.Error
ID = 'editMessageReplyMarkup'
static read(q: dict, *args) → pytglib.api.functions.edit_message_reply_markup.EditMessageReplyMarkup

pytglib.api.functions.edit_message_scheduling_state module

class pytglib.api.functions.edit_message_scheduling_state.EditMessageSchedulingState(chat_id, message_id, scheduling_state, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditMessageSchedulingState
Args:
chat_id (int):
The chat the message belongs to
message_id (int):
Identifier of the message
scheduling_state (telegram.api.types.MessageSchedulingState):
The new message scheduling state; pass null to send the message immediately
Returns:
Ok
Raises:
telegram.Error
ID = 'editMessageSchedulingState'
static read(q: dict, *args) → pytglib.api.functions.edit_message_scheduling_state.EditMessageSchedulingState

pytglib.api.functions.edit_message_text module

class pytglib.api.functions.edit_message_text.EditMessageText(chat_id, message_id, reply_markup, input_message_content, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditMessageText
Args:
chat_id (int):
The chat the message belongs to
message_id (int):
Identifier of the message
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none; for bots only
input_message_content (telegram.api.types.InputMessageContent):
New text content of the messageMust be of type inputMessageText
Returns:
Message
Raises:
telegram.Error
ID = 'editMessageText'
static read(q: dict, *args) → pytglib.api.functions.edit_message_text.EditMessageText

pytglib.api.functions.edit_proxy module

class pytglib.api.functions.edit_proxy.EditProxy(proxy_id, server, port, enable, type, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EditProxy
Args:
proxy_id (int):
Proxy identifier
server (str):
Proxy server IP address
port (int):
Proxy server port
enable (bool):
Pass true to immediately enable the proxy
type (telegram.api.types.ProxyType):
Proxy type
Returns:
Proxy
Raises:
telegram.Error
ID = 'editProxy'
static read(q: dict, *args) → pytglib.api.functions.edit_proxy.EditProxy

pytglib.api.functions.enable_proxy module

class pytglib.api.functions.enable_proxy.EnableProxy(proxy_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): EnableProxy
Args:
proxy_id (int):
Proxy identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'enableProxy'
static read(q: dict, *args) → pytglib.api.functions.enable_proxy.EnableProxy

pytglib.api.functions.finish_file_generation module

class pytglib.api.functions.finish_file_generation.FinishFileGeneration(generation_id, error, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Finishes the file generation

Attributes:
ID (str): FinishFileGeneration
Args:
generation_id (int):
The identifier of the generation process
error (telegram.api.types.error):
If passed, the file generation has failed and must be terminated; pass null if the file generation succeeded
Returns:
Ok
Raises:
telegram.Error
ID = 'finishFileGeneration'
static read(q: dict, *args) → pytglib.api.functions.finish_file_generation.FinishFileGeneration

pytglib.api.functions.forward_messages module

class pytglib.api.functions.forward_messages.ForwardMessages(chat_id, from_chat_id, message_ids, options, send_copy, remove_caption, only_preview, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): ForwardMessages
Args:
chat_id (int):
Identifier of the chat to which to forward messages
from_chat_id (int):
Identifier of the chat from which to forward messages
message_ids (List of int):
Identifiers of the messages to forwardMessage identifiers must be in a strictly increasing orderAt most 100 messages can be forwarded simultaneously
options (telegram.api.types.messageSendOptions):
Options to be used to send the messages; pass null to use default options
send_copy (bool):
Pass true to copy content of the messages without reference to the original senderAlways true if the messages are forwarded to a secret chat or are local
remove_caption (bool):
Pass true to remove media captions of message copiesIgnored if send_copy is false
only_preview (bool):
Pass true to get fake messages instead of actually forwarding them
Returns:
Messages
Raises:
telegram.Error
ID = 'forwardMessages'
static read(q: dict, *args) → pytglib.api.functions.forward_messages.ForwardMessages

pytglib.api.functions.get_account_ttl module

class pytglib.api.functions.get_account_ttl.GetAccountTtl(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetAccountTtl

No parameters required.

Returns:
AccountTtl
Raises:
telegram.Error
ID = 'getAccountTtl'
static read(q: dict, *args) → pytglib.api.functions.get_account_ttl.GetAccountTtl

pytglib.api.functions.get_active_live_location_messages module

class pytglib.api.functions.get_active_live_location_messages.GetActiveLiveLocationMessages(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetActiveLiveLocationMessages

No parameters required.

Returns:
Messages
Raises:
telegram.Error
ID = 'getActiveLiveLocationMessages'
static read(q: dict, *args) → pytglib.api.functions.get_active_live_location_messages.GetActiveLiveLocationMessages

pytglib.api.functions.get_active_sessions module

class pytglib.api.functions.get_active_sessions.GetActiveSessions(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns all active sessions of the current user

Attributes:
ID (str): GetActiveSessions

No parameters required.

Returns:
Sessions
Raises:
telegram.Error
ID = 'getActiveSessions'
static read(q: dict, *args) → pytglib.api.functions.get_active_sessions.GetActiveSessions

pytglib.api.functions.get_all_passport_elements module

class pytglib.api.functions.get_all_passport_elements.GetAllPassportElements(password, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns all available Telegram Passport elements

Attributes:
ID (str): GetAllPassportElements
Args:
password (str):
Password of the current user
Returns:
PassportElements
Raises:
telegram.Error
ID = 'getAllPassportElements'
static read(q: dict, *args) → pytglib.api.functions.get_all_passport_elements.GetAllPassportElements

pytglib.api.functions.get_application_config module

class pytglib.api.functions.get_application_config.GetApplicationConfig(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetApplicationConfig

No parameters required.

Returns:
JsonValue
Raises:
telegram.Error
ID = 'getApplicationConfig'
static read(q: dict, *args) → pytglib.api.functions.get_application_config.GetApplicationConfig

pytglib.api.functions.get_archived_sticker_sets module

class pytglib.api.functions.get_archived_sticker_sets.GetArchivedStickerSets(is_masks, offset_sticker_set_id, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns a list of archived sticker sets

Attributes:
ID (str): GetArchivedStickerSets
Args:
is_masks (bool):
Pass true to return mask stickers sets; pass false to return ordinary sticker sets
offset_sticker_set_id (int):
Identifier of the sticker set from which to return the result
limit (int):
The maximum number of sticker sets to return; up to 100
Returns:
StickerSets
Raises:
telegram.Error
ID = 'getArchivedStickerSets'
static read(q: dict, *args) → pytglib.api.functions.get_archived_sticker_sets.GetArchivedStickerSets

pytglib.api.functions.get_attached_sticker_sets module

class pytglib.api.functions.get_attached_sticker_sets.GetAttachedStickerSets(file_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetAttachedStickerSets
Args:
file_id (int):
File identifier
Returns:
StickerSets
Raises:
telegram.Error
ID = 'getAttachedStickerSets'
static read(q: dict, *args) → pytglib.api.functions.get_attached_sticker_sets.GetAttachedStickerSets

pytglib.api.functions.get_authorization_state module

class pytglib.api.functions.get_authorization_state.GetAuthorizationState(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetAuthorizationState

No parameters required.

Returns:
AuthorizationState
Raises:
telegram.Error
ID = 'getAuthorizationState'
static read(q: dict, *args) → pytglib.api.functions.get_authorization_state.GetAuthorizationState

pytglib.api.functions.get_auto_download_settings_presets module

class pytglib.api.functions.get_auto_download_settings_presets.GetAutoDownloadSettingsPresets(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns auto-download settings presets for the current user

Attributes:
ID (str): GetAutoDownloadSettingsPresets

No parameters required.

Returns:
AutoDownloadSettingsPresets
Raises:
telegram.Error
ID = 'getAutoDownloadSettingsPresets'
static read(q: dict, *args) → pytglib.api.functions.get_auto_download_settings_presets.GetAutoDownloadSettingsPresets

pytglib.api.functions.get_background_url module

class pytglib.api.functions.get_background_url.GetBackgroundUrl(name, type, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Constructs a persistent HTTP URL for a background

Attributes:
ID (str): GetBackgroundUrl
Args:
name (str):
Background name
type (telegram.api.types.BackgroundType):
Background type
Returns:
HttpUrl
Raises:
telegram.Error
ID = 'getBackgroundUrl'
static read(q: dict, *args) → pytglib.api.functions.get_background_url.GetBackgroundUrl

pytglib.api.functions.get_backgrounds module

class pytglib.api.functions.get_backgrounds.GetBackgrounds(for_dark_theme, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns backgrounds installed by the user

Attributes:
ID (str): GetBackgrounds
Args:
for_dark_theme (bool):
Pass true to order returned backgrounds for a dark theme
Returns:
Backgrounds
Raises:
telegram.Error
ID = 'getBackgrounds'
static read(q: dict, *args) → pytglib.api.functions.get_backgrounds.GetBackgrounds

pytglib.api.functions.get_bank_card_info module

class pytglib.api.functions.get_bank_card_info.GetBankCardInfo(bank_card_number, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about a bank card

Attributes:
ID (str): GetBankCardInfo
Args:
bank_card_number (str):
The bank card number
Returns:
BankCardInfo
Raises:
telegram.Error
ID = 'getBankCardInfo'
static read(q: dict, *args) → pytglib.api.functions.get_bank_card_info.GetBankCardInfo

pytglib.api.functions.get_basic_group module

class pytglib.api.functions.get_basic_group.GetBasicGroup(basic_group_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetBasicGroup
Args:
basic_group_id (int):
Basic group identifier
Returns:
BasicGroup
Raises:
telegram.Error
ID = 'getBasicGroup'
static read(q: dict, *args) → pytglib.api.functions.get_basic_group.GetBasicGroup

pytglib.api.functions.get_basic_group_full_info module

class pytglib.api.functions.get_basic_group_full_info.GetBasicGroupFullInfo(basic_group_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns full information about a basic group by its identifier

Attributes:
ID (str): GetBasicGroupFullInfo
Args:
basic_group_id (int):
Basic group identifier
Returns:
BasicGroupFullInfo
Raises:
telegram.Error
ID = 'getBasicGroupFullInfo'
static read(q: dict, *args) → pytglib.api.functions.get_basic_group_full_info.GetBasicGroupFullInfo

pytglib.api.functions.get_blocked_users module

pytglib.api.functions.get_callback_query_answer module

class pytglib.api.functions.get_callback_query_answer.GetCallbackQueryAnswer(chat_id, message_id, payload, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetCallbackQueryAnswer
Args:
chat_id (int):
Identifier of the chat with the message
message_id (int):
Identifier of the message from which the query originated
payload (telegram.api.types.CallbackQueryPayload):
Query payload
Returns:
CallbackQueryAnswer
Raises:
telegram.Error
ID = 'getCallbackQueryAnswer'
static read(q: dict, *args) → pytglib.api.functions.get_callback_query_answer.GetCallbackQueryAnswer

pytglib.api.functions.get_chat module

class pytglib.api.functions.get_chat.GetChat(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetChat
Args:
chat_id (int):
Chat identifier
Returns:
Chat
Raises:
telegram.Error
ID = 'getChat'
static read(q: dict, *args) → pytglib.api.functions.get_chat.GetChat

pytglib.api.functions.get_chat_administrators module

class pytglib.api.functions.get_chat_administrators.GetChatAdministrators(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetChatAdministrators
Args:
chat_id (int):
Chat identifier
Returns:
ChatAdministrators
Raises:
telegram.Error
ID = 'getChatAdministrators'
static read(q: dict, *args) → pytglib.api.functions.get_chat_administrators.GetChatAdministrators

pytglib.api.functions.get_chat_event_log module

class pytglib.api.functions.get_chat_event_log.GetChatEventLog(chat_id, query, from_event_id, limit, filters, user_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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)

Attributes:
ID (str): GetChatEventLog
Args:
chat_id (int):
Chat identifier
query (str):
Search query by which to filter events
from_event_id (int):
Identifier of an event from which to return resultsUse 0 to get results from the latest events
limit (int):
The maximum number of events to return; up to 100
filters (telegram.api.types.chatEventLogFilters):
The types of events to return; pass null to get chat events of all types
user_ids (List of int):
User identifiers by which to filter eventsBy default, events relating to all users will be returned
Returns:
ChatEvents
Raises:
telegram.Error
ID = 'getChatEventLog'
static read(q: dict, *args) → pytglib.api.functions.get_chat_event_log.GetChatEventLog

pytglib.api.functions.get_chat_history module

class pytglib.api.functions.get_chat_history.GetChatHistory(chat_id, from_message_id, offset, limit, only_local, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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 TDLib. This is an offline request if only_local is true

Attributes:
ID (str): GetChatHistory
Args:
chat_id (int):
Chat identifier
from_message_id (int):
Identifier of the message starting from which history must be fetched; use 0 to get results from the last message
offset (int):
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 (int):
The maximum number of messages to be returned; must be positive and can’t be greater than 100If the offset is negative, the limit must be greater than or equal to -offsetFor optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
only_local (bool):
Pass true to get only messages that are available without sending network requests
Returns:
Messages
Raises:
telegram.Error
ID = 'getChatHistory'
static read(q: dict, *args) → pytglib.api.functions.get_chat_history.GetChatHistory

pytglib.api.functions.get_chat_member module

class pytglib.api.functions.get_chat_member.GetChatMember(chat_id, member_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about a single member of a chat

Attributes:
ID (str): GetChatMember
Args:
chat_id (int):
Chat identifier
member_id (telegram.api.types.MessageSender):
Member identifier
Returns:
ChatMember
Raises:
telegram.Error
ID = 'getChatMember'
static read(q: dict, *args) → pytglib.api.functions.get_chat_member.GetChatMember

pytglib.api.functions.get_chat_message_by_date module

class pytglib.api.functions.get_chat_message_by_date.GetChatMessageByDate(chat_id, date, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetChatMessageByDate
Args:
chat_id (int):
Chat identifier
date (int):
Point in time (Unix timestamp) relative to which to search for messages
Returns:
Message
Raises:
telegram.Error
ID = 'getChatMessageByDate'
static read(q: dict, *args) → pytglib.api.functions.get_chat_message_by_date.GetChatMessageByDate

pytglib.api.functions.get_chat_message_count module

class pytglib.api.functions.get_chat_message_count.GetChatMessageCount(chat_id, filter, return_local, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetChatMessageCount
Args:
chat_id (int):
Identifier of the chat in which to count messages
filter (telegram.api.types.SearchMessagesFilter):
Filter for message content; searchMessagesFilterEmpty is unsupported in this function
return_local (bool):
Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally
Returns:
Count
Raises:
telegram.Error
ID = 'getChatMessageCount'
static read(q: dict, *args) → pytglib.api.functions.get_chat_message_count.GetChatMessageCount

pytglib.api.functions.get_chat_notification_settings_exceptions module

class pytglib.api.functions.get_chat_notification_settings_exceptions.GetChatNotificationSettingsExceptions(scope, compare_sound, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns list of chats with non-default notification settings

Attributes:
ID (str): GetChatNotificationSettingsExceptions
Args:
scope (telegram.api.types.NotificationSettingsScope):
If specified, only chats from the scope will be returned; pass null to return chats from all scopes
compare_sound (bool):
Pass true to include in the response chats with only non-default sound
Returns:
Chats
Raises:
telegram.Error
ID = 'getChatNotificationSettingsExceptions'
static read(q: dict, *args) → pytglib.api.functions.get_chat_notification_settings_exceptions.GetChatNotificationSettingsExceptions

pytglib.api.functions.get_chat_pinned_message module

class pytglib.api.functions.get_chat_pinned_message.GetChatPinnedMessage(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about a newest pinned message in the chat

Attributes:
ID (str): GetChatPinnedMessage
Args:
chat_id (int):
Identifier of the chat the message belongs to
Returns:
Message
Raises:
telegram.Error
ID = 'getChatPinnedMessage'
static read(q: dict, *args) → pytglib.api.functions.get_chat_pinned_message.GetChatPinnedMessage

pytglib.api.functions.get_chat_scheduled_messages module

class pytglib.api.functions.get_chat_scheduled_messages.GetChatScheduledMessages(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetChatScheduledMessages
Args:
chat_id (int):
Chat identifier
Returns:
Messages
Raises:
telegram.Error
ID = 'getChatScheduledMessages'
static read(q: dict, *args) → pytglib.api.functions.get_chat_scheduled_messages.GetChatScheduledMessages

pytglib.api.functions.get_chat_statistics module

class pytglib.api.functions.get_chat_statistics.GetChatStatistics(chat_id, is_dark, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetChatStatistics
Args:
chat_id (int):
Chat identifier
is_dark (bool):
Pass true if a dark theme is used by the application
Returns:
ChatStatistics
Raises:
telegram.Error
ID = 'getChatStatistics'
static read(q: dict, *args) → pytglib.api.functions.get_chat_statistics.GetChatStatistics

pytglib.api.functions.get_chat_statistics_graph module

pytglib.api.functions.get_chat_statistics_url module

pytglib.api.functions.get_chats module

class pytglib.api.functions.get_chats.GetChats(chat_list, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns an ordered list of chats from the beginning of a chat list. For informational purposes only. Use loadChats and updates processing instead to maintain chat lists in a consistent state

Attributes:
ID (str): GetChats
Args:
chat_list (telegram.api.types.ChatList):
The chat list in which to return chats; pass null to get chats from the main chat list
limit (int):
The maximum number of chats to be returned
Returns:
Chats
Raises:
telegram.Error
ID = 'getChats'
static read(q: dict, *args) → pytglib.api.functions.get_chats.GetChats

pytglib.api.functions.get_connected_websites module

class pytglib.api.functions.get_connected_websites.GetConnectedWebsites(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetConnectedWebsites

No parameters required.

Returns:
ConnectedWebsites
Raises:
telegram.Error
ID = 'getConnectedWebsites'
static read(q: dict, *args) → pytglib.api.functions.get_connected_websites.GetConnectedWebsites

pytglib.api.functions.get_contacts module

class pytglib.api.functions.get_contacts.GetContacts(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns all user contacts

Attributes:
ID (str): GetContacts

No parameters required.

Returns:
Users
Raises:
telegram.Error
ID = 'getContacts'
static read(q: dict, *args) → pytglib.api.functions.get_contacts.GetContacts

pytglib.api.functions.get_country_code module

class pytglib.api.functions.get_country_code.GetCountryCode(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetCountryCode

No parameters required.

Returns:
Text
Raises:
telegram.Error
ID = 'getCountryCode'
static read(q: dict, *args) → pytglib.api.functions.get_country_code.GetCountryCode

pytglib.api.functions.get_created_public_chats module

class pytglib.api.functions.get_created_public_chats.GetCreatedPublicChats(type, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetCreatedPublicChats
Args:
type (telegram.api.types.PublicChatType):
Type of the public chats to return
Returns:
Chats
Raises:
telegram.Error
ID = 'getCreatedPublicChats'
static read(q: dict, *args) → pytglib.api.functions.get_created_public_chats.GetCreatedPublicChats

pytglib.api.functions.get_current_state module

class pytglib.api.functions.get_current_state.GetCurrentState(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetCurrentState

No parameters required.

Returns:
Updates
Raises:
telegram.Error
ID = 'getCurrentState'
static read(q: dict, *args) → pytglib.api.functions.get_current_state.GetCurrentState

pytglib.api.functions.get_database_statistics module

class pytglib.api.functions.get_database_statistics.GetDatabaseStatistics(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns database statistics

Attributes:
ID (str): GetDatabaseStatistics

No parameters required.

Returns:
DatabaseStatistics
Raises:
telegram.Error
ID = 'getDatabaseStatistics'
static read(q: dict, *args) → pytglib.api.functions.get_database_statistics.GetDatabaseStatistics

pytglib.api.functions.get_emoji_suggestions_url module

class pytglib.api.functions.get_emoji_suggestions_url.GetEmojiSuggestionsUrl(language_code, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetEmojiSuggestionsUrl
Args:
language_code (str):
Language code for which the emoji replacements will be suggested
Returns:
HttpUrl
Raises:
telegram.Error
ID = 'getEmojiSuggestionsUrl'
static read(q: dict, *args) → pytglib.api.functions.get_emoji_suggestions_url.GetEmojiSuggestionsUrl

pytglib.api.functions.get_favorite_stickers module

class pytglib.api.functions.get_favorite_stickers.GetFavoriteStickers(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns favorite stickers

Attributes:
ID (str): GetFavoriteStickers

No parameters required.

Returns:
Stickers
Raises:
telegram.Error
ID = 'getFavoriteStickers'
static read(q: dict, *args) → pytglib.api.functions.get_favorite_stickers.GetFavoriteStickers

pytglib.api.functions.get_file module

class pytglib.api.functions.get_file.GetFile(file_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about a file; this is an offline request

Attributes:
ID (str): GetFile
Args:
file_id (int):
Identifier of the file to get
Returns:
File
Raises:
telegram.Error
ID = 'getFile'
static read(q: dict, *args) → pytglib.api.functions.get_file.GetFile

pytglib.api.functions.get_file_downloaded_prefix_size module

class pytglib.api.functions.get_file_downloaded_prefix_size.GetFileDownloadedPrefixSize(file_id, offset, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns file downloaded prefix size from a given offset, in bytes

Attributes:
ID (str): GetFileDownloadedPrefixSize
Args:
file_id (int):
Identifier of the file
offset (int):
Offset from which downloaded prefix size needs to be calculated
Returns:
FileDownloadedPrefixSize
Raises:
telegram.Error
ID = 'getFileDownloadedPrefixSize'
static read(q: dict, *args) → pytglib.api.functions.get_file_downloaded_prefix_size.GetFileDownloadedPrefixSize

pytglib.api.functions.get_file_extension module

class pytglib.api.functions.get_file_extension.GetFileExtension(mime_type, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetFileExtension
Args:
mime_type (str):
The MIME type of the file
Returns:
Text
Raises:
telegram.Error
ID = 'getFileExtension'
static read(q: dict, *args) → pytglib.api.functions.get_file_extension.GetFileExtension

pytglib.api.functions.get_file_mime_type module

class pytglib.api.functions.get_file_mime_type.GetFileMimeType(file_name, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetFileMimeType
Args:
file_name (str):
The name of the file or path to the file
Returns:
Text
Raises:
telegram.Error
ID = 'getFileMimeType'
static read(q: dict, *args) → pytglib.api.functions.get_file_mime_type.GetFileMimeType

pytglib.api.functions.get_game_high_scores module

class pytglib.api.functions.get_game_high_scores.GetGameHighScores(chat_id, message_id, user_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetGameHighScores
Args:
chat_id (int):
The chat that contains the message with the game
message_id (int):
Identifier of the message
user_id (int):
User identifier
Returns:
GameHighScores
Raises:
telegram.Error
ID = 'getGameHighScores'
static read(q: dict, *args) → pytglib.api.functions.get_game_high_scores.GetGameHighScores

pytglib.api.functions.get_groups_in_common module

class pytglib.api.functions.get_groups_in_common.GetGroupsInCommon(user_id, offset_chat_id, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetGroupsInCommon
Args:
user_id (int):
User identifier
offset_chat_id (int):
Chat identifier starting from which to return chats; use 0 for the first request
limit (int):
The maximum number of chats to be returned; up to 100
Returns:
Chats
Raises:
telegram.Error
ID = 'getGroupsInCommon'
static read(q: dict, *args) → pytglib.api.functions.get_groups_in_common.GetGroupsInCommon

pytglib.api.functions.get_imported_contact_count module

class pytglib.api.functions.get_imported_contact_count.GetImportedContactCount(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the total number of imported contacts

Attributes:
ID (str): GetImportedContactCount

No parameters required.

Returns:
Count
Raises:
telegram.Error
ID = 'getImportedContactCount'
static read(q: dict, *args) → pytglib.api.functions.get_imported_contact_count.GetImportedContactCount

pytglib.api.functions.get_inactive_supergroup_chats module

class pytglib.api.functions.get_inactive_supergroup_chats.GetInactiveSupergroupChats(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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. Also, the limit can be increased with Telegram Premium

Attributes:
ID (str): GetInactiveSupergroupChats

No parameters required.

Returns:
Chats
Raises:
telegram.Error
ID = 'getInactiveSupergroupChats'
static read(q: dict, *args) → pytglib.api.functions.get_inactive_supergroup_chats.GetInactiveSupergroupChats

pytglib.api.functions.get_inline_game_high_scores module

class pytglib.api.functions.get_inline_game_high_scores.GetInlineGameHighScores(inline_message_id, user_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetInlineGameHighScores
Args:
inline_message_id (str):
Inline message identifier
user_id (int):
User identifier
Returns:
GameHighScores
Raises:
telegram.Error
ID = 'getInlineGameHighScores'
static read(q: dict, *args) → pytglib.api.functions.get_inline_game_high_scores.GetInlineGameHighScores

pytglib.api.functions.get_inline_query_results module

class pytglib.api.functions.get_inline_query_results.GetInlineQueryResults(bot_user_id, chat_id, user_location, query, offset, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetInlineQueryResults
Args:
bot_user_id (int):
The identifier of the target bot
chat_id (int):
Identifier of the chat where the query was sent
user_location (telegram.api.types.location):
Location of the user; pass null if unknown or the bot doesn’t need user’s location
query (str):
Text of the query
offset (str):
Offset of the first entry to return
Returns:
InlineQueryResults
Raises:
telegram.Error
ID = 'getInlineQueryResults'
static read(q: dict, *args) → pytglib.api.functions.get_inline_query_results.GetInlineQueryResults

pytglib.api.functions.get_installed_sticker_sets module

class pytglib.api.functions.get_installed_sticker_sets.GetInstalledStickerSets(is_masks, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns a list of installed sticker sets

Attributes:
ID (str): GetInstalledStickerSets
Args:
is_masks (bool):
Pass true to return mask sticker sets; pass false to return ordinary sticker sets
Returns:
StickerSets
Raises:
telegram.Error
ID = 'getInstalledStickerSets'
static read(q: dict, *args) → pytglib.api.functions.get_installed_sticker_sets.GetInstalledStickerSets

pytglib.api.functions.get_invite_text module

pytglib.api.functions.get_json_string module

class pytglib.api.functions.get_json_string.GetJsonString(json_value, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetJsonString
Args:
json_value (telegram.api.types.JsonValue):
The JsonValue object
Returns:
Text
Raises:
telegram.Error
ID = 'getJsonString'
static read(q: dict, *args) → pytglib.api.functions.get_json_string.GetJsonString

pytglib.api.functions.get_json_value module

class pytglib.api.functions.get_json_value.GetJsonValue(json, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetJsonValue
Args:
json (str):
The JSON-serialized string
Returns:
JsonValue
Raises:
telegram.Error
ID = 'getJsonValue'
static read(q: dict, *args) → pytglib.api.functions.get_json_value.GetJsonValue

pytglib.api.functions.get_language_pack_info module

class pytglib.api.functions.get_language_pack_info.GetLanguagePackInfo(language_pack_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetLanguagePackInfo
Args:
language_pack_id (str):
Language pack identifier
Returns:
LanguagePackInfo
Raises:
telegram.Error
ID = 'getLanguagePackInfo'
static read(q: dict, *args) → pytglib.api.functions.get_language_pack_info.GetLanguagePackInfo

pytglib.api.functions.get_language_pack_string module

class pytglib.api.functions.get_language_pack_string.GetLanguagePackString(language_pack_database_path, localization_target, language_pack_id, key, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetLanguagePackString
Args:
language_pack_database_path (str):
Path to the language pack database in which strings are stored
localization_target (str):
Localization target to which the language pack belongs
language_pack_id (str):
Language pack identifier
key (str):
Language pack key of the string to be returned
Returns:
LanguagePackStringValue
Raises:
telegram.Error
ID = 'getLanguagePackString'
static read(q: dict, *args) → pytglib.api.functions.get_language_pack_string.GetLanguagePackString

pytglib.api.functions.get_language_pack_strings module

class pytglib.api.functions.get_language_pack_strings.GetLanguagePackStrings(language_pack_id, keys, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetLanguagePackStrings
Args:
language_pack_id (str):
Language pack identifier of the strings to be returned
keys (List of str):
Language pack keys of the strings to be returned; leave empty to request all available strings
Returns:
LanguagePackStrings
Raises:
telegram.Error
ID = 'getLanguagePackStrings'
static read(q: dict, *args) → pytglib.api.functions.get_language_pack_strings.GetLanguagePackStrings

pytglib.api.functions.get_localization_target_info module

class pytglib.api.functions.get_localization_target_info.GetLocalizationTargetInfo(only_local, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetLocalizationTargetInfo
Args:
only_local (bool):
Pass true to get only locally available information without sending network requests
Returns:
LocalizationTargetInfo
Raises:
telegram.Error
ID = 'getLocalizationTargetInfo'
static read(q: dict, *args) → pytglib.api.functions.get_localization_target_info.GetLocalizationTargetInfo

pytglib.api.functions.get_log_stream module

class pytglib.api.functions.get_log_stream.GetLogStream(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetLogStream

No parameters required.

Returns:
LogStream
Raises:
telegram.Error
ID = 'getLogStream'
static read(q: dict, *args) → pytglib.api.functions.get_log_stream.GetLogStream

pytglib.api.functions.get_log_tag_verbosity_level module

class pytglib.api.functions.get_log_tag_verbosity_level.GetLogTagVerbosityLevel(tag, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetLogTagVerbosityLevel
Args:
tag (str):
Logging tag to change verbosity level
Returns:
LogVerbosityLevel
Raises:
telegram.Error
ID = 'getLogTagVerbosityLevel'
static read(q: dict, *args) → pytglib.api.functions.get_log_tag_verbosity_level.GetLogTagVerbosityLevel

pytglib.api.functions.get_log_tags module

class pytglib.api.functions.get_log_tags.GetLogTags(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns list of available TDLib internal log tags, for example, [“actor”, “binlog”, “connections”, “notifications”, “proxy”]. Can be called synchronously

Attributes:
ID (str): GetLogTags

No parameters required.

Returns:
LogTags
Raises:
telegram.Error
ID = 'getLogTags'
static read(q: dict, *args) → pytglib.api.functions.get_log_tags.GetLogTags

pytglib.api.functions.get_log_verbosity_level module

class pytglib.api.functions.get_log_verbosity_level.GetLogVerbosityLevel(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetLogVerbosityLevel

No parameters required.

Returns:
LogVerbosityLevel
Raises:
telegram.Error
ID = 'getLogVerbosityLevel'
static read(q: dict, *args) → pytglib.api.functions.get_log_verbosity_level.GetLogVerbosityLevel

pytglib.api.functions.get_login_url module

class pytglib.api.functions.get_login_url.GetLoginUrl(chat_id, message_id, button_id, allow_write_access, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetLoginUrl
Args:
chat_id (int):
Chat identifier of the message with the button
message_id (int):
Message identifier of the message with the button
button_id (int):
Button identifier
allow_write_access (bool):
Pass true to allow the bot to send messages to the current user
Returns:
HttpUrl
Raises:
telegram.Error
ID = 'getLoginUrl'
static read(q: dict, *args) → pytglib.api.functions.get_login_url.GetLoginUrl

pytglib.api.functions.get_login_url_info module

class pytglib.api.functions.get_login_url_info.GetLoginUrlInfo(chat_id, message_id, button_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetLoginUrlInfo
Args:
chat_id (int):
Chat identifier of the message with the button
message_id (int):
Message identifier of the message with the button
button_id (int):
Button identifier
Returns:
LoginUrlInfo
Raises:
telegram.Error
ID = 'getLoginUrlInfo'
static read(q: dict, *args) → pytglib.api.functions.get_login_url_info.GetLoginUrlInfo

pytglib.api.functions.get_map_thumbnail_file module

class pytglib.api.functions.get_map_thumbnail_file.GetMapThumbnailFile(location, zoom, width, height, scale, chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetMapThumbnailFile
Args:
location (telegram.api.types.location):
Location of the map center
zoom (int):
Map zoom level; 13-20
width (int):
Map width in pixels before applying scale; 16-1024
height (int):
Map height in pixels before applying scale; 16-1024
scale (int):
Map scale; 1-3
chat_id (int):
Identifier of a chat in which the thumbnail will be shownUse 0 if unknown
Returns:
File
Raises:
telegram.Error
ID = 'getMapThumbnailFile'
static read(q: dict, *args) → pytglib.api.functions.get_map_thumbnail_file.GetMapThumbnailFile

pytglib.api.functions.get_markdown_text module

class pytglib.api.functions.get_markdown_text.GetMarkdownText(text, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetMarkdownText
Args:
text (telegram.api.types.formattedText):
The text
Returns:
FormattedText
Raises:
telegram.Error
ID = 'getMarkdownText'
static read(q: dict, *args) → pytglib.api.functions.get_markdown_text.GetMarkdownText

pytglib.api.functions.get_me module

class pytglib.api.functions.get_me.GetMe(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the current user

Attributes:
ID (str): GetMe

No parameters required.

Returns:
User
Raises:
telegram.Error
ID = 'getMe'
static read(q: dict, *args) → pytglib.api.functions.get_me.GetMe

pytglib.api.functions.get_message module

class pytglib.api.functions.get_message.GetMessage(chat_id, message_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about a message

Attributes:
ID (str): GetMessage
Args:
chat_id (int):
Identifier of the chat the message belongs to
message_id (int):
Identifier of the message to get
Returns:
Message
Raises:
telegram.Error
ID = 'getMessage'
static read(q: dict, *args) → pytglib.api.functions.get_message.GetMessage

pytglib.api.functions.get_message_locally module

class pytglib.api.functions.get_message_locally.GetMessageLocally(chat_id, message_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetMessageLocally
Args:
chat_id (int):
Identifier of the chat the message belongs to
message_id (int):
Identifier of the message to get
Returns:
Message
Raises:
telegram.Error
ID = 'getMessageLocally'
static read(q: dict, *args) → pytglib.api.functions.get_message_locally.GetMessageLocally

pytglib.api.functions.get_messages module

class pytglib.api.functions.get_messages.GetMessages(chat_id, message_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about messages. If a message is not found, returns null on the corresponding position of the result

Attributes:
ID (str): GetMessages
Args:
chat_id (int):
Identifier of the chat the messages belong to
message_ids (List of int):
Identifiers of the messages to get
Returns:
Messages
Raises:
telegram.Error
ID = 'getMessages'
static read(q: dict, *args) → pytglib.api.functions.get_messages.GetMessages

pytglib.api.functions.get_network_statistics module

class pytglib.api.functions.get_network_statistics.GetNetworkStatistics(only_current, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns network data usage statistics. Can be called before authorization

Attributes:
ID (str): GetNetworkStatistics
Args:
only_current (bool):
Pass true to get statistics only for the current library launch
Returns:
NetworkStatistics
Raises:
telegram.Error
ID = 'getNetworkStatistics'
static read(q: dict, *args) → pytglib.api.functions.get_network_statistics.GetNetworkStatistics

pytglib.api.functions.get_option module

class pytglib.api.functions.get_option.GetOption(name, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the value of an option by its name. (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before authorization. Can be called synchronously for options “version” and “commit_hash”

Attributes:
ID (str): GetOption
Args:
name (str):
The name of the option
Returns:
OptionValue
Raises:
telegram.Error
ID = 'getOption'
static read(q: dict, *args) → pytglib.api.functions.get_option.GetOption

pytglib.api.functions.get_passport_authorization_form module

class pytglib.api.functions.get_passport_authorization_form.GetPassportAuthorizationForm(bot_user_id, scope, public_key, nonce, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns a Telegram Passport authorization form for sharing data with a service

Attributes:
ID (str): GetPassportAuthorizationForm
Args:
bot_user_id (int):
User identifier of the service’s bot
scope (str):
Telegram Passport element types requested by the service
public_key (str):
Service’s public key
nonce (str):
Unique request identifier provided by the service
Returns:
PassportAuthorizationForm
Raises:
telegram.Error
ID = 'getPassportAuthorizationForm'
static read(q: dict, *args) → pytglib.api.functions.get_passport_authorization_form.GetPassportAuthorizationForm

pytglib.api.functions.get_passport_authorization_form_available_elements module

class pytglib.api.functions.get_passport_authorization_form_available_elements.GetPassportAuthorizationFormAvailableElements(autorization_form_id, password, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization form. Result can be received only once for each authorization form

Attributes:
ID (str): GetPassportAuthorizationFormAvailableElements
Args:
autorization_form_id (int):
Authorization form identifier
password (str):
Password of the current user
Returns:
PassportElementsWithErrors
Raises:
telegram.Error
ID = 'getPassportAuthorizationFormAvailableElements'
static read(q: dict, *args) → pytglib.api.functions.get_passport_authorization_form_available_elements.GetPassportAuthorizationFormAvailableElements

pytglib.api.functions.get_passport_element module

class pytglib.api.functions.get_passport_element.GetPassportElement(type, password, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns one of the available Telegram Passport elements

Attributes:
ID (str): GetPassportElement
Args:
type (telegram.api.types.PassportElementType):
Telegram Passport element type
password (str):
Password of the current user
Returns:
PassportElement
Raises:
telegram.Error
ID = 'getPassportElement'
static read(q: dict, *args) → pytglib.api.functions.get_passport_element.GetPassportElement

pytglib.api.functions.get_password_state module

class pytglib.api.functions.get_password_state.GetPasswordState(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the current state of 2-step verification

Attributes:
ID (str): GetPasswordState

No parameters required.

Returns:
PasswordState
Raises:
telegram.Error
ID = 'getPasswordState'
static read(q: dict, *args) → pytglib.api.functions.get_password_state.GetPasswordState

pytglib.api.functions.get_payment_form module

class pytglib.api.functions.get_payment_form.GetPaymentForm(input_invoice, theme, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns an invoice payment form. This method must be called when the user presses inlineKeyboardButtonBuy

Attributes:
ID (str): GetPaymentForm
Args:
input_invoice (telegram.api.types.InputInvoice):
The invoice
theme (telegram.api.types.themeParameters):
Preferred payment form theme; pass null to use the default theme
Returns:
PaymentForm
Raises:
telegram.Error
ID = 'getPaymentForm'
static read(q: dict, *args) → pytglib.api.functions.get_payment_form.GetPaymentForm

pytglib.api.functions.get_payment_receipt module

class pytglib.api.functions.get_payment_receipt.GetPaymentReceipt(chat_id, message_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about a successful payment

Attributes:
ID (str): GetPaymentReceipt
Args:
chat_id (int):
Chat identifier of the PaymentSuccessful message
message_id (int):
Message identifier
Returns:
PaymentReceipt
Raises:
telegram.Error
ID = 'getPaymentReceipt'
static read(q: dict, *args) → pytglib.api.functions.get_payment_receipt.GetPaymentReceipt

pytglib.api.functions.get_poll_voters module

class pytglib.api.functions.get_poll_voters.GetPollVoters(chat_id, message_id, option_id, offset, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns users voted for the specified option in a non-anonymous polls. For optimal performance, the number of returned users is chosen by TDLib

Attributes:
ID (str): GetPollVoters
Args:
chat_id (int):
Identifier of the chat to which the poll belongs
message_id (int):
Identifier of the message containing the poll
option_id (int):
0-based identifier of the answer option
offset (int):
Number of users to skip in the result; must be non-negative
limit (int):
The maximum number of users to be returned; must be positive and can’t be greater than 50For optimal performance, the number of returned users is chosen by TDLib and can be smaller than the specified limit, even if the end of the voter list has not been reached
Returns:
Users
Raises:
telegram.Error
ID = 'getPollVoters'
static read(q: dict, *args) → pytglib.api.functions.get_poll_voters.GetPollVoters

pytglib.api.functions.get_preferred_country_language module

class pytglib.api.functions.get_preferred_country_language.GetPreferredCountryLanguage(country_code, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns an IETF language tag of the language preferred in the country, which must be used to fill native fields in Telegram Passport personal details. Returns a 404 error if unknown

Attributes:
ID (str): GetPreferredCountryLanguage
Args:
country_code (str):
A two-letter ISO 3166-1 alpha-2 country code
Returns:
Text
Raises:
telegram.Error
ID = 'getPreferredCountryLanguage'
static read(q: dict, *args) → pytglib.api.functions.get_preferred_country_language.GetPreferredCountryLanguage

pytglib.api.functions.get_proxies module

class pytglib.api.functions.get_proxies.GetProxies(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns list of proxies that are currently set up. Can be called before authorization

Attributes:
ID (str): GetProxies

No parameters required.

Returns:
Proxies
Raises:
telegram.Error
ID = 'getProxies'
static read(q: dict, *args) → pytglib.api.functions.get_proxies.GetProxies

pytglib.api.functions.get_push_receiver_id module

class pytglib.api.functions.get_push_receiver_id.GetPushReceiverId(payload, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns a globally unique push notification subscription identifier for identification of an account, which has received a push notification. Can be called synchronously

Attributes:
ID (str): GetPushReceiverId
Args:
payload (str):
JSON-encoded push notification payload
Returns:
PushReceiverId
Raises:
telegram.Error
ID = 'getPushReceiverId'
static read(q: dict, *args) → pytglib.api.functions.get_push_receiver_id.GetPushReceiverId

pytglib.api.functions.get_recent_inline_bots module

class pytglib.api.functions.get_recent_inline_bots.GetRecentInlineBots(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns up to 20 recently used inline bots in the order of their last usage

Attributes:
ID (str): GetRecentInlineBots

No parameters required.

Returns:
Users
Raises:
telegram.Error
ID = 'getRecentInlineBots'
static read(q: dict, *args) → pytglib.api.functions.get_recent_inline_bots.GetRecentInlineBots

pytglib.api.functions.get_recent_stickers module

class pytglib.api.functions.get_recent_stickers.GetRecentStickers(is_attached, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns a list of recently used stickers

Attributes:
ID (str): GetRecentStickers
Args:
is_attached (bool):
Pass true to return stickers and masks that were recently attached to photos or video files; pass false to return recently sent stickers
Returns:
Stickers
Raises:
telegram.Error
ID = 'getRecentStickers'
static read(q: dict, *args) → pytglib.api.functions.get_recent_stickers.GetRecentStickers

pytglib.api.functions.get_recently_visited_t_me_urls module

class pytglib.api.functions.get_recently_visited_t_me_urls.GetRecentlyVisitedTMeUrls(referrer, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns t.me URLs recently visited by a newly registered user

Attributes:
ID (str): GetRecentlyVisitedTMeUrls
Args:
referrer (str):
Google Play referrer to identify the user
Returns:
TMeUrls
Raises:
telegram.Error
ID = 'getRecentlyVisitedTMeUrls'
static read(q: dict, *args) → pytglib.api.functions.get_recently_visited_t_me_urls.GetRecentlyVisitedTMeUrls

pytglib.api.functions.get_recovery_email_address module

class pytglib.api.functions.get_recovery_email_address.GetRecoveryEmailAddress(password, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetRecoveryEmailAddress
Args:
password (str):
The password for the current user
Returns:
RecoveryEmailAddress
Raises:
telegram.Error
ID = 'getRecoveryEmailAddress'
static read(q: dict, *args) → pytglib.api.functions.get_recovery_email_address.GetRecoveryEmailAddress

pytglib.api.functions.get_remote_file module

class pytglib.api.functions.get_remote_file.GetRemoteFile(remote_file_id, file_type, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetRemoteFile
Args:
remote_file_id (str):
Remote identifier of the file to get
file_type (telegram.api.types.FileType):
File type; pass null if unknown
Returns:
File
Raises:
telegram.Error
ID = 'getRemoteFile'
static read(q: dict, *args) → pytglib.api.functions.get_remote_file.GetRemoteFile

pytglib.api.functions.get_replied_message module

class pytglib.api.functions.get_replied_message.GetRepliedMessage(chat_id, message_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetRepliedMessage
Args:
chat_id (int):
Identifier of the chat the message belongs to
message_id (int):
Identifier of the reply message
Returns:
Message
Raises:
telegram.Error
ID = 'getRepliedMessage'
static read(q: dict, *args) → pytglib.api.functions.get_replied_message.GetRepliedMessage

pytglib.api.functions.get_saved_animations module

class pytglib.api.functions.get_saved_animations.GetSavedAnimations(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns saved animations

Attributes:
ID (str): GetSavedAnimations

No parameters required.

Returns:
Animations
Raises:
telegram.Error
ID = 'getSavedAnimations'
static read(q: dict, *args) → pytglib.api.functions.get_saved_animations.GetSavedAnimations

pytglib.api.functions.get_saved_order_info module

class pytglib.api.functions.get_saved_order_info.GetSavedOrderInfo(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns saved order information. Returns a 404 error if there is no saved order information

Attributes:
ID (str): GetSavedOrderInfo

No parameters required.

Returns:
OrderInfo
Raises:
telegram.Error
ID = 'getSavedOrderInfo'
static read(q: dict, *args) → pytglib.api.functions.get_saved_order_info.GetSavedOrderInfo

pytglib.api.functions.get_scope_notification_settings module

class pytglib.api.functions.get_scope_notification_settings.GetScopeNotificationSettings(scope, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the notification settings for chats of a given type

Attributes:
ID (str): GetScopeNotificationSettings
Args:
scope (telegram.api.types.NotificationSettingsScope):
Types of chats for which to return the notification settings information
Returns:
ScopeNotificationSettings
Raises:
telegram.Error
ID = 'getScopeNotificationSettings'
static read(q: dict, *args) → pytglib.api.functions.get_scope_notification_settings.GetScopeNotificationSettings

pytglib.api.functions.get_secret_chat module

class pytglib.api.functions.get_secret_chat.GetSecretChat(secret_chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about a secret chat by its identifier. This is an offline request

Attributes:
ID (str): GetSecretChat
Args:
secret_chat_id (int):
Secret chat identifier
Returns:
SecretChat
Raises:
telegram.Error
ID = 'getSecretChat'
static read(q: dict, *args) → pytglib.api.functions.get_secret_chat.GetSecretChat

pytglib.api.functions.get_sticker_emojis module

class pytglib.api.functions.get_sticker_emojis.GetStickerEmojis(sticker, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetStickerEmojis
Args:
sticker (telegram.api.types.InputFile):
Sticker file identifier
Returns:
Emojis
Raises:
telegram.Error
ID = 'getStickerEmojis'
static read(q: dict, *args) → pytglib.api.functions.get_sticker_emojis.GetStickerEmojis

pytglib.api.functions.get_sticker_set module

class pytglib.api.functions.get_sticker_set.GetStickerSet(set_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about a sticker set by its identifier

Attributes:
ID (str): GetStickerSet
Args:
set_id (int):
Identifier of the sticker set
Returns:
StickerSet
Raises:
telegram.Error
ID = 'getStickerSet'
static read(q: dict, *args) → pytglib.api.functions.get_sticker_set.GetStickerSet

pytglib.api.functions.get_stickers module

class pytglib.api.functions.get_stickers.GetStickers(emoji, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns stickers from the installed sticker sets that correspond to a given emoji. If the emoji is non-empty, favorite and recently used stickers may also be returned

Attributes:
ID (str): GetStickers
Args:
emoji (str):
String representation of emojiIf empty, returns all known installed stickers
limit (int):
The maximum number of stickers to be returned
Returns:
Stickers
Raises:
telegram.Error
ID = 'getStickers'
static read(q: dict, *args) → pytglib.api.functions.get_stickers.GetStickers

pytglib.api.functions.get_storage_statistics module

class pytglib.api.functions.get_storage_statistics.GetStorageStatistics(chat_limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns storage usage statistics. Can be called before authorization

Attributes:
ID (str): GetStorageStatistics
Args:
chat_limit (int):
The maximum number of chats with the largest storage usage for which separate statistics need to be returnedAll other chats will be grouped in entries with chat_id == 0If the chat info database is not used, the chat_limit is ignored and is always set to 0
Returns:
StorageStatistics
Raises:
telegram.Error
ID = 'getStorageStatistics'
static read(q: dict, *args) → pytglib.api.functions.get_storage_statistics.GetStorageStatistics

pytglib.api.functions.get_storage_statistics_fast module

class pytglib.api.functions.get_storage_statistics_fast.GetStorageStatisticsFast(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Quickly returns approximate storage usage statistics. Can be called before authorization

Attributes:
ID (str): GetStorageStatisticsFast

No parameters required.

Returns:
StorageStatisticsFast
Raises:
telegram.Error
ID = 'getStorageStatisticsFast'
static read(q: dict, *args) → pytglib.api.functions.get_storage_statistics_fast.GetStorageStatisticsFast

pytglib.api.functions.get_suitable_discussion_chats module

class pytglib.api.functions.get_suitable_discussion_chats.GetSuitableDiscussionChats(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetSuitableDiscussionChats

No parameters required.

Returns:
Chats
Raises:
telegram.Error
ID = 'getSuitableDiscussionChats'
static read(q: dict, *args) → pytglib.api.functions.get_suitable_discussion_chats.GetSuitableDiscussionChats

pytglib.api.functions.get_supergroup module

class pytglib.api.functions.get_supergroup.GetSupergroup(supergroup_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot

Attributes:
ID (str): GetSupergroup
Args:
supergroup_id (int):
Supergroup or channel identifier
Returns:
Supergroup
Raises:
telegram.Error
ID = 'getSupergroup'
static read(q: dict, *args) → pytglib.api.functions.get_supergroup.GetSupergroup

pytglib.api.functions.get_supergroup_full_info module

class pytglib.api.functions.get_supergroup_full_info.GetSupergroupFullInfo(supergroup_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute

Attributes:
ID (str): GetSupergroupFullInfo
Args:
supergroup_id (int):
Supergroup or channel identifier
Returns:
SupergroupFullInfo
Raises:
telegram.Error
ID = 'getSupergroupFullInfo'
static read(q: dict, *args) → pytglib.api.functions.get_supergroup_full_info.GetSupergroupFullInfo

pytglib.api.functions.get_supergroup_members module

class pytglib.api.functions.get_supergroup_members.GetSupergroupMembers(supergroup_id, filter, offset, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetSupergroupMembers
Args:
supergroup_id (int):
Identifier of the supergroup or channel
filter (telegram.api.types.SupergroupMembersFilter):
The type of users to return; pass null to use supergroupMembersFilterRecent
offset (int):
Number of users to skip
limit (int):
The maximum number of users be returned; up to 200
Returns:
ChatMembers
Raises:
telegram.Error
ID = 'getSupergroupMembers'
static read(q: dict, *args) → pytglib.api.functions.get_supergroup_members.GetSupergroupMembers

pytglib.api.functions.get_support_user module

class pytglib.api.functions.get_support_user.GetSupportUser(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns a user that can be contacted to get support

Attributes:
ID (str): GetSupportUser

No parameters required.

Returns:
User
Raises:
telegram.Error
ID = 'getSupportUser'
static read(q: dict, *args) → pytglib.api.functions.get_support_user.GetSupportUser

pytglib.api.functions.get_temporary_password_state module

class pytglib.api.functions.get_temporary_password_state.GetTemporaryPasswordState(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about the current temporary password

Attributes:
ID (str): GetTemporaryPasswordState

No parameters required.

Returns:
TemporaryPasswordState
Raises:
telegram.Error
ID = 'getTemporaryPasswordState'
static read(q: dict, *args) → pytglib.api.functions.get_temporary_password_state.GetTemporaryPasswordState

pytglib.api.functions.get_text_entities module

class pytglib.api.functions.get_text_entities.GetTextEntities(text, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) contained in the text. Can be called synchronously

Attributes:
ID (str): GetTextEntities
Args:
text (str):
The text in which to look for entites
Returns:
TextEntities
Raises:
telegram.Error
ID = 'getTextEntities'
static read(q: dict, *args) → pytglib.api.functions.get_text_entities.GetTextEntities

pytglib.api.functions.get_top_chats module

class pytglib.api.functions.get_top_chats.GetTopChats(category, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns a list of frequently used chats. Supported only if the chat info database is enabled

Attributes:
ID (str): GetTopChats
Args:
category (telegram.api.types.TopChatCategory):
Category of chats to be returned
limit (int):
The maximum number of chats to be returned; up to 30
Returns:
Chats
Raises:
telegram.Error
ID = 'getTopChats'
static read(q: dict, *args) → pytglib.api.functions.get_top_chats.GetTopChats

pytglib.api.functions.get_user module

class pytglib.api.functions.get_user.GetUser(user_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetUser
Args:
user_id (int):
User identifier
Returns:
User
Raises:
telegram.Error
ID = 'getUser'
static read(q: dict, *args) → pytglib.api.functions.get_user.GetUser

pytglib.api.functions.get_user_full_info module

class pytglib.api.functions.get_user_full_info.GetUserFullInfo(user_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns full information about a user by their identifier

Attributes:
ID (str): GetUserFullInfo
Args:
user_id (int):
User identifier
Returns:
UserFullInfo
Raises:
telegram.Error
ID = 'getUserFullInfo'
static read(q: dict, *args) → pytglib.api.functions.get_user_full_info.GetUserFullInfo

pytglib.api.functions.get_user_privacy_setting_rules module

class pytglib.api.functions.get_user_privacy_setting_rules.GetUserPrivacySettingRules(setting, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the current privacy settings

Attributes:
ID (str): GetUserPrivacySettingRules
Args:
setting (telegram.api.types.UserPrivacySetting):
The privacy setting
Returns:
UserPrivacySettingRules
Raises:
telegram.Error
ID = 'getUserPrivacySettingRules'
static read(q: dict, *args) → pytglib.api.functions.get_user_privacy_setting_rules.GetUserPrivacySettingRules

pytglib.api.functions.get_user_profile_photos module

class pytglib.api.functions.get_user_profile_photos.GetUserProfilePhotos(user_id, offset, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the profile photos of a user. The result of this query may be outdated: some photos might have been deleted already

Attributes:
ID (str): GetUserProfilePhotos
Args:
user_id (int):
User identifier
offset (int):
The number of photos to skip; must be non-negative
limit (int):
The maximum number of photos to be returned; up to 100
Returns:
ChatPhotos
Raises:
telegram.Error
ID = 'getUserProfilePhotos'
static read(q: dict, *args) → pytglib.api.functions.get_user_profile_photos.GetUserProfilePhotos

pytglib.api.functions.get_web_page_instant_view module

class pytglib.api.functions.get_web_page_instant_view.GetWebPageInstantView(url, force_full, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page

Attributes:
ID (str): GetWebPageInstantView
Args:
url (str):
The web page URL
force_full (bool):
Pass true to get full instant view for the web page
Returns:
WebPageInstantView
Raises:
telegram.Error
ID = 'getWebPageInstantView'
static read(q: dict, *args) → pytglib.api.functions.get_web_page_instant_view.GetWebPageInstantView

pytglib.api.functions.get_web_page_preview module

class pytglib.api.functions.get_web_page_preview.GetWebPagePreview(text, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): GetWebPagePreview
Args:
text (telegram.api.types.formattedText):
Message text with formatting
Returns:
WebPage
Raises:
telegram.Error
ID = 'getWebPagePreview'
static read(q: dict, *args) → pytglib.api.functions.get_web_page_preview.GetWebPagePreview

pytglib.api.functions.import_contacts module

class pytglib.api.functions.import_contacts.ImportContacts(contacts, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Adds new contacts or edits existing contacts by their phone numbers; contacts’ user identifiers are ignored

Attributes:
ID (str): ImportContacts
Args:
contacts (List of telegram.api.types.contact):
The list of contacts to import or edit; contacts’ vCard are ignored and are not imported
Returns:
ImportedContacts
Raises:
telegram.Error
ID = 'importContacts'
static read(q: dict, *args) → pytglib.api.functions.import_contacts.ImportContacts

pytglib.api.functions.join_chat module

class pytglib.api.functions.join_chat.JoinChat(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Adds the current user as a new member to a chat. Private and secret chats can’t be joined using this method. May return an error with a message “INVITE_REQUEST_SENT” if only a join request was created

Attributes:
ID (str): JoinChat
Args:
chat_id (int):
Chat identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'joinChat'
static read(q: dict, *args) → pytglib.api.functions.join_chat.JoinChat

pytglib.api.functions.leave_chat module

class pytglib.api.functions.leave_chat.LeaveChat(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes the current user from chat members. Private and secret chats can’t be left using this method

Attributes:
ID (str): LeaveChat
Args:
chat_id (int):
Chat identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'leaveChat'
static read(q: dict, *args) → pytglib.api.functions.leave_chat.LeaveChat

pytglib.api.functions.log_out module

class pytglib.api.functions.log_out.LogOut(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): LogOut

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'logOut'
static read(q: dict, *args) → pytglib.api.functions.log_out.LogOut

pytglib.api.functions.open_chat module

class pytglib.api.functions.open_chat.OpenChat(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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)

Attributes:
ID (str): OpenChat
Args:
chat_id (int):
Chat identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'openChat'
static read(q: dict, *args) → pytglib.api.functions.open_chat.OpenChat

pytglib.api.functions.open_message_content module

class pytglib.api.functions.open_message_content.OpenMessageContent(chat_id, message_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): OpenMessageContent
Args:
chat_id (int):
Chat identifier of the message
message_id (int):
Identifier of the message with the opened content
Returns:
Ok
Raises:
telegram.Error
ID = 'openMessageContent'
static read(q: dict, *args) → pytglib.api.functions.open_message_content.OpenMessageContent

pytglib.api.functions.optimize_storage module

class pytglib.api.functions.optimize_storage.OptimizeStorage(size, ttl, count, immunity_delay, file_types, chat_ids, exclude_chat_ids, return_deleted_file_statistics, chat_limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can’t be deleted

Attributes:
ID (str): OptimizeStorage
Args:
size (int):
Limit on the total size of files after deletion, in bytesPass -1 to use the default limit
ttl (int):
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 (int):
Limit on the total number of files after deletionPass -1 to use the default limit
immunity_delay (int):
The amount of time after the creation of a file during which it can’t be deleted, in secondsPass -1 to use the default value
file_types (List of telegram.api.types.FileType):
If non-empty, only files with the given types are consideredBy default, all types except thumbnails, profile photos, stickers and wallpapers are deleted
chat_ids (List of int):
If non-empty, only files from the given chats are consideredUse 0 as chat identifier to delete files not belonging to any chat (eg, profile photos)
exclude_chat_ids (List of int):
If non-empty, files from the given chats are excludedUse 0 as chat identifier to exclude all files not belonging to any chat (eg, profile photos)
return_deleted_file_statistics (bool):
Pass true if statistics about the files that were deleted must be returned instead of the whole storage usage statisticsAffects only returned statistics
chat_limit (int):
Same as in getStorageStatisticsAffects only returned statistics
Returns:
StorageStatistics
Raises:
telegram.Error
ID = 'optimizeStorage'
static read(q: dict, *args) → pytglib.api.functions.optimize_storage.OptimizeStorage

pytglib.api.functions.parse_markdown module

class pytglib.api.functions.parse_markdown.ParseMarkdown(text, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Parses Markdown entities in a human-friendly format, ignoring markup errors. Can be called synchronously

Attributes:
ID (str): ParseMarkdown
Args:
text (telegram.api.types.formattedText):
The text to parseFor example, “__italic__ ~~strikethrough~~ ||spoiler|| bold code `pre` __[italic__ text_url](telegramorg) __italic**bold italic__bold**”
Returns:
FormattedText
Raises:
telegram.Error
ID = 'parseMarkdown'
static read(q: dict, *args) → pytglib.api.functions.parse_markdown.ParseMarkdown

pytglib.api.functions.parse_text_entities module

class pytglib.api.functions.parse_text_entities.ParseTextEntities(text, parse_mode, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Parses Bold, Italic, Underline, Strikethrough, Spoiler, Code, Pre, PreCode, TextUrl and MentionName entities contained in the text. Can be called synchronously

Attributes:
ID (str): ParseTextEntities
Args:
text (str):
The text to parse
parse_mode (telegram.api.types.TextParseMode):
Text parse mode
Returns:
FormattedText
Raises:
telegram.Error
ID = 'parseTextEntities'
static read(q: dict, *args) → pytglib.api.functions.parse_text_entities.ParseTextEntities

pytglib.api.functions.pin_chat_message module

class pytglib.api.functions.pin_chat_message.PinChatMessage(chat_id, message_id, disable_notification, only_for_self, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Pins a message in a chat; requires can_pin_messages rights or can_edit_messages rights in the channel

Attributes:
ID (str): PinChatMessage
Args:
chat_id (int):
Identifier of the chat
message_id (int):
Identifier of the new pinned message
disable_notification (bool):
Pass true to disable notification about the pinned messageNotifications are always disabled in channels and private chats
only_for_self (bool):
Pass true to pin the message only for self; private chats only
Returns:
Ok
Raises:
telegram.Error
ID = 'pinChatMessage'
static read(q: dict, *args) → pytglib.api.functions.pin_chat_message.PinChatMessage

pytglib.api.functions.ping_proxy module

class pytglib.api.functions.ping_proxy.PingProxy(proxy_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization

Attributes:
ID (str): PingProxy
Args:
proxy_id (int):
Proxy identifierUse 0 to ping a Telegram server without a proxy
Returns:
Seconds
Raises:
telegram.Error
ID = 'pingProxy'
static read(q: dict, *args) → pytglib.api.functions.ping_proxy.PingProxy

pytglib.api.functions.process_push_notification module

class pytglib.api.functions.process_push_notification.ProcessPushNotification(payload, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): ProcessPushNotification
Args:
payload (str):
JSON-encoded push notification payload with all fields sent by the server, and “googlesent_time” and “googlenotificationsound” fields added
Returns:
Ok
Raises:
telegram.Error
ID = 'processPushNotification'
static read(q: dict, *args) → pytglib.api.functions.process_push_notification.ProcessPushNotification

pytglib.api.functions.read_all_chat_mentions module

class pytglib.api.functions.read_all_chat_mentions.ReadAllChatMentions(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Marks all mentions in a chat as read

Attributes:
ID (str): ReadAllChatMentions
Args:
chat_id (int):
Chat identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'readAllChatMentions'
static read(q: dict, *args) → pytglib.api.functions.read_all_chat_mentions.ReadAllChatMentions

pytglib.api.functions.read_file_part module

class pytglib.api.functions.read_file_part.ReadFilePart(file_id, offset, count, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): ReadFilePart
Args:
file_id (int):
Identifier of the fileThe file must be located in the TDLib file cache
offset (int):
The offset from which to read the file
count (int):
Number of bytes to readAn error will be returned if there are not enough bytes available in the file from the specified positionPass 0 to read all available data from the specified position
Returns:
FilePart
Raises:
telegram.Error
ID = 'readFilePart'
static read(q: dict, *args) → pytglib.api.functions.read_file_part.ReadFilePart

pytglib.api.functions.recover_authentication_password module

class pytglib.api.functions.recover_authentication_password.RecoverAuthenticationPassword(recovery_code, new_password, new_hint, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): RecoverAuthenticationPassword
Args:
recovery_code (str):
Recovery code to check
new_password (str):
New password of the user; may be empty to remove the password
new_hint (str):
New password hint; may be empty
Returns:
Ok
Raises:
telegram.Error
ID = 'recoverAuthenticationPassword'
static read(q: dict, *args) → pytglib.api.functions.recover_authentication_password.RecoverAuthenticationPassword

pytglib.api.functions.recover_password module

class pytglib.api.functions.recover_password.RecoverPassword(recovery_code, new_password, new_hint, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Recovers the 2-step verification password using a recovery code sent to an email address that was previously set up

Attributes:
ID (str): RecoverPassword
Args:
recovery_code (str):
Recovery code to check
new_password (str):
New password of the user; may be empty to remove the password
new_hint (str):
New password hint; may be empty
Returns:
PasswordState
Raises:
telegram.Error
ID = 'recoverPassword'
static read(q: dict, *args) → pytglib.api.functions.recover_password.RecoverPassword

pytglib.api.functions.register_device module

class pytglib.api.functions.register_device.RegisterDevice(device_token, other_user_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Registers the currently used device for receiving push notifications. Returns a globally unique identifier of the push notification subscription

Attributes:
ID (str): RegisterDevice
Args:
device_token (telegram.api.types.DeviceToken):
Device token
other_user_ids (List of int):
List of user identifiers of other users currently using the application
Returns:
PushReceiverId
Raises:
telegram.Error
ID = 'registerDevice'
static read(q: dict, *args) → pytglib.api.functions.register_device.RegisterDevice

pytglib.api.functions.register_user module

class pytglib.api.functions.register_user.RegisterUser(first_name, last_name, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration

Attributes:
ID (str): RegisterUser
Args:
first_name (str):
The first name of the user; 1-64 characters
last_name (str):
The last name of the user; 0-64 characters
Returns:
Ok
Raises:
telegram.Error
ID = 'registerUser'
static read(q: dict, *args) → pytglib.api.functions.register_user.RegisterUser

pytglib.api.functions.remove_background module

class pytglib.api.functions.remove_background.RemoveBackground(background_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes background from the list of installed backgrounds

Attributes:
ID (str): RemoveBackground
Args:
background_id (int):
The background identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'removeBackground'
static read(q: dict, *args) → pytglib.api.functions.remove_background.RemoveBackground

pytglib.api.functions.remove_chat_action_bar module

class pytglib.api.functions.remove_chat_action_bar.RemoveChatActionBar(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes a chat action bar without any other action

Attributes:
ID (str): RemoveChatActionBar
Args:
chat_id (int):
Chat identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'removeChatActionBar'
static read(q: dict, *args) → pytglib.api.functions.remove_chat_action_bar.RemoveChatActionBar

pytglib.api.functions.remove_contacts module

class pytglib.api.functions.remove_contacts.RemoveContacts(user_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes users from the contact list

Attributes:
ID (str): RemoveContacts
Args:
user_ids (List of int):
Identifiers of users to be deleted
Returns:
Ok
Raises:
telegram.Error
ID = 'removeContacts'
static read(q: dict, *args) → pytglib.api.functions.remove_contacts.RemoveContacts

pytglib.api.functions.remove_favorite_sticker module

class pytglib.api.functions.remove_favorite_sticker.RemoveFavoriteSticker(sticker, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes a sticker from the list of favorite stickers

Attributes:
ID (str): RemoveFavoriteSticker
Args:
sticker (telegram.api.types.InputFile):
Sticker file to delete from the list
Returns:
Ok
Raises:
telegram.Error
ID = 'removeFavoriteSticker'
static read(q: dict, *args) → pytglib.api.functions.remove_favorite_sticker.RemoveFavoriteSticker

pytglib.api.functions.remove_notification module

class pytglib.api.functions.remove_notification.RemoveNotification(notification_group_id, notification_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user

Attributes:
ID (str): RemoveNotification
Args:
notification_group_id (int):
Identifier of notification group to which the notification belongs
notification_id (int):
Identifier of removed notification
Returns:
Ok
Raises:
telegram.Error
ID = 'removeNotification'
static read(q: dict, *args) → pytglib.api.functions.remove_notification.RemoveNotification

pytglib.api.functions.remove_notification_group module

class pytglib.api.functions.remove_notification_group.RemoveNotificationGroup(notification_group_id, max_notification_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes a group of active notifications. Needs to be called only if the notification group is removed by the current user

Attributes:
ID (str): RemoveNotificationGroup
Args:
notification_group_id (int):
Notification group identifier
max_notification_id (int):
The maximum identifier of removed notifications
Returns:
Ok
Raises:
telegram.Error
ID = 'removeNotificationGroup'
static read(q: dict, *args) → pytglib.api.functions.remove_notification_group.RemoveNotificationGroup

pytglib.api.functions.remove_proxy module

class pytglib.api.functions.remove_proxy.RemoveProxy(proxy_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes a proxy server. Can be called before authorization

Attributes:
ID (str): RemoveProxy
Args:
proxy_id (int):
Proxy identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'removeProxy'
static read(q: dict, *args) → pytglib.api.functions.remove_proxy.RemoveProxy

pytglib.api.functions.remove_recent_hashtag module

class pytglib.api.functions.remove_recent_hashtag.RemoveRecentHashtag(hashtag, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes a hashtag from the list of recently used hashtags

Attributes:
ID (str): RemoveRecentHashtag
Args:
hashtag (str):
Hashtag to delete
Returns:
Ok
Raises:
telegram.Error
ID = 'removeRecentHashtag'
static read(q: dict, *args) → pytglib.api.functions.remove_recent_hashtag.RemoveRecentHashtag

pytglib.api.functions.remove_recent_sticker module

class pytglib.api.functions.remove_recent_sticker.RemoveRecentSticker(is_attached, sticker, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes a sticker from the list of recently used stickers

Attributes:
ID (str): RemoveRecentSticker
Args:
is_attached (bool):
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 (telegram.api.types.InputFile):
Sticker file to delete
Returns:
Ok
Raises:
telegram.Error
ID = 'removeRecentSticker'
static read(q: dict, *args) → pytglib.api.functions.remove_recent_sticker.RemoveRecentSticker

pytglib.api.functions.remove_recently_found_chat module

class pytglib.api.functions.remove_recently_found_chat.RemoveRecentlyFoundChat(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes a chat from the list of recently found chats

Attributes:
ID (str): RemoveRecentlyFoundChat
Args:
chat_id (int):
Identifier of the chat to be removed
Returns:
Ok
Raises:
telegram.Error
ID = 'removeRecentlyFoundChat'
static read(q: dict, *args) → pytglib.api.functions.remove_recently_found_chat.RemoveRecentlyFoundChat

pytglib.api.functions.remove_saved_animation module

class pytglib.api.functions.remove_saved_animation.RemoveSavedAnimation(animation, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes an animation from the list of saved animations

Attributes:
ID (str): RemoveSavedAnimation
Args:
animation (telegram.api.types.InputFile):
Animation file to be removed
Returns:
Ok
Raises:
telegram.Error
ID = 'removeSavedAnimation'
static read(q: dict, *args) → pytglib.api.functions.remove_saved_animation.RemoveSavedAnimation

pytglib.api.functions.remove_sticker_from_set module

class pytglib.api.functions.remove_sticker_from_set.RemoveStickerFromSet(sticker, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes a sticker from the set to which it belongs; for bots only. The sticker set must have been created by the bot

Attributes:
ID (str): RemoveStickerFromSet
Args:
sticker (telegram.api.types.InputFile):
Sticker
Returns:
Ok
Raises:
telegram.Error
ID = 'removeStickerFromSet'
static read(q: dict, *args) → pytglib.api.functions.remove_sticker_from_set.RemoveStickerFromSet

pytglib.api.functions.remove_top_chat module

class pytglib.api.functions.remove_top_chat.RemoveTopChat(category, chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled

Attributes:
ID (str): RemoveTopChat
Args:
category (telegram.api.types.TopChatCategory):
Category of frequently used chats
chat_id (int):
Chat identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'removeTopChat'
static read(q: dict, *args) → pytglib.api.functions.remove_top_chat.RemoveTopChat

pytglib.api.functions.reorder_installed_sticker_sets module

class pytglib.api.functions.reorder_installed_sticker_sets.ReorderInstalledStickerSets(is_masks, sticker_set_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the order of installed sticker sets

Attributes:
ID (str): ReorderInstalledStickerSets
Args:
is_masks (bool):
Pass true to change the order of mask sticker sets; pass false to change the order of ordinary sticker sets
sticker_set_ids (List of int):
Identifiers of installed sticker sets in the new correct order
Returns:
Ok
Raises:
telegram.Error
ID = 'reorderInstalledStickerSets'
static read(q: dict, *args) → pytglib.api.functions.reorder_installed_sticker_sets.ReorderInstalledStickerSets

pytglib.api.functions.report_chat module

class pytglib.api.functions.report_chat.ReportChat(chat_id, message_ids, reason, text, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if chat.can_be_reported

Attributes:
ID (str): ReportChat
Args:
chat_id (int):
Chat identifier
message_ids (List of int):
Identifiers of reported messages; may be empty to report the whole chat
reason (telegram.api.types.ChatReportReason):
The reason for reporting the chat
text (str):
Additional report details; 0-1024 characters
Returns:
Ok
Raises:
telegram.Error
ID = 'reportChat'
static read(q: dict, *args) → pytglib.api.functions.report_chat.ReportChat

pytglib.api.functions.report_supergroup_spam module

class pytglib.api.functions.report_supergroup_spam.ReportSupergroupSpam(supergroup_id, message_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Reports messages in a supergroup as spam; requires administrator rights in the supergroup

Attributes:
ID (str): ReportSupergroupSpam
Args:
supergroup_id (int):
Supergroup identifier
message_ids (List of int):
Identifiers of messages to report
Returns:
Ok
Raises:
telegram.Error
ID = 'reportSupergroupSpam'
static read(q: dict, *args) → pytglib.api.functions.report_supergroup_spam.ReportSupergroupSpam

pytglib.api.functions.request_authentication_password_recovery module

class pytglib.api.functions.request_authentication_password_recovery.RequestAuthenticationPasswordRecovery(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): RequestAuthenticationPasswordRecovery

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'requestAuthenticationPasswordRecovery'
static read(q: dict, *args) → pytglib.api.functions.request_authentication_password_recovery.RequestAuthenticationPasswordRecovery

pytglib.api.functions.request_password_recovery module

class pytglib.api.functions.request_password_recovery.RequestPasswordRecovery(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Requests to send a 2-step verification password recovery code to an email address that was previously set up

Attributes:
ID (str): RequestPasswordRecovery

No parameters required.

Returns:
EmailAddressAuthenticationCodeInfo
Raises:
telegram.Error
ID = 'requestPasswordRecovery'
static read(q: dict, *args) → pytglib.api.functions.request_password_recovery.RequestPasswordRecovery

pytglib.api.functions.request_qr_code_authentication module

class pytglib.api.functions.request_qr_code_authentication.RequestQrCodeAuthentication(other_user_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): RequestQrCodeAuthentication
Args:
other_user_ids (List of int):
List of user identifiers of other users currently using the application
Returns:
Ok
Raises:
telegram.Error
ID = 'requestQrCodeAuthentication'
static read(q: dict, *args) → pytglib.api.functions.request_qr_code_authentication.RequestQrCodeAuthentication

pytglib.api.functions.resend_authentication_code module

class pytglib.api.functions.resend_authentication_code.ResendAuthenticationCode(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Re-sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode, the next_code_type of the result is not null and the server-specified timeout has passed

Attributes:
ID (str): ResendAuthenticationCode

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'resendAuthenticationCode'
static read(q: dict, *args) → pytglib.api.functions.resend_authentication_code.ResendAuthenticationCode

pytglib.api.functions.resend_change_phone_number_code module

class pytglib.api.functions.resend_change_phone_number_code.ResendChangePhoneNumberCode(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Re-sends the authentication code sent to confirm a new phone number for the current user. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed

Attributes:
ID (str): ResendChangePhoneNumberCode

No parameters required.

Returns:
AuthenticationCodeInfo
Raises:
telegram.Error
ID = 'resendChangePhoneNumberCode'
static read(q: dict, *args) → pytglib.api.functions.resend_change_phone_number_code.ResendChangePhoneNumberCode

pytglib.api.functions.resend_email_address_verification_code module

class pytglib.api.functions.resend_email_address_verification_code.ResendEmailAddressVerificationCode(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Re-sends the code to verify an email address to be added to a user’s Telegram Passport

Attributes:
ID (str): ResendEmailAddressVerificationCode

No parameters required.

Returns:
EmailAddressAuthenticationCodeInfo
Raises:
telegram.Error
ID = 'resendEmailAddressVerificationCode'
static read(q: dict, *args) → pytglib.api.functions.resend_email_address_verification_code.ResendEmailAddressVerificationCode

pytglib.api.functions.resend_messages module

class pytglib.api.functions.resend_messages.ResendMessages(chat_id, message_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): ResendMessages
Args:
chat_id (int):
Identifier of the chat to send messages
message_ids (List of int):
Identifiers of the messages to resendMessage identifiers must be in a strictly increasing order
Returns:
Messages
Raises:
telegram.Error
ID = 'resendMessages'
static read(q: dict, *args) → pytglib.api.functions.resend_messages.ResendMessages

pytglib.api.functions.resend_phone_number_confirmation_code module

class pytglib.api.functions.resend_phone_number_confirmation_code.ResendPhoneNumberConfirmationCode(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Resends phone number confirmation code

Attributes:
ID (str): ResendPhoneNumberConfirmationCode

No parameters required.

Returns:
AuthenticationCodeInfo
Raises:
telegram.Error
ID = 'resendPhoneNumberConfirmationCode'
static read(q: dict, *args) → pytglib.api.functions.resend_phone_number_confirmation_code.ResendPhoneNumberConfirmationCode

pytglib.api.functions.resend_phone_number_verification_code module

class pytglib.api.functions.resend_phone_number_verification_code.ResendPhoneNumberVerificationCode(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Re-sends the code to verify a phone number to be added to a user’s Telegram Passport

Attributes:
ID (str): ResendPhoneNumberVerificationCode

No parameters required.

Returns:
AuthenticationCodeInfo
Raises:
telegram.Error
ID = 'resendPhoneNumberVerificationCode'
static read(q: dict, *args) → pytglib.api.functions.resend_phone_number_verification_code.ResendPhoneNumberVerificationCode

pytglib.api.functions.resend_recovery_email_address_code module

class pytglib.api.functions.resend_recovery_email_address_code.ResendRecoveryEmailAddressCode(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Resends the 2-step verification recovery email address verification code

Attributes:
ID (str): ResendRecoveryEmailAddressCode

No parameters required.

Returns:
PasswordState
Raises:
telegram.Error
ID = 'resendRecoveryEmailAddressCode'
static read(q: dict, *args) → pytglib.api.functions.resend_recovery_email_address_code.ResendRecoveryEmailAddressCode

pytglib.api.functions.reset_all_notification_settings module

class pytglib.api.functions.reset_all_notification_settings.ResetAllNotificationSettings(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Resets all notification settings to their default values. By default, all chats are unmuted and message previews are shown

Attributes:
ID (str): ResetAllNotificationSettings

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'resetAllNotificationSettings'
static read(q: dict, *args) → pytglib.api.functions.reset_all_notification_settings.ResetAllNotificationSettings

pytglib.api.functions.reset_backgrounds module

class pytglib.api.functions.reset_backgrounds.ResetBackgrounds(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Resets list of installed backgrounds to its default value

Attributes:
ID (str): ResetBackgrounds

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'resetBackgrounds'
static read(q: dict, *args) → pytglib.api.functions.reset_backgrounds.ResetBackgrounds

pytglib.api.functions.reset_network_statistics module

class pytglib.api.functions.reset_network_statistics.ResetNetworkStatistics(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Resets all network data usage statistics to zero. Can be called before authorization

Attributes:
ID (str): ResetNetworkStatistics

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'resetNetworkStatistics'
static read(q: dict, *args) → pytglib.api.functions.reset_network_statistics.ResetNetworkStatistics

pytglib.api.functions.save_application_log_event module

class pytglib.api.functions.save_application_log_event.SaveApplicationLogEvent(type, chat_id, data, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Saves application log event on the server. Can be called before authorization

Attributes:
ID (str): SaveApplicationLogEvent
Args:
type (str):
Event type
chat_id (int):
Optional chat identifier, associated with the event
data (telegram.api.types.JsonValue):
The log event data
Returns:
Ok
Raises:
telegram.Error
ID = 'saveApplicationLogEvent'
static read(q: dict, *args) → pytglib.api.functions.save_application_log_event.SaveApplicationLogEvent

pytglib.api.functions.search_background module

class pytglib.api.functions.search_background.SearchBackground(name, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Searches for a background by its name

Attributes:
ID (str): SearchBackground
Args:
name (str):
The name of the background
Returns:
Background
Raises:
telegram.Error
ID = 'searchBackground'
static read(q: dict, *args) → pytglib.api.functions.search_background.SearchBackground

pytglib.api.functions.search_call_messages module

class pytglib.api.functions.search_call_messages.SearchCallMessages(from_message_id, limit, only_missed, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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 TDLib

Attributes:
ID (str): SearchCallMessages
Args:
from_message_id (int):
Identifier of the message from which to search; use 0 to get results from the last message
limit (int):
The maximum number of messages to be returned; up to 100For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
only_missed (bool):
Pass true to search only for messages with missed/declined calls
Returns:
Messages
Raises:
telegram.Error
ID = 'searchCallMessages'
static read(q: dict, *args) → pytglib.api.functions.search_call_messages.SearchCallMessages

pytglib.api.functions.search_chat_members module

class pytglib.api.functions.search_chat_members.SearchChatMembers(chat_id, query, limit, filter, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SearchChatMembers
Args:
chat_id (int):
Chat identifier
query (str):
Query to search for
limit (int):
The maximum number of users to be returned; up to 200
filter (telegram.api.types.ChatMembersFilter):
The type of users to search for; pass null to search among all chat members
Returns:
ChatMembers
Raises:
telegram.Error
ID = 'searchChatMembers'
static read(q: dict, *args) → pytglib.api.functions.search_chat_members.SearchChatMembers

pytglib.api.functions.search_chat_messages module

class pytglib.api.functions.search_chat_messages.SearchChatMessages(chat_id, query, sender_id, from_message_id, offset, limit, filter, message_thread_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query(searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit

Attributes:
ID (str): SearchChatMessages
Args:
chat_id (int):
Identifier of the chat in which to search messages
query (str):
Query to search for
sender_id (telegram.api.types.MessageSender):
Identifier of the sender of messages to search for; pass null to search for messages from any senderNot supported in secret chats
from_message_id (int):
Identifier of the message starting from which history must be fetched; use 0 to get results from the last message
offset (int):
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 (int):
The maximum number of messages to be returned; must be positive and can’t be greater than 100If the offset is negative, the limit must be greater than -offsetFor optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
filter (telegram.api.types.SearchMessagesFilter):
Additional filter for messages to search; pass null to search for all messages
message_thread_id (int):
If not 0, only messages in the specified thread will be returned; supergroups only
Returns:
Messages
Raises:
telegram.Error
ID = 'searchChatMessages'
static read(q: dict, *args) → pytglib.api.functions.search_chat_messages.SearchChatMessages

pytglib.api.functions.search_chat_recent_location_messages module

class pytglib.api.functions.search_chat_recent_location_messages.SearchChatRecentLocationMessages(chat_id, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns information about the recent locations of chat members that were sent to the chat. Returns up to 1 location message per user

Attributes:
ID (str): SearchChatRecentLocationMessages
Args:
chat_id (int):
Chat identifier
limit (int):
The maximum number of messages to be returned
Returns:
Messages
Raises:
telegram.Error
ID = 'searchChatRecentLocationMessages'
static read(q: dict, *args) → pytglib.api.functions.search_chat_recent_location_messages.SearchChatRecentLocationMessages

pytglib.api.functions.search_chats module

class pytglib.api.functions.search_chats.SearchChats(query, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SearchChats
Args:
query (str):
Query to search forIf the query is empty, returns up to 50 recently found chats
limit (int):
The maximum number of chats to be returned
Returns:
Chats
Raises:
telegram.Error
ID = 'searchChats'
static read(q: dict, *args) → pytglib.api.functions.search_chats.SearchChats

pytglib.api.functions.search_chats_nearby module

class pytglib.api.functions.search_chats_nearby.SearchChatsNearby(location, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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 must be sent again every 25 seconds with adjusted location to not miss new chats

Attributes:
ID (str): SearchChatsNearby
Args:
location (telegram.api.types.location):
Current user location
Returns:
ChatsNearby
Raises:
telegram.Error
ID = 'searchChatsNearby'
static read(q: dict, *args) → pytglib.api.functions.search_chats_nearby.SearchChatsNearby

pytglib.api.functions.search_chats_on_server module

class pytglib.api.functions.search_chats_on_server.SearchChatsOnServer(query, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SearchChatsOnServer
Args:
query (str):
Query to search for
limit (int):
The maximum number of chats to be returned
Returns:
Chats
Raises:
telegram.Error
ID = 'searchChatsOnServer'
static read(q: dict, *args) → pytglib.api.functions.search_chats_on_server.SearchChatsOnServer

pytglib.api.functions.search_contacts module

class pytglib.api.functions.search_contacts.SearchContacts(query, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Searches for the specified query in the first names, last names and usernames of the known user contacts

Attributes:
ID (str): SearchContacts
Args:
query (str):
Query to search for; may be empty to return all contacts
limit (int):
The maximum number of users to be returned
Returns:
Users
Raises:
telegram.Error
ID = 'searchContacts'
static read(q: dict, *args) → pytglib.api.functions.search_contacts.SearchContacts

pytglib.api.functions.search_emojis module

class pytglib.api.functions.search_emojis.SearchEmojis(text, exact_match, input_language_codes, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Searches for emojis by keywords. Supported only if the file database is enabled

Attributes:
ID (str): SearchEmojis
Args:
text (str):
Text to search for
exact_match (bool):
Pass true if only emojis, which exactly match the text, needs to be returned
input_language_codes (List of str):
List of possible IETF language tags of the user’s input language; may be empty if unknown
Returns:
Emojis
Raises:
telegram.Error
ID = 'searchEmojis'
static read(q: dict, *args) → pytglib.api.functions.search_emojis.SearchEmojis

pytglib.api.functions.search_hashtags module

class pytglib.api.functions.search_hashtags.SearchHashtags(prefix, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Searches for recently used hashtags by their prefix

Attributes:
ID (str): SearchHashtags
Args:
prefix (str):
Hashtag prefix to search for
limit (int):
The maximum number of hashtags to be returned
Returns:
Hashtags
Raises:
telegram.Error
ID = 'searchHashtags'
static read(q: dict, *args) → pytglib.api.functions.search_hashtags.SearchHashtags

pytglib.api.functions.search_installed_sticker_sets module

class pytglib.api.functions.search_installed_sticker_sets.SearchInstalledStickerSets(is_masks, query, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Searches for installed sticker sets by looking for specified query in their title and name

Attributes:
ID (str): SearchInstalledStickerSets
Args:
is_masks (bool):
Pass true to return mask sticker sets; pass false to return ordinary sticker sets
query (str):
Query to search for
limit (int):
The maximum number of sticker sets to return
Returns:
StickerSets
Raises:
telegram.Error
ID = 'searchInstalledStickerSets'
static read(q: dict, *args) → pytglib.api.functions.search_installed_sticker_sets.SearchInstalledStickerSets

pytglib.api.functions.search_messages module

class pytglib.api.functions.search_messages.SearchMessages(chat_list, query, offset_date, offset_chat_id, offset_message_id, limit, filter, min_date, max_date, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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 TDLib and can be smaller than the specified limit

Attributes:
ID (str): SearchMessages
Args:
chat_list (telegram.api.types.ChatList):
Chat list in which to search messages; pass null to search in all chats regardless of their chat listOnly Main and Archive chat lists are supported
query (str):
Query to search for
offset_date (int):
The date of the message starting from which the results need to be fetchedUse 0 or any date in the future to get results from the last message
offset_chat_id (int):
The chat identifier of the last found message, or 0 for the first request
offset_message_id (int):
The message identifier of the last found message, or 0 for the first request
limit (int):
The maximum number of messages to be returned; up to 100For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
filter (telegram.api.types.SearchMessagesFilter):
Additional filter for messages to search; pass null to search for all messagesFilters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function
min_date (int):
If not 0, the minimum date of the messages to return
max_date (int):
If not 0, the maximum date of the messages to return
Returns:
Messages
Raises:
telegram.Error
ID = 'searchMessages'
static read(q: dict, *args) → pytglib.api.functions.search_messages.SearchMessages

pytglib.api.functions.search_public_chat module

class pytglib.api.functions.search_public_chat.SearchPublicChat(username, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SearchPublicChat
Args:
username (str):
Username to be resolved
Returns:
Chat
Raises:
telegram.Error
ID = 'searchPublicChat'
static read(q: dict, *args) → pytglib.api.functions.search_public_chat.SearchPublicChat

pytglib.api.functions.search_public_chats module

class pytglib.api.functions.search_public_chats.SearchPublicChats(query, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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.Excludes private chats with contacts and chats from the chat list from the results

Attributes:
ID (str): SearchPublicChats
Args:
query (str):
Query to search for
Returns:
Chats
Raises:
telegram.Error
ID = 'searchPublicChats'
static read(q: dict, *args) → pytglib.api.functions.search_public_chats.SearchPublicChats

pytglib.api.functions.search_secret_messages module

class pytglib.api.functions.search_secret_messages.SearchSecretMessages(chat_id, query, offset, limit, filter, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance, the number of returned messages is chosen by TDLib

Attributes:
ID (str): SearchSecretMessages
Args:
chat_id (int):
Identifier of the chat in which to searchSpecify 0 to search in all secret chats
query (str):
Query to search forIf empty, searchChatMessages must be used instead
offset (str):
Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
limit (int):
The maximum number of messages to be returned; up to 100For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
filter (telegram.api.types.SearchMessagesFilter):
Additional filter for messages to search; pass null to search for all messages
Returns:
FoundMessages
Raises:
telegram.Error
ID = 'searchSecretMessages'
static read(q: dict, *args) → pytglib.api.functions.search_secret_messages.SearchSecretMessages

pytglib.api.functions.search_sticker_set module

class pytglib.api.functions.search_sticker_set.SearchStickerSet(name, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Searches for a sticker set by its name

Attributes:
ID (str): SearchStickerSet
Args:
name (str):
Name of the sticker set
Returns:
StickerSet
Raises:
telegram.Error
ID = 'searchStickerSet'
static read(q: dict, *args) → pytglib.api.functions.search_sticker_set.SearchStickerSet

pytglib.api.functions.search_sticker_sets module

class pytglib.api.functions.search_sticker_sets.SearchStickerSets(query, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Searches for ordinary sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results

Attributes:
ID (str): SearchStickerSets
Args:
query (str):
Query to search for
Returns:
StickerSets
Raises:
telegram.Error
ID = 'searchStickerSets'
static read(q: dict, *args) → pytglib.api.functions.search_sticker_sets.SearchStickerSets

pytglib.api.functions.search_stickers module

class pytglib.api.functions.search_stickers.SearchStickers(emoji, limit, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Searches for stickers from public sticker sets that correspond to a given emoji

Attributes:
ID (str): SearchStickers
Args:
emoji (str):
String representation of emoji; must be non-empty
limit (int):
The maximum number of stickers to be returned
Returns:
Stickers
Raises:
telegram.Error
ID = 'searchStickers'
static read(q: dict, *args) → pytglib.api.functions.search_stickers.SearchStickers

pytglib.api.functions.send_bot_start_message module

class pytglib.api.functions.send_bot_start_message.SendBotStartMessage(bot_user_id, chat_id, parameter, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SendBotStartMessage
Args:
bot_user_id (int):
Identifier of the bot
chat_id (int):
Identifier of the target chat
parameter (str):
A hidden parameter sent to the bot for deep linking purposes (https://coretelegramorg/bots#deep-linking)
Returns:
Message
Raises:
telegram.Error
ID = 'sendBotStartMessage'
static read(q: dict, *args) → pytglib.api.functions.send_bot_start_message.SendBotStartMessage

pytglib.api.functions.send_call_debug_information module

class pytglib.api.functions.send_call_debug_information.SendCallDebugInformation(call_id, debug_information, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends debug information for a call to Telegram servers

Attributes:
ID (str): SendCallDebugInformation
Args:
call_id (int):
Call identifier
debug_information (str):
Debug information in application-specific format
Returns:
Ok
Raises:
telegram.Error
ID = 'sendCallDebugInformation'
static read(q: dict, *args) → pytglib.api.functions.send_call_debug_information.SendCallDebugInformation

pytglib.api.functions.send_call_rating module

class pytglib.api.functions.send_call_rating.SendCallRating(call_id, rating, comment, problems, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends a call rating

Attributes:
ID (str): SendCallRating
Args:
call_id (int):
Call identifier
rating (int):
Call rating; 1-5
comment (str):
An optional user comment if the rating is less than 5
problems (List of telegram.api.types.CallProblem):
List of the exact types of problems with the call, specified by the user
Returns:
Ok
Raises:
telegram.Error
ID = 'sendCallRating'
static read(q: dict, *args) → pytglib.api.functions.send_call_rating.SendCallRating

pytglib.api.functions.send_chat_action module

class pytglib.api.functions.send_chat_action.SendChatAction(chat_id, message_thread_id, action, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends a notification about user activity in a chat

Attributes:
ID (str): SendChatAction
Args:
chat_id (int):
Chat identifier
message_thread_id (int):
If not 0, a message thread identifier in which the action was performed
action (telegram.api.types.ChatAction):
The action description; pass null to cancel the currently active action
Returns:
Ok
Raises:
telegram.Error
ID = 'sendChatAction'
static read(q: dict, *args) → pytglib.api.functions.send_chat_action.SendChatAction

pytglib.api.functions.send_chat_screenshot_taken_notification module

class pytglib.api.functions.send_chat_screenshot_taken_notification.SendChatScreenshotTakenNotification(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats

Attributes:
ID (str): SendChatScreenshotTakenNotification
Args:
chat_id (int):
Chat identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'sendChatScreenshotTakenNotification'
static read(q: dict, *args) → pytglib.api.functions.send_chat_screenshot_taken_notification.SendChatScreenshotTakenNotification

pytglib.api.functions.send_chat_set_ttl_message module

pytglib.api.functions.send_custom_request module

class pytglib.api.functions.send_custom_request.SendCustomRequest(method, parameters, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends a custom request; for bots only

Attributes:
ID (str): SendCustomRequest
Args:
method (str):
The method name
parameters (str):
JSON-serialized method parameters
Returns:
CustomRequestResult
Raises:
telegram.Error
ID = 'sendCustomRequest'
static read(q: dict, *args) → pytglib.api.functions.send_custom_request.SendCustomRequest

pytglib.api.functions.send_email_address_verification_code module

class pytglib.api.functions.send_email_address_verification_code.SendEmailAddressVerificationCode(email_address, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends a code to verify an email address to be added to a user’s Telegram Passport

Attributes:
ID (str): SendEmailAddressVerificationCode
Args:
email_address (str):
Email address
Returns:
EmailAddressAuthenticationCodeInfo
Raises:
telegram.Error
ID = 'sendEmailAddressVerificationCode'
static read(q: dict, *args) → pytglib.api.functions.send_email_address_verification_code.SendEmailAddressVerificationCode

pytglib.api.functions.send_inline_query_result_message module

class pytglib.api.functions.send_inline_query_result_message.SendInlineQueryResultMessage(chat_id, message_thread_id, reply_to_message_id, options, query_id, result_id, hide_via_bot, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message

Attributes:
ID (str): SendInlineQueryResultMessage
Args:
chat_id (int):
Target chat
message_thread_id (int):
If not 0, a message thread identifier in which the message will be sent
reply_to_message_id (int):
Identifier of a replied message; 0 if none
options (telegram.api.types.messageSendOptions):
Options to be used to send the message; pass null to use default options
query_id (int):
Identifier of the inline query
result_id (str):
Identifier of the inline result
hide_via_bot (bool):
Pass true to hide the bot, via which the message is sentCan be used only for bots GetOption(“animation_search_bot_username”), GetOption(“photo_search_bot_username”), and GetOption(“venue_search_bot_username”)
Returns:
Message
Raises:
telegram.Error
ID = 'sendInlineQueryResultMessage'
static read(q: dict, *args) → pytglib.api.functions.send_inline_query_result_message.SendInlineQueryResultMessage

pytglib.api.functions.send_message module

class pytglib.api.functions.send_message.SendMessage(chat_id, message_thread_id, reply_to_message_id, options, reply_markup, input_message_content, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends a message. Returns the sent message

Attributes:
ID (str): SendMessage
Args:
chat_id (int):
Target chat
message_thread_id (int):
If not 0, a message thread identifier in which the message will be sent
reply_to_message_id (int):
Identifier of the replied message; 0 if none
options (telegram.api.types.messageSendOptions):
Options to be used to send the message; pass null to use default options
reply_markup (telegram.api.types.ReplyMarkup):
Markup for replying to the message; pass null if none; for bots only
input_message_content (telegram.api.types.InputMessageContent):
The content of the message to be sent
Returns:
Message
Raises:
telegram.Error
ID = 'sendMessage'
static read(q: dict, *args) → pytglib.api.functions.send_message.SendMessage

pytglib.api.functions.send_message_album module

class pytglib.api.functions.send_message_album.SendMessageAlbum(chat_id, message_thread_id, reply_to_message_id, options, input_message_contents, only_preview, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SendMessageAlbum
Args:
chat_id (int):
Target chat
message_thread_id (int):
If not 0, a message thread identifier in which the messages will be sent
reply_to_message_id (int):
Identifier of a replied message; 0 if none
options (telegram.api.types.messageSendOptions):
Options to be used to send the messages; pass null to use default options
input_message_contents (List of telegram.api.types.InputMessageContent):
Contents of messages to be sentAt most 10 messages can be added to an album
only_preview (bool):
Pass true to get fake messages instead of actually sending them
Returns:
Messages
Raises:
telegram.Error
ID = 'sendMessageAlbum'
static read(q: dict, *args) → pytglib.api.functions.send_message_album.SendMessageAlbum

pytglib.api.functions.send_passport_authorization_form module

class pytglib.api.functions.send_passport_authorization_form.SendPassportAuthorizationForm(autorization_form_id, types, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SendPassportAuthorizationForm
Args:
autorization_form_id (int):
Authorization form identifier
types (List of telegram.api.types.PassportElementType):
Types of Telegram Passport elements chosen by user to complete the authorization form
Returns:
Ok
Raises:
telegram.Error
ID = 'sendPassportAuthorizationForm'
static read(q: dict, *args) → pytglib.api.functions.send_passport_authorization_form.SendPassportAuthorizationForm

pytglib.api.functions.send_payment_form module

class pytglib.api.functions.send_payment_form.SendPaymentForm(input_invoice, payment_form_id, order_info_id, shipping_option_id, credentials, tip_amount, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends a filled-out payment form to the bot for final verification

Attributes:
ID (str): SendPaymentForm
Args:
input_invoice (telegram.api.types.InputInvoice):
The invoice
payment_form_id (int):
Payment form identifier returned by getPaymentForm
order_info_id (str):
Identifier returned by validateOrderInfo, or an empty string
shipping_option_id (str):
Identifier of a chosen shipping option, if applicable
credentials (telegram.api.types.InputCredentials):
The credentials chosen by user for payment
tip_amount (int):
Chosen by the user amount of tip in the smallest units of the currency
Returns:
PaymentResult
Raises:
telegram.Error
ID = 'sendPaymentForm'
static read(q: dict, *args) → pytglib.api.functions.send_payment_form.SendPaymentForm

pytglib.api.functions.send_phone_number_confirmation_code module

class pytglib.api.functions.send_phone_number_confirmation_code.SendPhoneNumberConfirmationCode(hash, phone_number, settings, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends phone number confirmation code to handle links of the type internalLinkTypePhoneNumberConfirmation

Attributes:
ID (str): SendPhoneNumberConfirmationCode
Args:
hash (str):
Hash value from the link
phone_number (str):
Phone number value from the link
settings (telegram.api.types.phoneNumberAuthenticationSettings):
Settings for the authentication of the user’s phone number; pass null to use default settings
Returns:
AuthenticationCodeInfo
Raises:
telegram.Error
ID = 'sendPhoneNumberConfirmationCode'
static read(q: dict, *args) → pytglib.api.functions.send_phone_number_confirmation_code.SendPhoneNumberConfirmationCode

pytglib.api.functions.send_phone_number_verification_code module

class pytglib.api.functions.send_phone_number_verification_code.SendPhoneNumberVerificationCode(phone_number, settings, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends a code to verify a phone number to be added to a user’s Telegram Passport

Attributes:
ID (str): SendPhoneNumberVerificationCode
Args:
phone_number (str):
The phone number of the user, in international format
settings (telegram.api.types.phoneNumberAuthenticationSettings):
Settings for the authentication of the user’s phone number; pass null to use default settings
Returns:
AuthenticationCodeInfo
Raises:
telegram.Error
ID = 'sendPhoneNumberVerificationCode'
static read(q: dict, *args) → pytglib.api.functions.send_phone_number_verification_code.SendPhoneNumberVerificationCode

pytglib.api.functions.set_account_ttl module

class pytglib.api.functions.set_account_ttl.SetAccountTtl(ttl, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SetAccountTtl
Args:
ttl (telegram.api.types.accountTtl):
New account TTL
Returns:
Ok
Raises:
telegram.Error
ID = 'setAccountTtl'
static read(q: dict, *args) → pytglib.api.functions.set_account_ttl.SetAccountTtl

pytglib.api.functions.set_alarm module

class pytglib.api.functions.set_alarm.SetAlarm(seconds, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Succeeds after a specified amount of time has passed. Can be called before initialization

Attributes:
ID (str): SetAlarm
Args:
seconds (float):
Number of seconds before the function returns
Returns:
Ok
Raises:
telegram.Error
ID = 'setAlarm'
static read(q: dict, *args) → pytglib.api.functions.set_alarm.SetAlarm

pytglib.api.functions.set_authentication_phone_number module

class pytglib.api.functions.set_authentication_phone_number.SetAuthenticationPhoneNumber(phone_number, settings, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SetAuthenticationPhoneNumber
Args:
phone_number (str):
The phone number of the user, in international format
settings (telegram.api.types.phoneNumberAuthenticationSettings):
Settings for the authentication of the user’s phone number; pass null to use default settings
Returns:
Ok
Raises:
telegram.Error
ID = 'setAuthenticationPhoneNumber'
static read(q: dict, *args) → pytglib.api.functions.set_authentication_phone_number.SetAuthenticationPhoneNumber

pytglib.api.functions.set_auto_download_settings module

class pytglib.api.functions.set_auto_download_settings.SetAutoDownloadSettings(settings, type, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sets auto-download settings

Attributes:
ID (str): SetAutoDownloadSettings
Args:
settings (telegram.api.types.autoDownloadSettings):
New user auto-download settings
type (telegram.api.types.NetworkType):
Type of the network for which the new settings are relevant
Returns:
Ok
Raises:
telegram.Error
ID = 'setAutoDownloadSettings'
static read(q: dict, *args) → pytglib.api.functions.set_auto_download_settings.SetAutoDownloadSettings

pytglib.api.functions.set_background module

class pytglib.api.functions.set_background.SetBackground(background, type, for_dark_theme, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the background selected by the user; adds background to the list of installed backgrounds

Attributes:
ID (str): SetBackground
Args:
background (telegram.api.types.InputBackground):
The input background to use; pass null to create a new filled backgrounds or to remove the current background
type (telegram.api.types.BackgroundType):
Background type; pass null to use the default type of the remote background or to remove the current background
for_dark_theme (bool):
Pass true if the background is changed for a dark theme
Returns:
Background
Raises:
telegram.Error
ID = 'setBackground'
static read(q: dict, *args) → pytglib.api.functions.set_background.SetBackground

pytglib.api.functions.set_bio module

class pytglib.api.functions.set_bio.SetBio(bio, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the bio of the current user

Attributes:
ID (str): SetBio
Args:
bio (str):
The new value of the user bio; 0-GetOption(“bio_length_max”) characters without line feeds
Returns:
Ok
Raises:
telegram.Error
ID = 'setBio'
static read(q: dict, *args) → pytglib.api.functions.set_bio.SetBio

pytglib.api.functions.set_bot_updates_status module

class pytglib.api.functions.set_bot_updates_status.SetBotUpdatesStatus(pending_update_count, error_message, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Informs the server about the number of pending bot updates if they haven’t been processed for a long time; for bots only

Attributes:
ID (str): SetBotUpdatesStatus
Args:
pending_update_count (int):
The number of pending updates
error_message (str):
The last error message
Returns:
Ok
Raises:
telegram.Error
ID = 'setBotUpdatesStatus'
static read(q: dict, *args) → pytglib.api.functions.set_bot_updates_status.SetBotUpdatesStatus

pytglib.api.functions.set_chat_chat_list module

pytglib.api.functions.set_chat_client_data module

class pytglib.api.functions.set_chat_client_data.SetChatClientData(chat_id, client_data, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes application-specific data associated with a chat

Attributes:
ID (str): SetChatClientData
Args:
chat_id (int):
Chat identifier
client_data (str):
New value of client_data
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatClientData'
static read(q: dict, *args) → pytglib.api.functions.set_chat_client_data.SetChatClientData

pytglib.api.functions.set_chat_description module

class pytglib.api.functions.set_chat_description.SetChatDescription(chat_id, description, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right

Attributes:
ID (str): SetChatDescription
Args:
chat_id (int):
Identifier of the chat
description (str):
New chat description; 0-255 characters
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatDescription'
static read(q: dict, *args) → pytglib.api.functions.set_chat_description.SetChatDescription

pytglib.api.functions.set_chat_discussion_group module

class pytglib.api.functions.set_chat_discussion_group.SetChatDiscussionGroup(chat_id, discussion_chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the discussion group of a channel chat; requires can_change_info administrator right in the channel if it is specified

Attributes:
ID (str): SetChatDiscussionGroup
Args:
chat_id (int):
Identifier of the channel chatPass 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 (int):
Identifier of a new channel’s discussion groupUse 0 to remove the discussion groupUse the method getSuitableDiscussionChats to find all suitable groupsBasic group chats must be first upgraded to supergroup chatsIf new chat members don’t have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatDiscussionGroup'
static read(q: dict, *args) → pytglib.api.functions.set_chat_discussion_group.SetChatDiscussionGroup

pytglib.api.functions.set_chat_draft_message module

class pytglib.api.functions.set_chat_draft_message.SetChatDraftMessage(chat_id, message_thread_id, draft_message, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the draft message in a chat

Attributes:
ID (str): SetChatDraftMessage
Args:
chat_id (int):
Chat identifier
message_thread_id (int):
If not 0, a message thread identifier in which the draft was changed
draft_message (telegram.api.types.draftMessage):
New draft message; pass null to remove the draft
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatDraftMessage'
static read(q: dict, *args) → pytglib.api.functions.set_chat_draft_message.SetChatDraftMessage

pytglib.api.functions.set_chat_location module

class pytglib.api.functions.set_chat_location.SetChatLocation(chat_id, location, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SetChatLocation
Args:
chat_id (int):
Chat identifier
location (telegram.api.types.chatLocation):
New location for the chat; must be valid and not null
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatLocation'
static read(q: dict, *args) → pytglib.api.functions.set_chat_location.SetChatLocation

pytglib.api.functions.set_chat_member_status module

class pytglib.api.functions.set_chat_member_status.SetChatMemberStatus(chat_id, member_id, status, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for transferring chat ownership; use transferChatOwnership instead. Use addChatMember or banChatMember if some additional parameters needs to be passed

Attributes:
ID (str): SetChatMemberStatus
Args:
chat_id (int):
Chat identifier
member_id (telegram.api.types.MessageSender):
Member identifierChats can be only banned and unbanned in supergroups and channels
status (telegram.api.types.ChatMemberStatus):
The new status of the member in the chat
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatMemberStatus'
static read(q: dict, *args) → pytglib.api.functions.set_chat_member_status.SetChatMemberStatus

pytglib.api.functions.set_chat_notification_settings module

class pytglib.api.functions.set_chat_notification_settings.SetChatNotificationSettings(chat_id, notification_settings, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can’t be changed

Attributes:
ID (str): SetChatNotificationSettings
Args:
chat_id (int):
Chat identifier
notification_settings (telegram.api.types.chatNotificationSettings):
New notification settings for the chatIf the chat is muted for more than 1 week, it is considered to be muted forever
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatNotificationSettings'
static read(q: dict, *args) → pytglib.api.functions.set_chat_notification_settings.SetChatNotificationSettings

pytglib.api.functions.set_chat_permissions module

class pytglib.api.functions.set_chat_permissions.SetChatPermissions(chat_id, permissions, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right

Attributes:
ID (str): SetChatPermissions
Args:
chat_id (int):
Chat identifier
permissions (telegram.api.types.chatPermissions):
New non-administrator members permissions in the chat
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatPermissions'
static read(q: dict, *args) → pytglib.api.functions.set_chat_permissions.SetChatPermissions

pytglib.api.functions.set_chat_photo module

class pytglib.api.functions.set_chat_photo.SetChatPhoto(chat_id, photo, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right

Attributes:
ID (str): SetChatPhoto
Args:
chat_id (int):
Chat identifier
photo (telegram.api.types.InputChatPhoto):
New chat photo; pass null to delete the chat photo
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatPhoto'
static read(q: dict, *args) → pytglib.api.functions.set_chat_photo.SetChatPhoto

pytglib.api.functions.set_chat_slow_mode_delay module

class pytglib.api.functions.set_chat_slow_mode_delay.SetChatSlowModeDelay(chat_id, slow_mode_delay, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members rights

Attributes:
ID (str): SetChatSlowModeDelay
Args:
chat_id (int):
Chat identifier
slow_mode_delay (int):
New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatSlowModeDelay'
static read(q: dict, *args) → pytglib.api.functions.set_chat_slow_mode_delay.SetChatSlowModeDelay

pytglib.api.functions.set_chat_title module

class pytglib.api.functions.set_chat_title.SetChatTitle(chat_id, title, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right

Attributes:
ID (str): SetChatTitle
Args:
chat_id (int):
Chat identifier
title (str):
New title of the chat; 1-128 characters
Returns:
Ok
Raises:
telegram.Error
ID = 'setChatTitle'
static read(q: dict, *args) → pytglib.api.functions.set_chat_title.SetChatTitle

pytglib.api.functions.set_commands module

class pytglib.api.functions.set_commands.SetCommands(scope, language_code, commands, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sets the list of commands supported by the bot for the given user scope and language; for bots only

Attributes:
ID (str): SetCommands
Args:
scope (telegram.api.types.BotCommandScope):
The scope to which the commands are relevant; pass null to change commands in the default bot command scope
language_code (str):
A two-letter ISO 639-1 language codeIf empty, the commands will be applied to all users from the given scope, for which language there are no dedicated commands
commands (List of telegram.api.types.botCommand):
List of the bot’s commands
Returns:
Ok
Raises:
telegram.Error
ID = 'setCommands'
static read(q: dict, *args) → pytglib.api.functions.set_commands.SetCommands

pytglib.api.functions.set_custom_language_pack module

class pytglib.api.functions.set_custom_language_pack.SetCustomLanguagePack(info, strings, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Adds or changes a custom local language pack to the current localization target

Attributes:
ID (str): SetCustomLanguagePack
Args:
info (telegram.api.types.languagePackInfo):
Information about the language packLanguage pack ID must start with ‘X’, consist only of English letters, digits and hyphens, and must not exceed 64 charactersCan be called before authorization
strings (List of telegram.api.types.languagePackString):
Strings of the new language pack
Returns:
Ok
Raises:
telegram.Error
ID = 'setCustomLanguagePack'
static read(q: dict, *args) → pytglib.api.functions.set_custom_language_pack.SetCustomLanguagePack

pytglib.api.functions.set_custom_language_pack_string module

class pytglib.api.functions.set_custom_language_pack_string.SetCustomLanguagePackString(language_pack_id, new_string, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Adds, edits or deletes a string in a custom local language pack. Can be called before authorization

Attributes:
ID (str): SetCustomLanguagePackString
Args:
language_pack_id (str):
Identifier of a previously added custom local language pack in the current localization target
new_string (telegram.api.types.languagePackString):
New language pack string
Returns:
Ok
Raises:
telegram.Error
ID = 'setCustomLanguagePackString'
static read(q: dict, *args) → pytglib.api.functions.set_custom_language_pack_string.SetCustomLanguagePackString

pytglib.api.functions.set_database_encryption_key module

class pytglib.api.functions.set_database_encryption_key.SetDatabaseEncryptionKey(new_encryption_key, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the database encryption key. Usually the encryption key is never changed and is stored in some OS keychain

Attributes:
ID (str): SetDatabaseEncryptionKey
Args:
new_encryption_key (bytes):
New encryption key
Returns:
Ok
Raises:
telegram.Error
ID = 'setDatabaseEncryptionKey'
static read(q: dict, *args) → pytglib.api.functions.set_database_encryption_key.SetDatabaseEncryptionKey

pytglib.api.functions.set_file_generation_progress module

class pytglib.api.functions.set_file_generation_progress.SetFileGenerationProgress(generation_id, expected_size, local_prefix_size, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Informs TDLib on a file generation progress

Attributes:
ID (str): SetFileGenerationProgress
Args:
generation_id (int):
The identifier of the generation process
expected_size (int):
Expected size of the generated file, in bytes; 0 if unknown
local_prefix_size (int):
The number of bytes already generated
Returns:
Ok
Raises:
telegram.Error
ID = 'setFileGenerationProgress'
static read(q: dict, *args) → pytglib.api.functions.set_file_generation_progress.SetFileGenerationProgress

pytglib.api.functions.set_game_score module

class pytglib.api.functions.set_game_score.SetGameScore(chat_id, message_id, edit_message, user_id, score, force, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Updates the game score of the specified user in the game; for bots only

Attributes:
ID (str): SetGameScore
Args:
chat_id (int):
The chat to which the message with the game belongs
message_id (int):
Identifier of the message
edit_message (bool):
Pass true to edit the game message to include the current scoreboard
user_id (int):
User identifier
score (int):
The new score
force (bool):
Pass true to update the score even if it decreasesIf the score is 0, the user will be deleted from the high score table
Returns:
Message
Raises:
telegram.Error
ID = 'setGameScore'
static read(q: dict, *args) → pytglib.api.functions.set_game_score.SetGameScore

pytglib.api.functions.set_inline_game_score module

class pytglib.api.functions.set_inline_game_score.SetInlineGameScore(inline_message_id, edit_message, user_id, score, force, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Updates the game score of the specified user in a game; for bots only

Attributes:
ID (str): SetInlineGameScore
Args:
inline_message_id (str):
Inline message identifier
edit_message (bool):
Pass true to edit the game message to include the current scoreboard
user_id (int):
User identifier
score (int):
The new score
force (bool):
Pass true to update the score even if it decreasesIf the score is 0, the user will be deleted from the high score table
Returns:
Ok
Raises:
telegram.Error
ID = 'setInlineGameScore'
static read(q: dict, *args) → pytglib.api.functions.set_inline_game_score.SetInlineGameScore

pytglib.api.functions.set_location module

class pytglib.api.functions.set_location.SetLocation(location, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SetLocation
Args:
location (telegram.api.types.location):
The new location of the user
Returns:
Ok
Raises:
telegram.Error
ID = 'setLocation'
static read(q: dict, *args) → pytglib.api.functions.set_location.SetLocation

pytglib.api.functions.set_log_stream module

class pytglib.api.functions.set_log_stream.SetLogStream(log_stream, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sets new log stream for internal logging of TDLib. Can be called synchronously

Attributes:
ID (str): SetLogStream
Args:
log_stream (telegram.api.types.LogStream):
New log stream
Returns:
Ok
Raises:
telegram.Error
ID = 'setLogStream'
static read(q: dict, *args) → pytglib.api.functions.set_log_stream.SetLogStream

pytglib.api.functions.set_log_tag_verbosity_level module

class pytglib.api.functions.set_log_tag_verbosity_level.SetLogTagVerbosityLevel(tag, new_verbosity_level, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sets the verbosity level for a specified TDLib internal log tag. Can be called synchronously

Attributes:
ID (str): SetLogTagVerbosityLevel
Args:
tag (str):
Logging tag to change verbosity level
new_verbosity_level (int):
New verbosity level; 1-1024
Returns:
Ok
Raises:
telegram.Error
ID = 'setLogTagVerbosityLevel'
static read(q: dict, *args) → pytglib.api.functions.set_log_tag_verbosity_level.SetLogTagVerbosityLevel

pytglib.api.functions.set_log_verbosity_level module

class pytglib.api.functions.set_log_verbosity_level.SetLogVerbosityLevel(new_verbosity_level, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SetLogVerbosityLevel
Args:
new_verbosity_level (int):
New value of the verbosity level for loggingValue 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:
Ok
Raises:
telegram.Error
ID = 'setLogVerbosityLevel'
static read(q: dict, *args) → pytglib.api.functions.set_log_verbosity_level.SetLogVerbosityLevel

pytglib.api.functions.set_name module

class pytglib.api.functions.set_name.SetName(first_name, last_name, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the first and last name of the current user

Attributes:
ID (str): SetName
Args:
first_name (str):
The new value of the first name for the current user; 1-64 characters
last_name (str):
The new value of the optional last name for the current user; 0-64 characters
Returns:
Ok
Raises:
telegram.Error
ID = 'setName'
static read(q: dict, *args) → pytglib.api.functions.set_name.SetName

pytglib.api.functions.set_network_type module

class pytglib.api.functions.set_network_type.SetNetworkType(type, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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 must 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

Attributes:
ID (str): SetNetworkType
Args:
type (telegram.api.types.NetworkType):
The new network type; pass null to set network type to networkTypeOther
Returns:
Ok
Raises:
telegram.Error
ID = 'setNetworkType'
static read(q: dict, *args) → pytglib.api.functions.set_network_type.SetNetworkType

pytglib.api.functions.set_option module

class pytglib.api.functions.set_option.SetOption(name, value, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sets the value of an option. (Check the list of available options on https://core.telegram.org/tdlib/options.) Only writable options can be set. Can be called before authorization

Attributes:
ID (str): SetOption
Args:
name (str):
The name of the option
value (telegram.api.types.OptionValue):
The new value of the option; pass null to reset option value to a default value
Returns:
Ok
Raises:
telegram.Error
ID = 'setOption'
static read(q: dict, *args) → pytglib.api.functions.set_option.SetOption

pytglib.api.functions.set_passport_element module

class pytglib.api.functions.set_passport_element.SetPassportElement(element, password, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SetPassportElement
Args:
element (telegram.api.types.InputPassportElement):
Input Telegram Passport element
password (str):
Password of the current user
Returns:
PassportElement
Raises:
telegram.Error
ID = 'setPassportElement'
static read(q: dict, *args) → pytglib.api.functions.set_passport_element.SetPassportElement

pytglib.api.functions.set_passport_element_errors module

class pytglib.api.functions.set_passport_element_errors.SetPassportElementErrors(user_id, errors, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SetPassportElementErrors
Args:
user_id (int):
User identifier
errors (List of telegram.api.types.inputPassportElementError):
The errors
Returns:
Ok
Raises:
telegram.Error
ID = 'setPassportElementErrors'
static read(q: dict, *args) → pytglib.api.functions.set_passport_element_errors.SetPassportElementErrors

pytglib.api.functions.set_password module

class pytglib.api.functions.set_password.SetPassword(old_password, new_password, new_hint, set_recovery_email_address, new_recovery_email_address, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the password for the current user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed

Attributes:
ID (str): SetPassword
Args:
old_password (str):
Previous password of the user
new_password (str):
New password of the user; may be empty to remove the password
new_hint (str):
New password hint; may be empty
set_recovery_email_address (bool):
Pass true to change also the recovery email address
new_recovery_email_address (str):
New recovery email address; may be empty
Returns:
PasswordState
Raises:
telegram.Error
ID = 'setPassword'
static read(q: dict, *args) → pytglib.api.functions.set_password.SetPassword

pytglib.api.functions.set_pinned_chats module

class pytglib.api.functions.set_pinned_chats.SetPinnedChats(chat_list, chat_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the order of pinned chats

Attributes:
ID (str): SetPinnedChats
Args:
chat_list (telegram.api.types.ChatList):
Chat list in which to change the order of pinned chats
chat_ids (List of int):
The new list of pinned chats
Returns:
Ok
Raises:
telegram.Error
ID = 'setPinnedChats'
static read(q: dict, *args) → pytglib.api.functions.set_pinned_chats.SetPinnedChats

pytglib.api.functions.set_poll_answer module

class pytglib.api.functions.set_poll_answer.SetPollAnswer(chat_id, message_id, option_ids, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the user answer to a poll. A poll in quiz mode can be answered only once

Attributes:
ID (str): SetPollAnswer
Args:
chat_id (int):
Identifier of the chat to which the poll belongs
message_id (int):
Identifier of the message containing the poll
option_ids (List of int):
0-based identifiers of answer options, chosen by the userUser can choose more than 1 answer option only is the poll allows multiple answers
Returns:
Ok
Raises:
telegram.Error
ID = 'setPollAnswer'
static read(q: dict, *args) → pytglib.api.functions.set_poll_answer.SetPollAnswer

pytglib.api.functions.set_profile_photo module

class pytglib.api.functions.set_profile_photo.SetProfilePhoto(photo, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes a profile photo for the current user

Attributes:
ID (str): SetProfilePhoto
Args:
photo (telegram.api.types.InputChatPhoto):
Profile photo to set
Returns:
Ok
Raises:
telegram.Error
ID = 'setProfilePhoto'
static read(q: dict, *args) → pytglib.api.functions.set_profile_photo.SetProfilePhoto

pytglib.api.functions.set_recovery_email_address module

class pytglib.api.functions.set_recovery_email_address.SetRecoveryEmailAddress(password, new_recovery_email_address, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SetRecoveryEmailAddress
Args:
password (str):
Password of the current user
new_recovery_email_address (str):
New recovery email address
Returns:
PasswordState
Raises:
telegram.Error
ID = 'setRecoveryEmailAddress'
static read(q: dict, *args) → pytglib.api.functions.set_recovery_email_address.SetRecoveryEmailAddress

pytglib.api.functions.set_scope_notification_settings module

class pytglib.api.functions.set_scope_notification_settings.SetScopeNotificationSettings(scope, notification_settings, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes notification settings for chats of a given type

Attributes:
ID (str): SetScopeNotificationSettings
Args:
scope (telegram.api.types.NotificationSettingsScope):
Types of chats for which to change the notification settings
notification_settings (telegram.api.types.scopeNotificationSettings):
The new notification settings for the given scope
Returns:
Ok
Raises:
telegram.Error
ID = 'setScopeNotificationSettings'
static read(q: dict, *args) → pytglib.api.functions.set_scope_notification_settings.SetScopeNotificationSettings

pytglib.api.functions.set_sticker_position_in_set module

class pytglib.api.functions.set_sticker_position_in_set.SetStickerPositionInSet(sticker, position, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): SetStickerPositionInSet
Args:
sticker (telegram.api.types.InputFile):
Sticker
position (int):
New position of the sticker in the set, 0-based
Returns:
Ok
Raises:
telegram.Error
ID = 'setStickerPositionInSet'
static read(q: dict, *args) → pytglib.api.functions.set_sticker_position_in_set.SetStickerPositionInSet

pytglib.api.functions.set_sticker_set_thumbnail module

class pytglib.api.functions.set_sticker_set_thumbnail.SetStickerSetThumbnail(user_id, name, thumbnail, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sets a sticker set thumbnail; for bots only. Returns the sticker set

Attributes:
ID (str): SetStickerSetThumbnail
Args:
user_id (int):
Sticker set owner
name (str):
Sticker set name
thumbnail (telegram.api.types.InputFile):
Thumbnail to set in PNG, TGS, or WEBM format; pass null to remove the sticker set thumbnailThumbnail format must match the format of stickers in the set
Returns:
StickerSet
Raises:
telegram.Error
ID = 'setStickerSetThumbnail'
static read(q: dict, *args) → pytglib.api.functions.set_sticker_set_thumbnail.SetStickerSetThumbnail

pytglib.api.functions.set_supergroup_sticker_set module

class pytglib.api.functions.set_supergroup_sticker_set.SetSupergroupStickerSet(supergroup_id, sticker_set_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the sticker set of a supergroup; requires can_change_info administrator right

Attributes:
ID (str): SetSupergroupStickerSet
Args:
supergroup_id (int):
Identifier of the supergroup
sticker_set_id (int):
New value of the supergroup sticker set identifierUse 0 to remove the supergroup sticker set
Returns:
Ok
Raises:
telegram.Error
ID = 'setSupergroupStickerSet'
static read(q: dict, *args) → pytglib.api.functions.set_supergroup_sticker_set.SetSupergroupStickerSet

pytglib.api.functions.set_supergroup_username module

class pytglib.api.functions.set_supergroup_username.SetSupergroupUsername(supergroup_id, username, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel

Attributes:
ID (str): SetSupergroupUsername
Args:
supergroup_id (int):
Identifier of the supergroup or channel
username (str):
New value of the usernameUse an empty string to remove the username
Returns:
Ok
Raises:
telegram.Error
ID = 'setSupergroupUsername'
static read(q: dict, *args) → pytglib.api.functions.set_supergroup_username.SetSupergroupUsername

pytglib.api.functions.set_tdlib_parameters module

class pytglib.api.functions.set_tdlib_parameters.SetTdlibParameters(parameters, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters

Attributes:
ID (str): SetTdlibParameters
Args:
parameters (telegram.api.types.tdlibParameters):
Parameters for TDLib initialization
Returns:
Ok
Raises:
telegram.Error
ID = 'setTdlibParameters'
static read(q: dict, *args) → pytglib.api.functions.set_tdlib_parameters.SetTdlibParameters

pytglib.api.functions.set_user_privacy_setting_rules module

class pytglib.api.functions.set_user_privacy_setting_rules.SetUserPrivacySettingRules(setting, rules, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes user privacy settings

Attributes:
ID (str): SetUserPrivacySettingRules
Args:
setting (telegram.api.types.UserPrivacySetting):
The privacy setting
rules (telegram.api.types.userPrivacySettingRules):
The new privacy rules
Returns:
Ok
Raises:
telegram.Error
ID = 'setUserPrivacySettingRules'
static read(q: dict, *args) → pytglib.api.functions.set_user_privacy_setting_rules.SetUserPrivacySettingRules

pytglib.api.functions.set_username module

class pytglib.api.functions.set_username.SetUsername(username, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the username of the current user

Attributes:
ID (str): SetUsername
Args:
username (str):
The new value of the usernameUse an empty string to remove the username
Returns:
Ok
Raises:
telegram.Error
ID = 'setUsername'
static read(q: dict, *args) → pytglib.api.functions.set_username.SetUsername

pytglib.api.functions.share_phone_number module

class pytglib.api.functions.share_phone_number.SharePhoneNumber(user_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Shares the phone number of the current user with a mutual contact. Supposed to be called when the user clicks on chatActionBarSharePhoneNumber

Attributes:
ID (str): SharePhoneNumber
Args:
user_id (int):
Identifier of the user with whom to share the phone numberThe user must be a mutual contact
Returns:
Ok
Raises:
telegram.Error
ID = 'sharePhoneNumber'
static read(q: dict, *args) → pytglib.api.functions.share_phone_number.SharePhoneNumber

pytglib.api.functions.stop_poll module

class pytglib.api.functions.stop_poll.StopPoll(chat_id, message_id, reply_markup, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set

Attributes:
ID (str): StopPoll
Args:
chat_id (int):
Identifier of the chat to which the poll belongs
message_id (int):
Identifier of the message containing the poll
reply_markup (telegram.api.types.ReplyMarkup):
The new message reply markup; pass null if none; for bots only
Returns:
Ok
Raises:
telegram.Error
ID = 'stopPoll'
static read(q: dict, *args) → pytglib.api.functions.stop_poll.StopPoll

pytglib.api.functions.synchronize_language_pack module

class pytglib.api.functions.synchronize_language_pack.SynchronizeLanguagePack(language_pack_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Fetches the latest versions of all strings from a language pack in the current localization target from the server. This method doesn’t need to be called explicitly for the current used/base language packs. Can be called before authorization

Attributes:
ID (str): SynchronizeLanguagePack
Args:
language_pack_id (str):
Language pack identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'synchronizeLanguagePack'
static read(q: dict, *args) → pytglib.api.functions.synchronize_language_pack.SynchronizeLanguagePack

pytglib.api.functions.terminate_all_other_sessions module

class pytglib.api.functions.terminate_all_other_sessions.TerminateAllOtherSessions(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Terminates all other sessions of the current user

Attributes:
ID (str): TerminateAllOtherSessions

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'terminateAllOtherSessions'
static read(q: dict, *args) → pytglib.api.functions.terminate_all_other_sessions.TerminateAllOtherSessions

pytglib.api.functions.terminate_session module

class pytglib.api.functions.terminate_session.TerminateSession(session_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Terminates a session of the current user

Attributes:
ID (str): TerminateSession
Args:
session_id (int):
Session identifier
Returns:
Ok
Raises:
telegram.Error
ID = 'terminateSession'
static read(q: dict, *args) → pytglib.api.functions.terminate_session.TerminateSession

pytglib.api.functions.test_call_bytes module

class pytglib.api.functions.test_call_bytes.TestCallBytes(x, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the received bytes; for testing only. This is an offline method. Can be called before authorization

Attributes:
ID (str): TestCallBytes
Args:
x (bytes):
Bytes to return
Returns:
TestBytes
Raises:
telegram.Error
ID = 'testCallBytes'
static read(q: dict, *args) → pytglib.api.functions.test_call_bytes.TestCallBytes

pytglib.api.functions.test_call_empty module

class pytglib.api.functions.test_call_empty.TestCallEmpty(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Does nothing; for testing only. This is an offline method. Can be called before authorization

Attributes:
ID (str): TestCallEmpty

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'testCallEmpty'
static read(q: dict, *args) → pytglib.api.functions.test_call_empty.TestCallEmpty

pytglib.api.functions.test_call_string module

class pytglib.api.functions.test_call_string.TestCallString(x, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the received string; for testing only. This is an offline method. Can be called before authorization

Attributes:
ID (str): TestCallString
Args:
x (str):
String to return
Returns:
TestString
Raises:
telegram.Error
ID = 'testCallString'
static read(q: dict, *args) → pytglib.api.functions.test_call_string.TestCallString

pytglib.api.functions.test_call_vector_int module

class pytglib.api.functions.test_call_vector_int.TestCallVectorInt(x, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the received vector of numbers; for testing only. This is an offline method. Can be called before authorization

Attributes:
ID (str): TestCallVectorInt
Args:
x (List of int):
Vector of numbers to return
Returns:
TestVectorInt
Raises:
telegram.Error
ID = 'testCallVectorInt'
static read(q: dict, *args) → pytglib.api.functions.test_call_vector_int.TestCallVectorInt

pytglib.api.functions.test_call_vector_int_object module

class pytglib.api.functions.test_call_vector_int_object.TestCallVectorIntObject(x, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the received vector of objects containing a number; for testing only. This is an offline method. Can be called before authorization

Attributes:
ID (str): TestCallVectorIntObject
Args:
x (List of telegram.api.types.testInt):
Vector of objects to return
Returns:
TestVectorIntObject
Raises:
telegram.Error
ID = 'testCallVectorIntObject'
static read(q: dict, *args) → pytglib.api.functions.test_call_vector_int_object.TestCallVectorIntObject

pytglib.api.functions.test_call_vector_string module

class pytglib.api.functions.test_call_vector_string.TestCallVectorString(x, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the received vector of strings; for testing only. This is an offline method. Can be called before authorization

Attributes:
ID (str): TestCallVectorString
Args:
x (List of str):
Vector of strings to return
Returns:
TestVectorString
Raises:
telegram.Error
ID = 'testCallVectorString'
static read(q: dict, *args) → pytglib.api.functions.test_call_vector_string.TestCallVectorString

pytglib.api.functions.test_call_vector_string_object module

class pytglib.api.functions.test_call_vector_string_object.TestCallVectorStringObject(x, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the received vector of objects containing a string; for testing only. This is an offline method. Can be called before authorization

Attributes:
ID (str): TestCallVectorStringObject
Args:
x (List of telegram.api.types.testString):
Vector of objects to return
Returns:
TestVectorStringObject
Raises:
telegram.Error
ID = 'testCallVectorStringObject'
static read(q: dict, *args) → pytglib.api.functions.test_call_vector_string_object.TestCallVectorStringObject

pytglib.api.functions.test_get_difference module

class pytglib.api.functions.test_get_difference.TestGetDifference(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Forces an updates.getDifference call to the Telegram servers; for testing only

Attributes:
ID (str): TestGetDifference

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'testGetDifference'
static read(q: dict, *args) → pytglib.api.functions.test_get_difference.TestGetDifference

pytglib.api.functions.test_network module

class pytglib.api.functions.test_network.TestNetwork(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization

Attributes:
ID (str): TestNetwork

No parameters required.

Returns:
Ok
Raises:
telegram.Error
ID = 'testNetwork'
static read(q: dict, *args) → pytglib.api.functions.test_network.TestNetwork

pytglib.api.functions.test_proxy module

class pytglib.api.functions.test_proxy.TestProxy(server, port, type, dc_id, timeout, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization

Attributes:
ID (str): TestProxy
Args:
server (str):
Proxy server IP address
port (int):
Proxy server port
type (telegram.api.types.ProxyType):
Proxy type
dc_id (int):
Identifier of a datacenter with which to test connection
timeout (float):
The maximum overall timeout for the request
Returns:
Ok
Raises:
telegram.Error
ID = 'testProxy'
static read(q: dict, *args) → pytglib.api.functions.test_proxy.TestProxy

pytglib.api.functions.test_return_error module

class pytglib.api.functions.test_return_error.TestReturnError(error, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the specified error and ensures that the Error object is used; for testing only. Can be called synchronously

Attributes:
ID (str): TestReturnError
Args:
error (telegram.api.types.error):
The error to be returned
Returns:
Error
Raises:
telegram.Error
ID = 'testReturnError'
static read(q: dict, *args) → pytglib.api.functions.test_return_error.TestReturnError

pytglib.api.functions.test_square_int module

class pytglib.api.functions.test_square_int.TestSquareInt(x, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Returns the squared received number; for testing only. This is an offline method. Can be called before authorization

Attributes:
ID (str): TestSquareInt
Args:
x (int):
Number to square
Returns:
TestInt
Raises:
telegram.Error
ID = 'testSquareInt'
static read(q: dict, *args) → pytglib.api.functions.test_square_int.TestSquareInt

pytglib.api.functions.test_use_update module

class pytglib.api.functions.test_use_update.TestUseUpdate(extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization

Attributes:
ID (str): TestUseUpdate

No parameters required.

Returns:
Update
Raises:
telegram.Error
ID = 'testUseUpdate'
static read(q: dict, *args) → pytglib.api.functions.test_use_update.TestUseUpdate

pytglib.api.functions.toggle_chat_default_disable_notification module

class pytglib.api.functions.toggle_chat_default_disable_notification.ToggleChatDefaultDisableNotification(chat_id, default_disable_notification, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the value of the default disable_notification parameter, used when a message is sent to a chat

Attributes:
ID (str): ToggleChatDefaultDisableNotification
Args:
chat_id (int):
Chat identifier
default_disable_notification (bool):
New value of default_disable_notification
Returns:
Ok
Raises:
telegram.Error
ID = 'toggleChatDefaultDisableNotification'
static read(q: dict, *args) → pytglib.api.functions.toggle_chat_default_disable_notification.ToggleChatDefaultDisableNotification

pytglib.api.functions.toggle_chat_is_marked_as_unread module

class pytglib.api.functions.toggle_chat_is_marked_as_unread.ToggleChatIsMarkedAsUnread(chat_id, is_marked_as_unread, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Changes the marked as unread state of a chat

Attributes:
ID (str): ToggleChatIsMarkedAsUnread
Args:
chat_id (int):
Chat identifier
is_marked_as_unread (bool):
New value of is_marked_as_unread
Returns:
Ok
Raises:
telegram.Error
ID = 'toggleChatIsMarkedAsUnread'
static read(q: dict, *args) → pytglib.api.functions.toggle_chat_is_marked_as_unread.ToggleChatIsMarkedAsUnread

pytglib.api.functions.toggle_chat_is_pinned module

class pytglib.api.functions.toggle_chat_is_pinned.ToggleChatIsPinned(chat_list, chat_id, is_pinned, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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/archive chat list. The limit can be increased with Telegram Premium

Attributes:
ID (str): ToggleChatIsPinned
Args:
chat_list (telegram.api.types.ChatList):
Chat list in which to change the pinned state of the chat
chat_id (int):
Chat identifier
is_pinned (bool):
Pass true to pin the chat; pass false to unpin it
Returns:
Ok
Raises:
telegram.Error
ID = 'toggleChatIsPinned'
static read(q: dict, *args) → pytglib.api.functions.toggle_chat_is_pinned.ToggleChatIsPinned

pytglib.api.functions.toggle_supergroup_is_all_history_available module

class pytglib.api.functions.toggle_supergroup_is_all_history_available.ToggleSupergroupIsAllHistoryAvailable(supergroup_id, is_all_history_available, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Toggles whether the message history of a supergroup is available to new members; requires can_change_info administrator right

Attributes:
ID (str): ToggleSupergroupIsAllHistoryAvailable
Args:
supergroup_id (int):
The identifier of the supergroup
is_all_history_available (bool):
The new value of is_all_history_available
Returns:
Ok
Raises:
telegram.Error
ID = 'toggleSupergroupIsAllHistoryAvailable'
static read(q: dict, *args) → pytglib.api.functions.toggle_supergroup_is_all_history_available.ToggleSupergroupIsAllHistoryAvailable

pytglib.api.functions.toggle_supergroup_sign_messages module

class pytglib.api.functions.toggle_supergroup_sign_messages.ToggleSupergroupSignMessages(supergroup_id, sign_messages, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Toggles whether sender signature is added to sent messages in a channel; requires can_change_info administrator right

Attributes:
ID (str): ToggleSupergroupSignMessages
Args:
supergroup_id (int):
Identifier of the channel
sign_messages (bool):
New value of sign_messages
Returns:
Ok
Raises:
telegram.Error
ID = 'toggleSupergroupSignMessages'
static read(q: dict, *args) → pytglib.api.functions.toggle_supergroup_sign_messages.ToggleSupergroupSignMessages

pytglib.api.functions.transfer_chat_ownership module

class pytglib.api.functions.transfer_chat_ownership.TransferChatOwnership(chat_id, user_id, password, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): TransferChatOwnership
Args:
chat_id (int):
Chat identifier
user_id (int):
Identifier of the user to which transfer the ownershipThe ownership can’t be transferred to a bot or to a deleted user
password (str):
The password of the current user
Returns:
Ok
Raises:
telegram.Error
ID = 'transferChatOwnership'
static read(q: dict, *args) → pytglib.api.functions.transfer_chat_ownership.TransferChatOwnership

pytglib.api.functions.unblock_user module

pytglib.api.functions.unpin_chat_message module

class pytglib.api.functions.unpin_chat_message.UnpinChatMessage(chat_id, message_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Removes a pinned message from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel

Attributes:
ID (str): UnpinChatMessage
Args:
chat_id (int):
Identifier of the chat
message_id (int):
Identifier of the removed pinned message
Returns:
Ok
Raises:
telegram.Error
ID = 'unpinChatMessage'
static read(q: dict, *args) → pytglib.api.functions.unpin_chat_message.UnpinChatMessage

pytglib.api.functions.upgrade_basic_group_chat_to_supergroup_chat module

class pytglib.api.functions.upgrade_basic_group_chat_to_supergroup_chat.UpgradeBasicGroupChatToSupergroupChat(chat_id, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group

Attributes:
ID (str): UpgradeBasicGroupChatToSupergroupChat
Args:
chat_id (int):
Identifier of the chat to upgrade
Returns:
Chat
Raises:
telegram.Error
ID = 'upgradeBasicGroupChatToSupergroupChat'
static read(q: dict, *args) → pytglib.api.functions.upgrade_basic_group_chat_to_supergroup_chat.UpgradeBasicGroupChatToSupergroupChat

pytglib.api.functions.upload_file module

class pytglib.api.functions.upload_file.UploadFile(file, file_type, priority, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): UploadFile
Args:
file (telegram.api.types.InputFile):
File to upload
file_type (telegram.api.types.FileType):
File type; pass null if unknown
priority (int):
Priority of the upload (1-32)The higher the priority, the earlier the file will be uploadedIf the priorities of two files are equal, then the first one for which uploadFile was called will be uploaded first
Returns:
File
Raises:
telegram.Error
ID = 'uploadFile'
static read(q: dict, *args) → pytglib.api.functions.upload_file.UploadFile

pytglib.api.functions.upload_sticker_file module

class pytglib.api.functions.upload_sticker_file.UploadStickerFile(user_id, sticker, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Uploads a file with a sticker; returns the uploaded file

Attributes:
ID (str): UploadStickerFile
Args:
user_id (int):
Sticker file owner; ignored for regular users
sticker (telegram.api.types.inputSticker):
Sticker file to upload
Returns:
File
Raises:
telegram.Error
ID = 'uploadStickerFile'
static read(q: dict, *args) → pytglib.api.functions.upload_sticker_file.UploadStickerFile

pytglib.api.functions.validate_order_info module

class pytglib.api.functions.validate_order_info.ValidateOrderInfo(input_invoice, order_info, allow_save, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Validates the order information provided by a user and returns the available shipping options for a flexible invoice

Attributes:
ID (str): ValidateOrderInfo
Args:
input_invoice (telegram.api.types.InputInvoice):
The invoice
order_info (telegram.api.types.orderInfo):
The order information, provided by the user; pass null if empty
allow_save (bool):
Pass true to save the order information
Returns:
ValidatedOrderInfo
Raises:
telegram.Error
ID = 'validateOrderInfo'
static read(q: dict, *args) → pytglib.api.functions.validate_order_info.ValidateOrderInfo

pytglib.api.functions.view_messages module

class pytglib.api.functions.view_messages.ViewMessages(chat_id, message_thread_id, message_ids, force_read, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

Informs TDLib that messages are being viewed by the user. Sponsored messages must be marked as viewed only when the entire text of the message is shown on the screen (excluding the button). 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)

Attributes:
ID (str): ViewMessages
Args:
chat_id (int):
Chat identifier
message_thread_id (int):
If not 0, a message thread identifier in which the messages are being viewed
message_ids (List of int):
The identifiers of the messages being viewed
force_read (bool):
Pass true to mark as read the specified messages even the chat is closed
Returns:
Ok
Raises:
telegram.Error
ID = 'viewMessages'
static read(q: dict, *args) → pytglib.api.functions.view_messages.ViewMessages

pytglib.api.functions.write_generated_file_part module

class pytglib.api.functions.write_generated_file_part.WriteGeneratedFilePart(generation_id, offset, data, extra=None, **kwargs)

Bases: pytglib.api.utils.object.Object

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

Attributes:
ID (str): WriteGeneratedFilePart
Args:
generation_id (int):
The identifier of the generation process
offset (int):
The offset from which to write the data to the file
data (bytes):
The data to write
Returns:
Ok
Raises:
telegram.Error
ID = 'writeGeneratedFilePart'
static read(q: dict, *args) → pytglib.api.functions.write_generated_file_part.WriteGeneratedFilePart

Module contents