trading_agent.doctor.checks.telegram_check
¶
Checks the Telegram bot token, by asking Telegram who the bot is.
Telegram's addresses contain the bot token, and httpx puts the address in its error messages, so this check reports only the kind of error, never its text.
Typical usage example:
result = TelegramCheck(configuration.telegram, secrets).run()
TelegramCheck
¶
Bases: DoctorCheck
Checks that Telegram is either off, or on with a token Telegram accepts.
Creates the check.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration
|
TelegramConfiguration
|
The [telegram] settings. |
required |
secrets
|
Secrets
|
The secrets, holding the bot token. |
required |
Source code in src/trading_agent/doctor/checks/telegram_check.py
run
¶
Asks Telegram for the bot's name when a token is set.
Returns:
| Type | Description |
|---|---|
CheckResult
|
OK when Telegram is off without a token or the token works; a warning when a working token is set but Telegram is off; failed when it is on without a token or Telegram refuses the token. |