Agent-Logs-Url: https://github.com/kr0sh512/tt-simple/sessions/34c3052e-7b55-4cb8-9fee-0ee1ba315691 Co-authored-by: kr0sh512 <46405586+kr0sh512@users.noreply.github.com>
52 lines
1.8 KiB
Markdown
52 lines
1.8 KiB
Markdown
# Telegram VPN bot (Marzban + Telegram Stars)
|
|
|
|
Async Telegram bot for selling and extending Marzban VPN subscriptions.
|
|
|
|
## Features
|
|
- Plans:
|
|
- 1 month = ⭐️100
|
|
- 3 months = ⭐️270
|
|
- 6 months = ⭐️500
|
|
- Marzban username format: `tg<telegram_user_id>` (example: `tg12345678`).
|
|
- New users are created with:
|
|
- `data_limit = 50 GB`
|
|
- `data_limit_reset_strategy = month`
|
|
- `proxies = {"vless": {"flow": "xtls-rprx-vision"}}`
|
|
- `inbounds = {"vless": ["VLESS TCP REALITY"]}`
|
|
- `note` containing Telegram first name, last name, and phone (if available)
|
|
- If user has active subscription, a new purchase extends from current expiration.
|
|
- Bot sends **subscription URL** after successful purchase.
|
|
- Admin notifications for every creation/extension.
|
|
- Per-user price multiplier support (`price_multiplier`) that affects invoice stars (final amount is always integer).
|
|
- `/stats` command for admins:
|
|
- payments count
|
|
- stars earned
|
|
- sold months
|
|
- marzban users
|
|
- traffic usage/total quota
|
|
|
|
## Admin user management
|
|
- `/select_user <username|telegram_id>` — select user for further updates and show current values.
|
|
- `/selected_user` — show the currently selected user and current values.
|
|
- `/set_expire <YYYY-MM-DD or ISO datetime>` — set selected user expiration (UTC).
|
|
- `/set_traffic <GB>` — set selected user monthly traffic limit in GB.
|
|
- `/set_multiplier <float>` — set selected user price multiplier.
|
|
|
|
## Setup
|
|
```bash
|
|
python -m venv .venv
|
|
source .venv/bin/activate
|
|
pip install -r requirements.txt
|
|
cp .env.example .env
|
|
```
|
|
|
|
Fill `.env` and run:
|
|
```bash
|
|
export $(grep -v '^#' .env | xargs)
|
|
python bot.py
|
|
```
|
|
|
|
## Notes
|
|
- Telegram Stars invoices use `currency="XTR"` and empty `provider_token`.
|
|
- Local SQLite database stores only payment statistics. User state is read from Marzban API.
|