Skip to content

Add Telegram bot integration#127

Open
helderpgoncalves wants to merge 3 commits intovirattt:mainfrom
helderpgoncalves:feature/telegram-bot-integration
Open

Add Telegram bot integration#127
helderpgoncalves wants to merge 3 commits intovirattt:mainfrom
helderpgoncalves:feature/telegram-bot-integration

Conversation

@helderpgoncalves
Copy link

Summary

  • Add Telegram bot interface for Dexter using grammY library
  • Bridge Telegram messages to existing Agent class with zero changes to existing source files
  • Real-time status updates as the agent researches (thinking, tool usage, writing answer)

Closes #126

Changes

New files

  • src/telegram/bot.ts — Entry point: loads env, creates grammY bot, /start command, graceful shutdown
  • src/telegram/handler.ts — Core handler: model resolution, per-chat history, busy guard, agent event mapping with debounced status edits
  • src/telegram/message-utils.ts — Splits messages >4096 chars at paragraph/line boundaries

Modified files

  • package.json — Added grammy dependency and "telegram" script
  • env.example — Added TELEGRAM_BOT_TOKEN placeholder

Test plan

  • Set TELEGRAM_BOT_TOKEN in .env and run bun run telegram
  • Send a message to the bot and verify status updates + final answer
  • Test long answer chunking with a complex question
  • Test busy guard by sending a second message while first is processing
  • Verify multi-turn context works across messages in same chat

Closes virattt#126

Bridge Telegram messages to the existing Agent class with real-time
status updates, per-chat conversation history, and message chunking
for long answers. No existing source files are modified.
This project uses bun, so package-lock.json is unnecessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Telegram bot integration

1 participant