-
Notifications
You must be signed in to change notification settings - Fork 19
/
KLIK SINI UNTUK MULAI DAN INSTALASI.bat
71 lines (62 loc) · 1.91 KB
/
KLIK SINI UNTUK MULAI DAN INSTALASI.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
@echo off
REM Function to handle errors
:handleError
echo %1
pause
exit /b
REM Check if Node.js is installed
SET NODE_PATH=
FOR /F "delims=" %%i IN ('where node 2^>nul') DO SET NODE_PATH=%%i
IF NOT DEFINED NODE_PATH (
echo Node.js not found. Installing fnm Fast Node Manager...
winget install Schniz.fnm
IF ERRORLEVEL 1 (
call :handleError "Error installing fnm. Please check your installation."
)
REM Configure fnm environment
call fnm env --use-on-cd
IF ERRORLEVEL 1 (
call :handleError "Error configuring fnm environment. Please check your installation."
)
REM Download and install the latest Node.js version
fnm use --install-if-missing 20
IF ERRORLEVEL 1 (
call :handleError "Error installing Node.js. Please check your installation."
)
) ELSE (
echo Node.js is already installed.
)
REM Check if ffmpeg is installed
SET FFMPEG_PATH=
FOR /F "delims=" %%i IN ('where ffmpeg 2^>nul') DO SET FFMPEG_PATH=%%i
IF NOT DEFINED FFMPEG_PATH (
echo ffmpeg not found. Installing ffmpeg...
winget install --id=Gyan.FFmpeg -e
IF ERRORLEVEL 1 (
call :handleError "Error installing ffmpeg. Please check your installation."
)
) ELSE (
echo ffmpeg is already installed.
)
REM Check if node_modules exists
IF EXIST "node_modules" (
echo Running the application...
call node SHPBOT.js
IF ERRORLEVEL 1 (
echo Application closed unexpectedly. Installing dependencies...
npm install --no-interactive
IF ERRORLEVEL 1 (
call :handleError "Error installing dependencies. Please check your setup."
)
call node SHPBOT.js
)
) ELSE (
echo Installing dependencies...
npm install --no-interactive
IF ERRORLEVEL 1 (
call :handleError "Error installing dependencies. Please check your setup."
)
call node SHPBOT.js
)
REM Keep the command prompt open after running Node.js
pause