-
Notifications
You must be signed in to change notification settings - Fork 1
/
raven.ps1
77 lines (72 loc) · 2.72 KB
/
raven.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
74
75
76
77
$VerbosePreference = 'SilentlyContinue'
$ErrorActionPreference = 'Stop'
echo "Welcome to Raven!"
echo ""
# define vars
$SESSION_PS1_URL = "https://raw.githubusercontent.com/TeamUltroid/Ultroid/master/session.ps1"
$INSTALLER_PS1_URL = "https://raw.githubusercontent.com/TeamUltroid/Ultroid/master/scripts/windows/installer.ps1"
# arguements
$arg = $args[0]
# args switch case
switch ($arg)
{
"--help" {
echo "List of arguments:"
echo " --help: Show this help message"
echo " install: Install Raven"
echo " session: Generate session for Raven"
echo " start: Start Raven bot"
}
$null {
echo "No arguement provided"
echo "Use --help to see the list of arguments."
}
"install" {
# check if --help
if ($args[1] -eq "--help") {
echo "Usage: ./raven.ps1 install [Options]"
echo "Options:"
echo " --help: Show this help message"
} else {
# check if installer.ps1 exists in scripts/windows
if (Test-Path -Path "scripts\windows\installer.ps1") {
echo "installer.ps1 exists"
echo "Running installer.ps1"
Set-ExecutionPolicy Bypass -Scope Process -Force ; . .\scripts\windows\installer.ps1
} else {
echo "Fetching installer.ps1"
# fetch and run installer.ps1 without downloading
Set-ExecutionPolicy Bypass -Scope Process -Force ; Invoke-WebRequest -Uri $INSTALLER_PS1_URL | Invoke-Expression
}
}
}
"session" {
# check if session.ps1 exists in root directory
if (Test-Path -Path "scripts\windows\session.ps1") {
echo "session.ps1 exists"
echo "Running session.ps1"
Set-ExecutionPolicy Bypass -Scope Process -Force ; . .\scripts\windows\session.ps1
} else {
echo "Fetching session.ps1"
# fetch and run session.ps1 without downloading
Set-ExecutionPolicy Bypass -Scope Process -Force ; Invoke-WebRequest -Uri $SESSION_PS1_URL | Invoke-Expression
}
}
"start" {
# check arguement if --help
if ($args[1] -eq "--help") {
echo "Usage: ./raven.ps1 start [Options]"
echo "Options:"
echo " --help: Show this help message"
echo " --http-server: Start the bot with http server"
} else {
# directly running assuming that the bot is already installed
echo "Starting Raven"
Set-ExecutionPolicy Bypass -Scope Process -Force ; . .\scripts\windows\start.ps1
}
}
default {
echo "Invalid arguement provided"
echo "Use --help to see the list of arguments."
}
}