From e4f917ba24fca95e6af7197bc952db07baa1defb Mon Sep 17 00:00:00 2001 From: Vikram Vishwakarma Date: Tue, 20 Aug 2024 13:57:32 +0530 Subject: [PATCH] seperate deployments --- .gitignore | 2 +- termux.sh | 2 ++ windows.bat | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 37a166d0..17eb9d6a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ temp.info downloads tron.db .venv - +installed_dependencies.txt diff --git a/termux.sh b/termux.sh index 56c7ccea..7466b923 100644 --- a/termux.sh +++ b/termux.sh @@ -72,3 +72,5 @@ main() { install_userbot_dependencies run_userbot } + +main diff --git a/windows.bat b/windows.bat index 9965a1f6..8c9b9fcb 100644 --- a/windows.bat +++ b/windows.bat @@ -1,2 +1,53 @@ -winget install -e --id Python.Python.3.10 +@echo off +setlocal + +:: File containing the list of required packages +set REQUIREMENTS_FILE=requirements.txt +set INSTALLED_FILE=installed_dependencies.txt + +:: Main function +:main +:: Show message +echo Running script, please be patient ... + +:: Check Python 3 installation +echo Checking python installation ... +where python3 >nul 2>&1 +if %ERRORLEVEL% NEQ 0 ( + echo Python3 is not installed. Trying to install Python3 ... + echo Please install Python3 manually from the Python website or using a package manager. + echo Exiting script with error. + exit /b 1 +) + +:: Check and install userbot dependencies +if not exist "%REQUIREMENTS_FILE%" ( + echo REQUIREMENTS_FILE file not found, Exiting script with error. + exit /b 1 +) + +echo Checking userbot dependencies ... +for /f "usebackq tokens=* delims=" %%i in ("%REQUIREMENTS_FILE%") do ( + :: Skip empty lines and comments + if "%%i"=="" goto :eof + if "%%i"=="REM" goto :eof + + :: Check if the package is installed + pip show %%i >nul 2>&1 + if %ERRORLEVEL% NEQ 0 ( + echo %%i is not installed, trying to install ... + pip install %%i + ) else ( + echo %%i >> "%INSTALLED_FILE%" + ) +) + +:: Run userbot +cls python3 -m main +echo Configuring Userbot, wait .... +if %ERRORLEVEL% NEQ 0 ( + echo Failed to run userbot. Exiting script with error. + exit /b 1 +) +endlocal