@echo off
chcp 65001 >nul
cd /d "%~dp0"

echo ==============================
echo Telegram Thumbnail Bot
echo ==============================

REM 
where python >nul 2>nul
if %errorlevel% neq 0 (
    echo Python tidak dijumpai. Sila install Python dahulu.
    pause
    exit
)

REM 
if not exist venv (
    echo First time setup detected...
    echo Creating virtual environment...
    python -m venv venv

    call venv\Scripts\activate.bat

    echo Updating pip...
    python -m pip install --upgrade pip setuptools wheel

    echo Installing requirements...
    pip install -r requirements.txt
) else (
    call venv\Scripts\activate.bat
)

echo Starting bot...
python main.py

pause