docs: update LLM bot dev guide with BotFather chat flow + plaintext auto-detect

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-03-29 11:27:13 +04:00
parent 76fd8dd81a
commit 4118be7ef3
2 changed files with 166 additions and 155 deletions

View File

@@ -96,7 +96,8 @@ Groups auto-create on join if they don't exist. Server fans out per-member encry
- Server sees: metadata (who talks to whom, timestamps), encrypted blobs, presence.
- Server cannot read msg content.
- Pre-keys: signed pre-key + 10 one-time pre-keys uploaded on register.
- Bot API msgs are NOT E2E encrypted (plaintext JSON envelopes).
- Bot msgs: clients auto-detect bot aliases, send plaintext (no E2E). Server can read bot msgs.
- E2E bots possible (register with seed+bundle) but standard bots are plaintext.
## Federation
@@ -131,15 +132,18 @@ no prekeys available | recipient's one-time prekeys exhausted | they need to re-
## Bot API (Telegram-compatible)
### BotFather
### Creating a Bot
`@botfather` is the only way to create bots. It is auto-created on first server start (token printed in server logs). Users message `@botfather` to register new bots. The server must be started with `--enable-bots` to activate bot functionality.
Server must run with `--enable-bots`. Then in chat:
```
/peer @botfather
/newbot MyWeatherBot
→ BotFather replies with token
```
### Registration
BotFather commands: /newbot, /mybots, /deletebot <name>, /token <name>, /help
Bots are created via BotFather, which calls POST /v1/bot/register with a `botfather_token` field. Each bot has an `owner` field linking it to the user who requested creation.
Bot aliases must end with Bot, bot, or _bot. Non-bots cannot use these.
Bot names must end with bot/Bot/_bot. Only @botfather can create bots.
### Plaintext Bot Messaging