initializare
This commit is contained in:
81
deployment/windows/scripts/run_telegram_bot_manual.ps1
Normal file
81
deployment/windows/scripts/run_telegram_bot_manual.ps1
Normal file
@@ -0,0 +1,81 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Telegram Trigger Bot pentru BTGO - Rulare Manuala
|
||||
.DESCRIPTION
|
||||
Ruleaza Telegram bot-ul in modul manual (nu ca serviciu Windows)
|
||||
.NOTES
|
||||
Echivalent PowerShell pentru scripts\run_telegram_bot.bat
|
||||
Rulare: Right-click → "Run with PowerShell"
|
||||
Pentru a opri: Ctrl+C
|
||||
#>
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ScriptDir = Split-Path -Parent $PSCommandPath
|
||||
$ProjectDir = Resolve-Path (Join-Path $ScriptDir "..\..\..") | Select-Object -ExpandProperty Path
|
||||
|
||||
Set-Location $ProjectDir
|
||||
|
||||
Write-Host ""
|
||||
Write-Host ("=" * 80) -ForegroundColor Cyan
|
||||
Write-Host " TELEGRAM TRIGGER BOT PENTRU BTGO" -ForegroundColor Yellow
|
||||
Write-Host ("=" * 80) -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Working directory: $ProjectDir" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
|
||||
# Verifică dacă venv există
|
||||
$venvPath = Join-Path $ProjectDir ".venv"
|
||||
$activateScript = Join-Path $venvPath "Scripts\Activate.ps1"
|
||||
|
||||
if (-not (Test-Path $activateScript)) {
|
||||
Write-Host "[ERROR] Virtual environment nu exista!" -ForegroundColor Red
|
||||
Write-Host "Ruleaza intai: setup_dev.ps1" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
Read-Host "Apasa Enter pentru a inchide"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Activează venv
|
||||
Write-Host "Activare virtual environment..." -ForegroundColor Cyan
|
||||
try {
|
||||
& $activateScript
|
||||
Write-Host "[OK] Virtual environment activat." -ForegroundColor Green
|
||||
Write-Host ""
|
||||
} catch {
|
||||
Write-Host "[ERROR] Nu am putut activa venv!" -ForegroundColor Red
|
||||
Write-Host "Eroare: $_" -ForegroundColor Red
|
||||
Write-Host ""
|
||||
Read-Host "Apasa Enter pentru a inchide"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Verifică .env
|
||||
$envFile = Join-Path $ProjectDir ".env"
|
||||
|
||||
if (-not (Test-Path $envFile)) {
|
||||
Write-Host "[ERROR] Fisierul .env nu exista!" -ForegroundColor Red
|
||||
Write-Host "Configureaza .env cu TELEGRAM_BOT_TOKEN si TELEGRAM_ALLOWED_USER_IDS" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
Read-Host "Apasa Enter pentru a inchide"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host ("=" * 80) -ForegroundColor Cyan
|
||||
Write-Host "Pornire Telegram Bot..." -ForegroundColor Yellow
|
||||
Write-Host "Bot-ul va astepta comenzi /scrape" -ForegroundColor Gray
|
||||
Write-Host "Apasa Ctrl+C pentru a opri bot-ul" -ForegroundColor Yellow
|
||||
Write-Host ("=" * 80) -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
try {
|
||||
& python telegram_trigger_bot.py
|
||||
} catch {
|
||||
Write-Host ""
|
||||
Write-Host "[ERROR] Executie esuata: $_" -ForegroundColor Red
|
||||
Write-Host ""
|
||||
Read-Host "Apasa Enter pentru a inchide"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Read-Host "Apasa Enter pentru a inchide"
|
||||
Reference in New Issue
Block a user