noc/README.md
Fam Zheng db8ff94f7c init: telegram bot bridging messages to claude sessions
Async Rust bot (teloxide + tokio) that:
- Authenticates users per chat with a passphrase (resets daily at 5am)
- Generates deterministic UUID v5 session IDs from chat_id + date
- Pipes messages to `claude -p --session-id/--resume <uuid>`
- Persists auth and session state to disk across restarts
- Deploys as systemd --user service via `make deploy`
2026-04-05 06:56:46 +01:00

41 lines
892 B
Markdown

# NOC
Telegram bot that bridges messages to `claude` sessions.
## How it works
1. User sends a message to the bot
2. First message must be the auth passphrase, otherwise the bot replies "not authenticated"
3. Once authenticated, messages are piped to `ms --resume <session_id>` via stdin
4. `claude` stdout is sent back as the reply
5. Sessions are scoped per chat and refresh daily at 5am local time
## Setup
```bash
cp config.example.yaml config.yaml
# edit config.yaml with your values
```
## Config
| Key | Description |
|-----|-------------|
| `tg.key` | Telegram bot token |
| `auth.passphrase` | Passphrase required to authenticate each session |
| `session.refresh_hour` | Hour (local time, 24h) when sessions reset |
## Deploy
```bash
make deploy
```
This builds the release binary and installs a `systemd --user` service.
## Logs
```bash
journalctl --user -u noc -f
```