This repository has been archived by the owner on Jan 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
windows-installer.bat
128 lines (111 loc) · 3.33 KB
/
windows-installer.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
@echo off
echo Setup discord-twitter-video-embed by adryd325
echo Script made by bagusnl with GitHub Copilot :P
echo.
echo Make sure chocolatey is installed
echo and script running as administrator
echo.
:: check batch running as administrator
:: https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights
:check_Permissions
echo Administrative permissions required. Detecting permissions...
net session >nul 2>&1
if %errorLevel% == 0 (
echo Success: Administrative permissions confirmed.
goto chococheck
) else (
echo Failure: Current permissions inadequate.
)
goto :end
:chococheck
:: check chocolatey installed
:: https://stackoverflow.com/questions/5696907/how-to-check-if-a-program-is-installed-on-windows
echo.
echo Checking if chocolatey is installed...
choco >nul 2>&1
if %errorLevel% == 1 (
echo Success: Chocolatey is installed.
goto makedir
) else (
echo Failure: Chocolatey is not installed.
echo.
echo Install chocolatey using this guide:
echo https://chocolatey.org/install
echo.
goto end
)
:makedir
:: make installation directory
mkdir C:\git
cd /D C:\git
:: install dependencies
:: dependencies: git, ffmpeg, yt-dlp, nodejs
echo.
echo Installing dependencies...
choco install git ffmpeg yt-dlp nodejs -y
if %errorlevel% == 1 (
echo Failure: Dependencies not installed.
echo.
echo Install dependencies using this guide:
echo https://chocolatey.org/install
echo.
goto end
) else (
echo Success: Dependencies installed.
goto gitclone
)
:: clone repo
:gitclone
:: delete git repo and clone again
echo.
echo Cleaning up previous installation...
del /Q /F C:\Users\%username%\Desktop\dtve-runner.bat
del /Q /F C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\windows-runner.bat
rmdir /s /q C:\git\discord-twitter-video-embeds
echo.
echo Cloning repo...
git clone https://github.com/adryd325/discord-twitter-video-embeds
goto gitclone_end
:gitclone_end
cd discord-twitter-video-embeds
:npmprep
echo.
echo Preparing npm...
call npm install -g pnpm
call /w pnpm install
:: make tmp directory at C:\
mkdir C:\tmp
:: edit .env using notepad
echo.
echo Add your token and LOG_CHANNEL ID on the notepad
echo Don't forget to save the file and then exit the notepad
notepad windows-runner.bat
:: make link for windows-runner.bat to startup folder
:: make sure you have edited windows-runner.bat
echo.
echo. Making link for windows-runner.bat to startup folder...
mklink /H C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\windows-runner.bat C:\git\discord-twitter-video-embeds\windows-runner.bat
:: make shortcut for windows-runner.bat to desktop folder
:: make sure you have edited windows-runner.bat
echo.
echo. Making shortcut for windows-runner.bat as dtve-runner.bat to desktop folder...
mklink /H C:\Users\%username%\Desktop\dtve-runner.bat C:\git\discord-twitter-video-embeds\windows-runner.bat
goto done
:done
echo.
echo.
echo Setup complete
echo you can try to start the bot by running windows-runner.bat in C:\git\discord-twitter-video-embeds or dtve-runner.bat in your desktop
echo.
goto end
:notchoco
echo Chocolatey is not installed
echo.
goto end
:notadmin
echo You must run this script as administrator
echo.
goto end
:end
echo Press any key to exit
pause >nul