slidge.plugins.telegram.client
#
Module Contents#
Classes#
|
|
|
Functions#
|
- slidge.plugins.telegram.client.get_base_kwargs(user_reg_form)[source]#
- Parameters:
user_reg_form (dict) –
- exception slidge.plugins.telegram.client.Timeout(*a, **k)[source]#
Bases:
asyncio.TimeoutError
,slidge.XMPPError
The operation exceeded the given deadline.
Initialize self. See help(type(self)) for accurate signature.
- exception slidge.plugins.telegram.client.BadRequest(base)[source]#
Bases:
aiotdlib.api.BadRequest
,slidge.XMPPError
This is the base exception class for all TDLib API related errors.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
base (aiotdlib.api.BadRequest) –
- exception slidge.plugins.telegram.client.Unauthorized(base)[source]#
Bases:
aiotdlib.api.Unauthorized
,slidge.XMPPError
This is the base exception class for all TDLib API related errors.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
base (aiotdlib.api.Unauthorized) –
- exception slidge.plugins.telegram.client.NotFound(base)[source]#
Bases:
aiotdlib.api.NotFound
,slidge.XMPPError
This is the base exception class for all TDLib API related errors.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
base (aiotdlib.api.NotFound) –
- class slidge.plugins.telegram.client.CredentialsValidation(registration_form)[source]#
Bases:
aiotdlib.Client
- Parameters:
api_id (int) – Application identifier for Telegram API access, which can be obtained at https://my.telegram.org
api_hash (str) – Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org
database_encryption_key (str) – Encryption key of local session database. Default: aiotdlib
phone_number (str Either phone_number or bot_token MUST be passed. ValueError would be raised otherwise) – The phone number of the user, in international format.
bot_token (str) – The bot token. Either phone_number or bot_token MUST be passed. ValueError would be raised otherwise
use_test_dc (bool) – If set to true, the Telegram test environment will be used instead of the production environment
system_language_code (str) – IETF language tag of the user’s operating system language; must be non-empty
device_model (str) – Model of the device the application is being run on; must be non-empty
system_version (str) – Version of the operating system the application is being run on. If empty, the version is automatically detected by TDLib
application_version (str) – Application version; must be non-empty
files_directory (str) – The path to the directory for storing files. Default: .aiotdlib/
first_name (str) – First name of new account if account with passed phone_number does not exist
last_name (str) – Last name of new account if account with passed phone_number does not exist
library_path (str) – Path to TDLib binary. By default, binary included in package is used
tdlib_verbosity (str) – Verbosity level of TDLib itself. Default: 2 (WARNING) for more info look at (TDLibLogVerbosity)
debug (bool) – When set to true all request and responses would be logged in console with DEBUG level
parse_mode (str) – Default parse mode for high-level methods like send_message. Default: html
proxy_settings (ClientProxySettings) – Settings for proxying telegram connection
use_file_database (bool) – If set to true, information about downloaded and uploaded files will be saved between application restarts
use_chat_info_database (bool) – If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies use_file_database
use_message_database (bool) – If set to true, the library will maintain a cache of chats and messages. Implies use_chat_info_database
use_secret_chats (bool) – If set to true, support for secret chats will be enabled
enable_storage_optimizer (bool) – If set to true, old files will automatically be deleted
ignore_file_names (bool) – If set to true, original file names will be ignored. Otherwise, downloaded files will be saved under names as close as possible to the original name
options (ClientOptions) – Writable TDLib options (Check the list of available options on https://core.telegram.org/tdlib/options.)
registration_form (dict) –
- class slidge.plugins.telegram.client.TelegramClient(session)[source]#
Bases:
aiotdlib.Client
- Parameters:
api_id (int) – Application identifier for Telegram API access, which can be obtained at https://my.telegram.org
api_hash (str) – Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org
database_encryption_key (str) – Encryption key of local session database. Default: aiotdlib
phone_number (str Either phone_number or bot_token MUST be passed. ValueError would be raised otherwise) – The phone number of the user, in international format.
bot_token (str) – The bot token. Either phone_number or bot_token MUST be passed. ValueError would be raised otherwise
use_test_dc (bool) – If set to true, the Telegram test environment will be used instead of the production environment
system_language_code (str) – IETF language tag of the user’s operating system language; must be non-empty
device_model (str) – Model of the device the application is being run on; must be non-empty
system_version (str) – Version of the operating system the application is being run on. If empty, the version is automatically detected by TDLib
application_version (str) – Application version; must be non-empty
files_directory (str) – The path to the directory for storing files. Default: .aiotdlib/
first_name (str) – First name of new account if account with passed phone_number does not exist
last_name (str) – Last name of new account if account with passed phone_number does not exist
library_path (str) – Path to TDLib binary. By default, binary included in package is used
tdlib_verbosity (str) – Verbosity level of TDLib itself. Default: 2 (WARNING) for more info look at (TDLibLogVerbosity)
debug (bool) – When set to true all request and responses would be logged in console with DEBUG level
parse_mode (str) – Default parse mode for high-level methods like send_message. Default: html
proxy_settings (ClientProxySettings) – Settings for proxying telegram connection
use_file_database (bool) – If set to true, information about downloaded and uploaded files will be saved between application restarts
use_chat_info_database (bool) – If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies use_file_database
use_message_database (bool) – If set to true, the library will maintain a cache of chats and messages. Implies use_chat_info_database
use_secret_chats (bool) – If set to true, support for secret chats will be enabled
enable_storage_optimizer (bool) – If set to true, old files will automatically be deleted
ignore_file_names (bool) – If set to true, original file names will be ignored. Otherwise, downloaded files will be saved under names as close as possible to the original name
options (ClientOptions) – Writable TDLib options (Check the list of available options on https://core.telegram.org/tdlib/options.)
session (slidge.plugins.telegram.session.Session) –
- async request(query, *, request_id=None, request_timeout=60)[source]#
- Parameters:
query (aiotdlib.api.BaseObject) –
request_id (Optional[str]) –
- Return type:
Optional[aiotdlib.client.RequestResult]
- async get_main_list_chats(limit=10)[source]#
Returns an ordered list of chats in a main chat list. Chats are sorted by the pair (chat.position.order, chat.id) in descending order
- Parameters:
limit (int) – Maximum amount of chats to be returned
- async handle_ChatReadOutbox(update)[source]#
- Parameters:
update (aiotdlib.api.UpdateChatReadOutbox) –
- async handle_MessageContent(action)[source]#
- Parameters:
action (aiotdlib.api.UpdateMessageContent) –
- async handle_MessageInteractionInfo(update)[source]#
- Parameters:
update (aiotdlib.api.UpdateMessageInteractionInfo) –
- async handle_DeleteMessages(update)[source]#
- Parameters:
update (aiotdlib.api.UpdateDeleteMessages) –