I run a Telegram Stars payment bot for $0/month forever — on GitHub Actions, not a server
说明与用途
在 GitHub Actions 上运行的 Telegram Stars 机器人通过 6 小时作业和推送重试策略,实现零成本的持续预结账响应。
问题
Telegram requires answerPreCheckoutQuery within 10 seconds of every payment attempt, so a bot must be always‑on to respond, normally incurring hosting costs.
结果
Near‑continuous coverage of Telegram pre‑checkout queries for $0/month, with a robust push‑retry mechanism to prevent duplicate deliveries.
工作流
- 1. Configure a GitHub Actions workflow with a cron schedule of every 6 hours and a concurrency group named telegram-stars-bot.
- 2. In each run, long‑poll Telegram’s getUpdates for ~5h50m to stay within the 6‑hour job limit.
- 3. Process updates, answerPreCheckoutQuery, and deliver successful_payment messages.
- 4. Commit state.json (offset) and fulfilled.json (dedup list) back to the main branch as the last step.
- 5. If the push fails, retry up to five times with a rebase to avoid losing progress.
证据
Telegram requires answerPreCheckoutQuery within 10 seconds of every payment attempt — there's no auto‑approve fallback.
A single GitHub Actions job can run up to 6 hours.
If anything else pushes to main during that ~5h50m window, the push fails with a plain ! [rejected] (fetch first).
- 记录日期: 2026-10-18T01:55:58.689Z