v0.0.28: BotFather-only registration, per-instance bot toggle, docs update
Security: - Bot registration restricted to BotFather (requires botfather_token) - Direct POST /v1/bot/register without BotFather auth → rejected Deploy: - systemd service reads /home/warzone/server.env for EXTRA_ARGS - deploy/warzone-server.env.mequ: no bots (default) - deploy/warzone-server.env.kh3rad3ree: --enable-bots - setup.sh copies per-hostname env file Docs updated: - LLM_HELP.md: BotFather flow, plaintext bot messaging, E2E option, bridge - LLM_BOT_DEV.md: botfather_token requirement, E2E mode, bridge section - BOT_API.md: full BotFather flow, ownership, numeric IDs, webhook delivery - SERVER.md: --enable-bots flag, per-instance config, bot system section - USAGE.md: bot messaging, BotFather, bridge tool Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -67,6 +67,7 @@ Rust 1.75 or later (`rust-version = "1.75"` in `Cargo.toml`).
|
||||
| `--bind` | `-b` | `0.0.0.0:7700` | Address and port to listen on |
|
||||
| `--data-dir` | `-d` | `./warzone-data` | Directory for the sled database |
|
||||
| `--federation` | `-f` | *(none)* | Path to federation JSON config file |
|
||||
| `--enable-bots` | | *(off)* | Enable Bot API and auto-create BotFather on startup |
|
||||
|
||||
### Environment Variables
|
||||
|
||||
@@ -75,6 +76,20 @@ Rust 1.75 or later (`rust-version = "1.75"` in `Cargo.toml`).
|
||||
| `RUST_LOG` | `warn` (production) | Log filter. Examples: `info`, `warzone_server=debug`, `trace` |
|
||||
| `WZP_RELAY_ADDR` | *(none)* | WZP voice relay address advertised to clients |
|
||||
|
||||
### Per-Instance Configuration (`server.env`)
|
||||
|
||||
Each server instance can use a `server.env` file for per-instance settings.
|
||||
Place it in the working directory or alongside the binary. This allows
|
||||
different instances to have different configurations (e.g., bots enabled on
|
||||
one server but not another).
|
||||
|
||||
Example `server.env`:
|
||||
```
|
||||
RUST_LOG=info
|
||||
WZP_RELAY_ADDR=relay.example.com:3478
|
||||
ENABLE_BOTS=true
|
||||
```
|
||||
|
||||
### systemd Service
|
||||
|
||||
A production-ready unit file is provided at `deploy/warzone-server.service`:
|
||||
@@ -209,6 +224,42 @@ Returns JSON with connection state, peer info, and presence data.
|
||||
|
||||
---
|
||||
|
||||
## 4b. Bot System
|
||||
|
||||
### Enabling Bots
|
||||
|
||||
Start the server with `--enable-bots` to activate bot functionality. Without
|
||||
this flag, all bot endpoints return 403.
|
||||
|
||||
```bash
|
||||
./warzone-server --bind 0.0.0.0:7700 --enable-bots
|
||||
```
|
||||
|
||||
### BotFather Auto-Creation
|
||||
|
||||
On first start with `--enable-bots`, the server auto-creates the `@botfather`
|
||||
bot. The BotFather token is printed to the server logs. Users interact with
|
||||
`@botfather` to register new bots.
|
||||
|
||||
### Per-Instance Bot Toggle
|
||||
|
||||
Bot support can be enabled independently per server instance:
|
||||
|
||||
| Instance | Bots | Config |
|
||||
|----------|------|--------|
|
||||
| mequ | Disabled | No `--enable-bots` flag |
|
||||
| kh3rad3ree | Enabled | `--enable-bots` flag set |
|
||||
|
||||
### Bot Webhook Delivery
|
||||
|
||||
When a bot has a webhook configured (via `setWebhook`), incoming messages are
|
||||
delivered live to the webhook URL via HTTP POST instead of being queued for
|
||||
`getUpdates` polling. This is integrated into the standard message routing
|
||||
pipeline -- `deliver_or_queue` checks for webhook configuration before
|
||||
queueing.
|
||||
|
||||
---
|
||||
|
||||
## 5. API Reference
|
||||
|
||||
All endpoints are prefixed with `/v1`. The web UI is served at `/`.
|
||||
|
||||
Reference in New Issue
Block a user