Open-source scaffold CLI for running a Telegram bot that forwards messages to Gemini CLI.
- Python Telegram runtime (
bot.py) with:- retries + timeout handling
- per-chat session pinning
/sessions,/sessionuse,/sessionclear,/sessiondelete,/continue/clicommand-chain mode for fast Gemini CLI commands- Telegram chat-mode guardrails for normal messages
.envruntime configuration- user
systemdservice template
- Linux with
systemd --user(recommended) - Node.js >= 20
- Python >= 3.10
- Gemini CLI installed and authenticated (
gemini --list-sessionsworks) - Telegram bot token from BotFather
npx create-gemini-telegram-agent init \
--dir ./my-gemini-bot \
--bot-token-file ~/.config/gemini-telegram-agent/telegram-bot-token.txt \
--chat-id <your_chat_id>Alternative token input:
--bot-token <token>(quick setup; appears in shell history)TELEGRAM_BOT_TOKEN=<token> ... init(recommended for CI/non-interactive)
Then verify:
cd ./my-gemini-bot
npx create-gemini-telegram-agent doctor --dir .create-gemini-telegram-agent init [options]
create-gemini-telegram-agent doctor [--dir <path>]
create-gemini-telegram-agent start [--dir <path>]
create-gemini-telegram-agent sync-commands [--service-name <name>]
create-gemini-telegram-agent uninstall [--service-name <name>] [--purge] [--yes]- Bot token written to
~/.config/gemini-telegram-agent/telegram-bot-token.txtwith0600 - No token values printed in CLI logs
- Normal Telegram messages run non-YOLO mode by default
npm run check
npm run pack:dry-run
npm publish --access public- A Telegram bot username/ID alone is not enough for setup. Users need the bot token.
- For OAuth-backed Gemini usage, authentication happens on each host machine.