@echo off setlocal title Volcanic Secretary cd /d "%~dp0" rem --------------------------------------------------------------- rem Volcanic Secretary launcher for Windows (no Docker). rem First run: creates .env from .env.example and opens it for editing. rem Later runs: installs dependencies if missing, builds, starts the bot. rem See SETUP-WINDOWS.md for the Telegram setup steps. rem --------------------------------------------------------------- where node >nul 2>nul if errorlevel 1 ( echo Node.js 24 or newer is required but was not found on PATH. echo Install it from https://nodejs.org and run this file again. pause exit /b 1 ) for /f "tokens=1 delims=v." %%a in ('node -v') do set NODE_MAJOR=%%a if %NODE_MAJOR% LSS 24 ( echo Node.js 24 or newer is required. Found version: node -v pause exit /b 1 ) if not exist ".env" ( copy ".env.example" ".env" >nul echo. echo First run: created .env from .env.example. echo Fill in TELEGRAM_BOT_TOKEN and TELEGRAM_OWNER_ID, save the file, echo then run this file again. SETUP-WINDOWS.md explains where to get them. echo. if not defined SECRETARY_NO_EDITOR start "" notepad ".env" pause exit /b 0 ) findstr /b /c:"TELEGRAM_BOT_TOKEN=123456:ABC" ".env" >nul if not errorlevel 1 ( echo. echo .env still contains the placeholder bot token. echo Put your real token from @BotFather after TELEGRAM_BOT_TOKEN= and save. echo See SETUP-WINDOWS.md, step 1. echo. if not defined SECRETARY_NO_EDITOR start "" notepad ".env" pause exit /b 1 ) if not exist "node_modules" ( echo Installing dependencies, this takes a minute the first time... call npm install if errorlevel 1 ( echo npm install failed. Check your internet connection and try again. pause exit /b 1 ) ) echo Building... call npm run build if errorlevel 1 ( echo Build failed. See the errors above. pause exit /b 1 ) echo. echo Starting Volcanic Secretary. Press Ctrl+C in this window to stop it. echo. rem DEP0040 is a punycode deprecation inside a dependency, not something the user can act on. node --disable-warning=DEP0040 --env-file-if-exists=.env dist\main.js set EXIT_CODE=%errorlevel% if not "%EXIT_CODE%"=="0" ( echo. echo The bot stopped with exit code %EXIT_CODE%. echo Compare the last lines above with the Troubleshooting table in SETUP-WINDOWS.md. pause ) endlocal exit /b %EXIT_CODE%