Files
homm/docs
apuc b18e3ea703 Add a Telegram bot client with setup tooling for admin alerts
Bot API client (apps/integration/telegram.py):
- sendMessage, getMe, getUpdates over requests, no extra dependencies
- Telegram API errors are surfaced with the provider description
  ("chat not found", "bot was blocked") instead of a bare HTTP status
- messages longer than the Bot API limit are truncated with a marker

Notifications:
- notifications.py now goes through the client; failures are logged and
  never break the exchange

Setup helpers:
- telegram_check: verifies the token, prints the bot name, sends a test
  message, and suggests chats when chat_id is missing
- telegram_chats: lists chats that wrote to the bot, --apply saves the
  chat_id when exactly one chat is known
- admin action "Detect chat_id from bot messages" does the same in the UI,
  with explicit messages for no chats, many chats and API errors
- admin help text explains the BotFather -> /start -> test flow

Docs: Telegram setup section, command reference and limitations
(4096-char limit, negative chat_id for groups/channels, no internet =
no Telegram).

Tests: 12 new cases for the client, both commands and the admin action;
the suite is 45 passing.
2026-11-22 22:25:13 +03:00
..