Dateien nach "/" hochladen
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
REM Überprüfen, ob Node.js installiert ist
|
||||
where node >nul 2>nul
|
||||
if %errorlevel% neq 0 (
|
||||
echo Node.js ist nicht installiert. Installiere Node.js automatisch...
|
||||
|
||||
REM Automatische Installation von Node.js, abhängig vom Windows-System
|
||||
if exist %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe (
|
||||
powershell -Command "Invoke-WebRequest -Uri https://nodejs.org/dist/v14.17.0/node-v14.17.0-x64.msi -OutFile node_installer.msi"
|
||||
Start-Process msiexec -ArgumentList "/i node_installer.msi /quiet" -Wait
|
||||
del node_installer.msi
|
||||
) else (
|
||||
echo Automatische Installation von Node.js wird nicht unterstützt. Bitte installieren Sie Node.js manuell und führen Sie das Skript erneut aus.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
REM Laden Sie die Umgebungsvariablen aus der .env-Datei
|
||||
if exist .env (
|
||||
for /f "delims=" %%a in (.env) do set "%%a"
|
||||
) else (
|
||||
echo .env-Datei nicht gefunden. Stellen Sie sicher, dass die Datei vorhanden ist und versuchen Sie es erneut.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Erstellen Sie ein neues Node.js-Projekt mit npm init und verwenden Sie Umgebungsvariablen
|
||||
echo Creating a new Node.js project...
|
||||
echo Project name: !PROJECT_NAME!
|
||||
echo Version: 1.0.0
|
||||
echo Description: Node.js project
|
||||
echo Entry point: server_monitor_bot.js
|
||||
echo Test command:
|
||||
echo Git repository: https://git.viper.ipv64.net/M_Viper/telegram_server_monitoring
|
||||
echo Keywords:
|
||||
echo Author: M_Viper
|
||||
echo License: ISC
|
||||
|
||||
npm init -y
|
||||
|
||||
REM Installieren Sie die benötigten Pakete
|
||||
npm install ping
|
||||
npm install node-telegram-bot-api
|
||||
npm install js-yaml
|
||||
npm install moment
|
||||
npm install yml
|
||||
npm install dotenv
|
||||
npm install fs
|
||||
npm install request
|
||||
|
||||
REM Installieren Sie pm2, wenn es noch nicht installiert ist
|
||||
where pm2 >nul 2>nul
|
||||
if %errorlevel% neq 0 (
|
||||
npm install pm2 -g
|
||||
)
|
||||
|
||||
REM Erstellen Sie ein Startskript für den Bot
|
||||
echo Creating start script...
|
||||
echo #!/bin/bash > start_bot.sh
|
||||
echo pm2 start server_monitor_bot.js >> start_bot.sh
|
||||
echo chmod +x start_bot.sh
|
||||
|
||||
REM Erstellen Sie ein Autostart-Skript für den Bot
|
||||
echo Creating autostart script...
|
||||
echo [Unit] > telegram_bot.service
|
||||
echo Description=Telegram Server Monitoring Bot >> telegram_bot.service
|
||||
echo [Service] >> telegram_bot.service
|
||||
echo ExecStart=/path/to/start_bot.sh >> telegram_bot.service
|
||||
echo [Install] >> telegram_bot.service
|
||||
echo WantedBy=default.target >> telegram_bot.service
|
||||
move telegram_bot.service "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\"
|
||||
|
||||
REM Erstellen Sie die benötigten Dateien
|
||||
type nul > user_information.yml
|
||||
type nul > error.log
|
||||
type nul > configurations.yml
|
||||
|
||||
REM Erstellen Sie das Desktop-Icon
|
||||
set shortcutPath=%USERPROFILE%\Desktop\TelegramBot.lnk
|
||||
set targetPath=%cd%\start_bot.sh
|
||||
|
||||
echo [InternetShortcut] >"%shortcutPath%"
|
||||
echo URL=file:///%targetPath% >>"%shortcutPath%"
|
||||
echo IconFile=%SystemRoot%\System32\imageres.dll >>"%shortcutPath%"
|
||||
echo IconIndex=112 >>"%shortcutPath%"
|
||||
|
||||
echo Desktop-Icon wurde erstellt: %shortcutPath%
|
||||
Reference in New Issue
Block a user