This repository has been archived by the owner on Mar 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Run.bat
89 lines (71 loc) · 1.79 KB
/
Run.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@echo off
set "exitCode="
set "returnChannel="
:init
@echo Starting checks
@echo.
REM Check for .git folder ::
REM Install it by cloning the repository, moving the .git folder and then deleting the clone ::
if not exist .git\NUL (
@echo .git folder not found (happens if you download as zip^)
@echo Installing .git (can take a minute depending on internet speeds^)
bin\git\cmd\git.exe clone https://github.com/xpopy/Boten-Anna.git > tmpFile 2>&1
attrib -h Boten-Anna\.git
move Boten-Anna\.git .git >nul
rmdir Boten-Anna\ /s /q
bin\git\cmd\git.exe stash > tmpFile 2>&1
bin\git\cmd\git.exe rebase > tmpFile 2>&1
@echo .git is installed
@echo.
)
REM Check for pipenv and install if not found ::
@echo Checking for pipenv
python -m pip --disable-pip-version-check list | findstr pipenv > tmpFile
set /p myvar= < tmpFile
del tmpFile
if "%myvar%" == "" (
@echo pipenv not found, installing...
@echo.
python -m pip --disable-pip-version-check install pipenv > tmpFile
del tmpFile
@echo pipenv is installed
@echo.
)
REM Create Pipfile.lock if it doesn't exist ::
if not exist Pipfile.lock (
@echo Creating Pipfile.lock, this might take a minute...
pipenv lock > tmpFile 2>&1
del tmpFile
color 07
)
REM Check dependencies ::
@echo Checking pipenv dependencies
pipenv install > tmpFile 2>&1
del tmpFile
@echo.
@echo Done, launching bot
@echo.
REM Start main.py
pipenv run python "main.py" "%exitCode%" "%returnChannel%"
REM Check if exitCode file exists, else quit
if not exist exitCode.tmp (
pause
Exit
)
REM Read from exitCode file
for /f "tokens=*" %%a in (exitCode.tmp) do (
if "%%a" == "exit" (
REM Quit batch
pause
Exit
)
if "%%a" == "restart" (
set exitCode=restart
) else (
set returnChannel=%%a
)
)
REM Delete the file afterwards
del exitCode.tmp
REM Jump to start
goto init