Skip to content

Configs

BotConfig dataclass

Bases: SubConfig

Sub-config with Discord bot configuration.

Attributes:

Name Type Description
owners list[int]

Discord IDs of owners.

debug_guilds list[int]

Discord IDs of debug guilds.

bot_token str

Discord bot token.

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 dataclass

Bases: FileConfig

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

Attributes:

Name Type Description
locale str

Bot's locale in Telegram-compatible format.

debug bool

Whether to operate in debug mode.

bot BotConfig

Sub-config with bot's configuration.

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.