-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.ps1
73 lines (64 loc) · 2.07 KB
/
start.ps1
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
# PowerShell script equivalent to your batch script
$file_path = "exports.ts"
$JS_FILE = "exports.ts"
# Check if yandexToken exists
$yandexTokenFound = Select-String -Path $JS_FILE -Pattern "const yandexToken"
if ($yandexTokenFound) {
Write-Host "yandexToken found."
}
else {
Write-Host "yandexToken not found."
}
# Check if discordClientToken exists
$discordTokenFound = Select-String -Path $JS_FILE -Pattern "const discordClientToken"
if ($discordTokenFound) {
Write-Host "discordClientToken found."
}
else {
Write-Host "discordClientToken not found."
}
# Write-Host "Enter 1 to add yandexToken"
# Write-Host "Enter 2 to add discordClientToken"
# Write-Host "Enter start to initiate program"
# # Get user input
# $UserInput = Read-Host "Type what do you want to do"
$continueLoop = $true
while ($continueLoop) {
Write-Host "Enter 1 to add yandexToken"
Write-Host "Enter 2 to add discordClientToken"
Write-Host "Enter start to initiate program"
# Get user input
$UserInput = Read-Host "Type what do you want to do"
switch ($UserInput) {
1 {
Clear-Host
Write-Host "Setting yandex token"
$yandexToken = Read-Host "Set yandex token"
Write-Host "$yandexToken"
Add-Content -Path $file_path -Value "const yandexToken = ""$yandexToken"";"
break
}
2 {
Clear-Host
Write-Host "Setting discord token"
$discordToken = Read-Host "Set discord client token"
Write-Host "$discordToken"
Add-Content -Path $file_path -Value "const discordClientToken = ""$discordToken"";"
break
}
start {
Write-Host "Initiating program."
ts-node src/index.ts RPC
break
}
default {
Write-Host "`"$UserInput`" is not a valid option."
break
}
}
# Ask if the user wants to continue
$continue = Read-Host "Do you want to perform another action? (yes/no)"
if ($continue -ne "yes") {
$continueLoop = $false
}
}