Public/Install-BATCRelayBot.ps1
|
#Requires -Version 5.1 function Install-BATCRelayBot { <# .SYNOPSIS Installs BATCRelayBot with 6-phase industry-standard installer flow. .DESCRIPTION Guides user through complete installation with: - Phase 1: Silently detect all prerequisites - Phase 2: Display prerequisite status - Phase 3: Collect Discord configuration - Phase 4: Review selections before install - Phase 5: Execute installation - Phase 6: Display success and next steps No admin rights required. .PARAMETER BotPath Installation path for bot files. Defaults to $env:USERPROFILE\AppData\Local\BATCRelayBot .EXAMPLE Install-BATCRelayBot .EXAMPLE Install-BATCRelayBot -BotPath "D:\MyBot" #> param( [string]$BotPath = "$env:USERPROFILE\AppData\Local\BATCRelayBot" ) $ErrorActionPreference = "Stop" Write-Host "" Write-Host "========================================" -ForegroundColor Cyan Write-Host " BATCRelayBot Installation (v1.3.13)" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" try { # PHASE 1: Silent prerequisites detection Write-Host "[Phase 1] Detecting prerequisites..." -ForegroundColor Gray $prerequisites = @{ Python = Find-Python FFmpeg = Find-FFmpeg VoiceMeeter = Find-VoiceMeeter BeyondATC = Find-BeyondATC } Write-Host "Prerequisites detected" -ForegroundColor Green Write-Host "" # PHASE 2: Display info screen Write-Host "[Phase 2] Prerequisite Status" -ForegroundColor Gray Show-PrerequisitesInfo Write-Host "" # PHASE 3: Collect Discord configuration Write-Host "[Phase 3] Discord Configuration" -ForegroundColor Gray $discordConfig = Get-DiscordConfiguration if (-not $discordConfig) { Write-Host "ERROR: Could not collect Discord configuration" -ForegroundColor Red exit 1 } Write-Host "" # PHASE 4: Display summary before installing Write-Host "[Phase 4] Installation Summary" -ForegroundColor Gray $summary = Show-InstallationSummary -Prerequisites $prerequisites -DiscordConfig $discordConfig if (-not $summary.CanProceed) { Write-Host "" Write-Host "Installation cannot proceed. Check requirements above." -ForegroundColor Red exit 1 } Write-Host "" Write-Host "Ready to install?" -ForegroundColor Cyan $confirm = Read-Host "Type 'yes' to proceed, or anything else to cancel" if ($confirm -ne "yes") { Write-Host "Installation cancelled." -ForegroundColor Yellow exit 0 } Write-Host "" # PHASE 5: Execute installation Write-Host "[Phase 5] Installing..." -ForegroundColor Gray $installResult = Start-Installation -Prerequisites $prerequisites -DiscordConfig $discordConfig if (-not $installResult.Success) { Write-Host "Installation failed" -ForegroundColor Red exit 1 } # PHASE 6: Success message and next steps Write-Host "[Phase 6] Installation Complete" -ForegroundColor Gray Show-PostInstallationMessage ` -InstallPath $installResult.InstallPath ` -ConfigPath $installResult.ConfigPath ` -LogPath $installResult.LogPath Write-Host "" Write-Host "Installation finished successfully!" -ForegroundColor Green Write-Host "Log file: $($installResult.LogPath)" -ForegroundColor Gray } catch { Write-Host "" Write-Host "ERROR: Installation failed" -ForegroundColor Red Write-Host $_.Exception.Message -ForegroundColor Red Write-Host "" Write-Host "For troubleshooting, check the installation log." -ForegroundColor Yellow if ($installResult.LogPath) { Write-Host "Log: $($installResult.LogPath)" -ForegroundColor Gray } exit 1 } Write-Host "" } Export-ModuleMember -Function Install-BATCRelayBot |