-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdebug.ps1
46 lines (39 loc) · 1.15 KB
/
debug.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
$StartBot = {
cls
# First check for the log.ansi file, then rename it if needed.
if (!(Test-Path ./logs/)) {
mkdir ./logs/ | Out-Null
}
if (Test-Path ./logs/log.ansi) {
ren ./logs/log.ansi "Log $((get-date).toString('dd-MM-yyyy HH;mm;ss')).ansi" | Out-Null
echo "[SCRIPT] Previous log file found, renaming to current date and time!" | tee -a ./logs/log.ansi
}
# Start the bot, then log everything.
echo "[SCRIPT] Running bot!" | tee -a ./logs/log.ansi
node . | tee -a ./logs/log.ansi
# echo "Bot should run here..."
# pause
# Option for restarting - "-eq 7" is a no, while "-eq 6" is yes.
echo "[SCRIPT] Bot crashed or was stopped intentionally" | tee -a ./logs/log.ansi
$wshell = New-Object -ComObject Wscript.Shell
$answer = $wshell.Popup("Restart bot?", 0, "bot gone", 32 + 4)
# if($answer -eq 7) {
# echo "Answer is 7"
# }
if ($answer -eq 6) {
&$StartBot
}
else {
# using else instead of 2 ifs because i can't be bothered, both should work
&$Exit
}
}
$Exit = {
cls
exit
}
&$StartBot
echo "Hey, you might have run into an error! The script is not supposed to run this part!"
echo "Press any key to exit"
pause | Out-Null
exit