# 🚀 CPanel Deployment Guide for MRI Store Userbot

This guide provides step-by-step instructions on how to deploy and run your Telegram Userbot on **cPanel**.

---

## 📂 Step 1: Prepare Your Files
1.  **Zip the Project**: Open your project folder (`C:\xampp\htdocs\userbot`). 
    -   Select all files **inside** the folder.
    -   Right-click and select **Compress to ZIP file**.
    -   *Important: Do NOT zip the folder itself, only the files inside it. This prevents "folder-inside-folder" issues.*
2.  **Upload**: Log in to cPanel > **File Manager**.
    -   Go to `/home/yourusername/userbot` (Create this folder if it doesn't exist).
    -   Upload your `.zip` file here.
3.  **Extract**: Right-click the zip and select **Extract**. 
    -   **CRITICAL:** Make sure files like `main.py` and `requirements.txt` are directly inside `/home/yourusername/userbot/`, NOT inside another subfolder.

---

## 🐍 Step 2: Setup Python Application
1.  Search for **"Setup Python App"** in cPanel.
2.  Click **Create Application**.
3.  **Python Version**: Select `3.11` (or the latest available).
4.  **Application root**: Enter `userbot`. 
    -   *This must match the folder where you uploaded your files.*
5.  **Application URL**: You can leave this as your domain.
6.  **Application startup file**: Enter `main.py`.
7.  Click **Create**.

---

## 🗄️ Step 3: Database Setup
1.  Go to **MySQL® Databases** in cPanel.
2.  **Create a New Database**: e.g., `techxtop_userbot`.
3.  **Create a New User**: e.g., `techxtop_admin`.
4.  **Add User to Database**: Give all privileges.
5.  **Edit `config.py`**:
    -   Open `config.py` in the cPanel File Manager Editor.
    -   Update `DB_HOST`, `DB_USER`, `DB_PASS`, and `DB_NAME` with your new cPanel database credentials.

---

## 🛠️ Step 4: Install Dependencies
1.  In the **Setup Python App** interface, look for the text at the top that says:
    `Source /home/techxtop/virtualenv/userbot/3.11/bin/activate`
2.  **Copy that command**.
3.  Go to **Terminal** in cPanel.
4.  Paste the command and press **Enter**.
5.  **Verify your location**: Type `ls` and press Enter. You should see `requirements.txt` here.
6.  Run the following command:
    ```bash
    pip install -r requirements.txt
    ```

---

## 🏃 Step 5: Running the Bot
Once everything is installed, you can start the bot:

```bash
python main.py
```

### 💡 Keep it Running 24/7
To keep the bot running after closing the terminal:

```bash
nohup python main.py &
```

*To stop the bot later, use `ps aux | grep python` to find the process ID and `kill -9 <PID>` to stop it.*

---

## ⚠️ Troubleshooting
- **File Not Found?**: If `pip` says "No such file", it means your files are in the wrong folder (check if they are in `public_html/userbot` by mistake). Move them to `/home/techxtop/userbot/`.
- **Database Error?**: Double-check your database user permissions and password in `config.py`.

---
**MRI Store Bot System** - *Premium & Professional*
