-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstall.ps1
More file actions
85 lines (69 loc) · 4.19 KB
/
install.ps1
File metadata and controls
85 lines (69 loc) · 4.19 KB
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
Set-ExecutionPolicy Unrestricted -Scope Process
Clear-Host
Write-Output "
██████╗ ██████╗ ███╗ ███╗ ██████╗ ██████╗ ██╗ ██╗██╗ █████╗ ██████╗
██╔══██╗██╔══██╗████╗ ████║██╔═══██╗██╔══██╗██║ ██║██║ ██╔══██╗██╔══██╗
██████╔╝██████╔╝██╔████╔██║██║ ██║██║ ██║██║ ██║██║ ███████║██████╔╝
██╔═══╝ ██╔══██╗██║╚██╔╝██║██║ ██║██║ ██║██║ ██║██║ ██╔══██║██╔══██╗
██║ ██████╔╝██║ ╚═╝ ██║╚██████╔╝██████╔╝╚██████╔╝███████╗██║ ██║██║ ██║
╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
"
git clone https://github.com/PBModular/bot PBModular
if ($LASTEXITCODE -ne 0) {
Write-Error "Git clone failed. Exiting."
exit 1
}
cd PBModular
if (-not (Test-Path "venv")) {
python -m venv venv
if ($LASTEXITCODE -ne 0) {
Write-Error "Virtual environment creation failed. Exiting."
exit 1
}
}
.\venv\Scripts\Activate.ps1
if ($LASTEXITCODE -ne 0) {
Write-Error "Virtual environment activation failed. Exiting."
exit 1
}
pip install --upgrade pip
if ($LASTEXITCODE -ne 0) {
Write-Error "Pip upgrade failed. Exiting."
exit 1
}
(Get-Content -Path "requirements.txt") | Where-Object { $_ -notmatch 'uvloop' } | Set-Content -Path "requirements.txt"
pip install -r requirements.txt
if ($LASTEXITCODE -ne 0) {
Write-Error "Dependency installation failed. Exiting."
exit 1
}
if (-not (Test-Path "config.yaml")) {
Copy-Item config.example.yaml config.yaml
if ($LASTEXITCODE -ne 0) {
Write-Error "Config file copy failed. Exiting."
exit 1
}
}
Clear-Host
Write-Output "
██████╗ ██████╗ ███╗ ███╗ ██████╗ ██████╗ ██╗ ██╗██╗ █████╗ ██████╗
██╔══██╗██╔══██╗████╗ ████║██╔═══██╗██╔══██╗██║ ██║██║ ██╔══██╗██╔══██╗
██████╔╝██████╔╝██╔████╔██║██║ ██║██║ ██║██║ ██║██║ ███████║██████╔╝
██╔═══╝ ██╔══██╗██║╚██╔╝██║██║ ██║██║ ██║██║ ██║██║ ██╔══██║██╔══██╗
██║ ██████╔╝██║ ╚═╝ ██║╚██████╔╝██████╔╝╚██████╔╝███████╗██║ ██║██║ ██║
╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
"
$bottoken = Read-Host "Enter bot token: "
$api_id = Read-Host "Enter API ID: "
$api_hash = Read-Host "Enter API Hash: "
$username = Read-Host "Enter your Telegram username/ID: "
$language = Read-Host "Choose your language (ru/en/ua): "
$configContent = Get-Content -Path "config.yaml"
$configContent -replace 'token: null', "token: $bottoken" |
ForEach-Object { $_ -replace 'api-id: null', "api-id: $api_id" } |
ForEach-Object { $_ -replace 'api-hash: null', "api-hash: $api_hash" } |
ForEach-Object { $_ -replace 'owner: "sanyapilot"', "owner: `"$username`"" } |
ForEach-Object { $_ -replace 'language: ru', "language: $language" } |
Set-Content -Path "config.yaml"
Clear-Host
python .\main.py