--daemon long-polls getUpdates, runs one turn per message and replies. The token comes from ~/.splinter/telegram.token (0600) or SPLINTER_TELEGRAM_TOKEN, never from an argument: arguments end up in ps and in shell history. telegram_allow lists who is answered, comma separated, nobody by default - an empty list is a refusal, not an open door. Unknown senders are logged without their text. The loop survives a failed request instead of dying on it, and keeps no state beyond the session: a restart re-delivers the last update, which costs one duplicated answer and never a lost message. test_telegram covers the token paths (file wins, environment as fallback, empty file is not a token). Verified against api.telegram.org: the token works and getMe answers hbx_splinter_bot. Sending needs the user to write first - a bot cannot start a chat, the API says 'chat not found'.
16 KiB
Executable File
16 KiB
Executable File