AR BOT HOST — 24/7 HOSTING PACKAGE

This package is prepared to work like a hosting deployment:
- Telegram bot runs with long polling.
- Flask binds to 0.0.0.0:$PORT for hosting health/HTTP requirements.
- MySQL is the default persistent database backend.
- SQLite is retained only as a local fallback (DB_TYPE=sqlite).
- User balances, transactions, vouchers, VPS plans, subscriptions and bot metadata are stored in MySQL.
- Uploaded bot files are stored under DATA_DIR/upload_bots.
- Supervisor and systemd templates are included for automatic restart.
- On restart, bots marked auto_start=1 are restored; the built-in watchdog also restarts bots marked auto_restart=1.

SETUP
1. Create a MySQL database and database user in your hosting panel.
2. Import database.sql (optional because arbot.py creates the tables automatically).
3. Upload the package.
4. Set the environment variables from .env.example.
5. Install requirements: pip install -r requirements.txt
6. Start: python -u arbot.py
7. For a VPS, use arbot.service or supervisor.conf so the process restarts automatically.

IMPORTANT
- Put the NEW Telegram token in BOT_TOKEN; do not put it in arbot.py.
- DATA_DIR must be on persistent storage.
- The uploaded-bot execution feature requires a hosting/VPS environment that permits child processes and the required runtimes (Python/Node.js). A normal PHP-only shared hosting account cannot provide that.


WEB INSTALLER
After the bot web server is running, open:
  https://YOUR-DOMAIN/setup
or:
  https://YOUR-DOMAIN/install

The page asks for Database Host/Port/Name/User/Password, Telegram Bot Token,
Owner Telegram ID, Admin Telegram ID, Support Username and Update Channel.
It tests MySQL, then writes .env. Restart the bot after saving.
