# Telegram and Discord Setup

Where the Telegram and Discord bot settings, tokens and authorized chats are stored.

| Key | Location |
|---|---|
| `telegram_enabled` / `discord_enabled` | `config.json` (bot usernames are filled into `telegram_username` / `discord_username`) |
| `TELEGRAM_TOKEN` / `DISCORD_TOKEN` | keychain (`agenvoy` service) |
| Authorized chat IDs | `~/.config/agenvoy/.telegram` and `~/.config/agenvoy/.discord` (one ID per line, written after 6-digit OTP verification succeeds) |
| Verification-code relay | `admin_channel` in `config.json` — `/config` → `Admin Channel` in the TUI (moved there from `/channel` → `admin` in v1.1.0; `/channel` now holds only the Telegram and Discord tabs), or `POST /v1/channel/admin`, picks an authorized chat or a raw `tg@<id>` / `dc@<id>` target. The `/admin-channel` command was removed |
| Inbound voice messages | Transcribed with whichever model `stt_model` in `config.json` names (`/model` → `stt` in the TUI). With none selected the bot answers that no speech-to-text model is set instead of transcribing |

Both channels can also be enabled or disabled through `POST /v1/channel/telegram` and `POST /v1/channel/discord`, which store the token and flip the flag; the daemon's config watcher reconnects the bot and fills in its username. Platform formatting rules are embedded in the channel system prompts — there is no `format_chatbot` tool.

Both bots connect outbound from the daemon, so the host needs no inbound port, public hostname, or reverse proxy — a bot token is the whole setup. That is also the bar for adding another platform: one is considered only when it improves on this, not merely to widen the list.

Voice **output** was removed from both channels. `[SEND_VOICE:<text>]` no longer exists and replies are never synthesized into a chat; speech synthesis is the `generate_audio` tool, which writes a file to the output directory and is gated on `tts_model`. Since v1.0.13 that file defaults to opus, and a `.ogg` / `.oga` / `.opus` attachment sent to Telegram goes out as a voice note instead of a document — Discord still receives it as a file.
