configurelisted
Install: claude install-skill 0xMaxMa/claude-gateway
# /telegram:configure — Telegram Channel Setup
Writes the bot token to `{STATE_DIR}/.env` and orients the user on access policy.
The server reads both files at boot.
Arguments passed: `$ARGUMENTS`
---
## State directory resolution
Compute STATE_DIR at the very start before doing anything else:
```
1. If $TELEGRAM_STATE_DIR env var is set:
STATE_DIR = $TELEGRAM_STATE_DIR
2. Else if {CWD}/.telegram-state/ exists:
STATE_DIR = {CWD}/.telegram-state
(This handles gateway agent sessions where CWD = workspace dir)
3. Else:
STATE_DIR = ~/.claude/channels/telegram (legacy fallback)
```
Use STATE_DIR for all file paths:
- Token file: `{STATE_DIR}/.env`
- Access file: `{STATE_DIR}/access.json`
---
## Dispatch on arguments
### No args — status and guidance
Read both state files and give the user a complete picture:
1. **Token** — check `{STATE_DIR}/.env` for
`TELEGRAM_BOT_TOKEN`. Show set/not-set; if set, show first 10 chars masked
(`123456789:...`).
2. **Access** — read `{STATE_DIR}/access.json` (missing file
= defaults: `dmPolicy: "allowlist"`, `pairing: true`, empty allowlist). Show:
- DM policy (`open`/`allowlist`/`disabled`) and what it means in one line
- Pairing toggle (on/off) and what it means in one line
- Allowed senders: count, and list display names or IDs
- Pending pairings: count, with codes and display names if any
3. **What next** — end with a concrete next step based on state:
- No token → *"Run `/telegram:confi