pinger_bot.config#

File for the Config dataclass.

Module Contents#

Classes#

Config

Main dataclass for config.

Attributes#

BASE_DIR

Base directory of the project.

config

Initialized Config.

translation_obj

This is setuped gettext.translation object.

gettext

Function for getting translated messages.

BASE_DIR[source]#

Base directory of the project.

class Config[source]#

Main dataclass for config.

Note

If you will add more variables with value ???, do not forget them mock in tests!

discord_token: str = ???[source]#

Your Discord bot token.

locale: str = ru[source]#

Bot’s language, on which it speak.

At now we only support en (English), uk (Ukrainian) and ru (Russian).

debug: bool = False[source]#

Debug mode. Produce a lot of spam.

verbose: bool[source]#

Not so much info, that in debug.

db_uri: str = sqlite+aiosqlite:///pinger_bot.db[source]#

DB_URI to connect.

ping_interval: int = 5[source]#

Interval between pings, for collecting statistic of the server. In minutes.

honeybadger_token: str | None[source]#

Token for Honeybadger.io. If you don’t have it, just leave it as None.

classmethod setup() Config[source]#

Set up the config.

It is just load config from file, also it is rewrite config with merged data.

Returns:

Config instance.

static _handle_env_variables(cfg: omegaconf.dictconfig.DictConfig) None[source]#

Process all values, and redef them with values from env variables.

Parameters:

cfgConfig instance.

config[source]#

Initialized Config.

translation_obj[source]#

This is setuped gettext.translation object.

gettext[source]#

Function for getting translated messages.

Examples

from pinger_bot.config import gettext as _

print(_("Hello World!"))

Will print Hello World!, Привет Мир! or Привіт Світ!, depending on Config.locale option.