# Fast Modular Telegram PHP Bot

This rebuild replaces the old single-file state loader with direct SQLite tables and small repositories. Webhook requests answer `OK` immediately, then process the update. Polling uses the same bot core.

## Run

1. Copy `.env.example` to `.env` and set `BOT_TOKEN`, `BOT_USERNAME`, and `ADMIN_IDS`.
2. Webhook entrypoint: `webhook.php` or `index.php`
3. Polling: `php poll.php`
4. Doctor: `php cli.php doctor`
5. Backup database: `php cli.php backup`

## Webhook management

Use `WEBHOOK_MANAGE_KEY`, then call:

- `webhook.php?action=set&key=...`
- `webhook.php?action=info&key=...`
- `webhook.php?action=delete&key=...`

Prefer sending the key in `X-Webhook-Manage-Key` or `Authorization: Bearer ...`.
