Skip to content

Configs

BotConfig

Bases: SubConfig

Sub-config with Telegram bot configuration.

Attributes:

Name Type Description
owner int

Telegram ID of the bot's owner.

api_id int

Telegram API ID for client registration.

api_hash str

Telegram API hash for client registration.

bot_token str | None

Telegram bot token. Bot operates in user-bot mode if None.

workers int

Number of Pyrogram workers to use.

max_concurrent_transmissions int

Max number of concurrent transmissions.

scoped_commands bool

Whether scoped commands should be used instead of a simple permissions model.

from_dict(data) classmethod

Create a config object from dict (or any other dict-compatible mapping).

Parameters:

Name Type Description Default
data Mapping[str, Any]

The data mapping to create a config object from.

required

Returns:

Name Type Description
ConfigObject Self

The config object created from data mapping.

Config

Bases: FileConfig

Bot's primary configuration that includes all sub-configs.

Attributes:

Name Type Description
locale str

Bot's locale in Telegram-compatible format.

bot BotConfig

Sub-config with bot's configuration.

reports ReportsConfig

Sub-config with report configuration.

disabled_plugins list[str]

List with plugin names that must not be enabled.

commands dict[str, dict[str, list[dict[str, Any]]]]

Full mapping with commands to be loaded. Check the examples directory for examples.

from_dict(data) classmethod

Create a config object from dict (or any other dict-compatible mapping).

Parameters:

Name Type Description Default
data Mapping[str, Any]

The data mapping to create a config object from.

required

Returns:

Name Type Description
ConfigObject Self

The config object created from data mapping.

from_file(path) classmethod

Create a config object from a valid JSON file.

Parameters:

Name Type Description Default
path Path | str

Path to a valid JSON file to read the data from.

required

Returns:

Name Type Description
FileConfig Self

The config object created from data mapping.

ReportsConfig

Bases: SubConfig

Sub-config with reporting configuration.

Attributes:

Name Type Description
chat_id str | int | None

Telegram chat ID to send reports to. Reports are disabled if None.

from_dict(data) classmethod

Create a config object from dict (or any other dict-compatible mapping).

Parameters:

Name Type Description Default
data Mapping[str, Any]

The data mapping to create a config object from.

required

Returns:

Name Type Description
ConfigObject Self

The config object created from data mapping.