How Agenvoy Uses go-bot
Last updated
Agenvoy is a local AI agent harness in Go that runs 24/7 on your own machine; its Telegram and Discord channels run on go-bot. This page maps each part of those channels to the go-bot calls it makes, based on the Agenvoy source.
Channel Map
Agenvoy depends on
github.com/pardnchiu/go-bot v0.5.1 and imports core/telegram and core/discord in 15 files under internal/runtime/chatbot and the TUI. Setup on the Agenvoy side is described in Telegram and Discord Setup.| Agenvoy feature | Source | go-bot calls | go-bot docs |
|---|---|---|---|
| Bot startup | chatbot/telegram/new.go, chatbot/discord/new.go | New, Reply, Start, Status, Close | Bot Lifecycle, Reply Handler |
| Telegram command menu | chatbot/telegram/new.go | SetCommands | Telegram Setup |
Token check in TUI /telegram, /discord | tui/commandTelegram.go, tui/commandDiscord.go | New, Start, Status, Close | Bot Lifecycle |
| Thinking status | chatbot/telegram/reply.go, chatbot/discord/reply.go | SendStatus, FinishStatus | Status Messages |
| Replies | chatbot/telegram/reply.go, chatbot/discord/reply.go | Send | Telegram Messages, Discord Messages |
| Confirmations and questions | chatbot/telegram/pending.go, chatbot/discord/pending.go | SendSelect, SendMultiSelect, SendInput | Telegram Interactions, Discord Interactions |
| Incoming attachments | chatbot/telegram/attachments.go, chatbot/discord/attachments.go | Save | Saving Media |
| Outgoing files | chatbot/telegram/attachments.go, chatbot/discord/attachments.go | Telegram SendPhoto, SendVoice, SendFile; Discord SendFiles | Telegram API, Discord API |
| Background task results | chatbot/telegram/push.go, chatbot/discord/push.go | New, Send | Telegram Messages |
send_to_chatbot tool | chatbot/tool/send.go | New, Send | Telegram Messages, Discord Messages |
Startup and Incoming Messages
When Telegram or Discord is enabled and its token is in the keychain (
TELEGRAM_TOKEN, DISCORD_TOKEN), Agenvoy builds the bot with New (Telegram with a 5-minute WithHTTPClient), registers one Reply handler, and calls Start. The handler always returns an empty string: Agenvoy answers through its own task runner instead of the handler's return value, so long agent runs never block the handler. The bot username from Status is saved to Agenvoy's config.On Telegram, Agenvoy registers six commands with
SetCommands: /new, /model, /reasoning, /pending, /stop, /compact. Photos or documents sent as one album are buffered by their media group and handed to the agent together.The TUI
/telegram and /discord commands check a pasted token by calling New, Start with a 10-second timeout, and Status for the username, then Close.Status and Replies
While a task runs, each progress line goes through
SendStatus, so the chat shows one status message that keeps updating instead of a stream of new messages; on Telegram the line is wrapped in an expandable <blockquote> and sent with WithStatusSendType(TypeHTML). FinishStatus clears it when the task ends. The final answer is sent with Send, as HTML on Telegram (WithSendType(TypeHTML)) and Markdown on Discord.Confirmations and Questions
When a tool needs approval or the agent asks the user something, Agenvoy sends:
SendSelectfor a confirmation or a single choice, also used by/model,/reasoning,/pendingand/stopSendMultiSelectfor several choicesSendInputfor free text, including secret values, and for the 6-digit code printed in the daemon log that authorizes a new chat or channel
The answer comes back to the same
Reply handler as Input.CallbackData (one pick) or Input.CallbackPicks (several picks), and Agenvoy matches it to the waiting task.Attachments
- Incoming: photos, documents, voice and video are downloaded with
Save; voice messages are then transcribed by Agenvoy's speech model before the text reaches the agent - Outgoing on Telegram: images go out with
SendPhotoin groups of up to 10,.ogg/.oga/.opusfiles withSendVoice, everything else withSendFile(TypeDocument), on a separate client with a 10-minute timeout; a failed upload is reported to the chat - Outgoing on Discord: files go out with
SendFiles
Messages Outside a Conversation
Results of background and scheduled tasks are pushed to the chat that started them: Agenvoy creates a short-lived client with
New and sends the text with Send, split into chunks that fit the platform limit. The send_to_chatbot tool does the same for any session (TUI, CLI, cron), but only to a chat or channel that has already been authorized.