-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.cpp
154 lines (139 loc) · 5.53 KB
/
installer.cpp
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
//Created by @NiceygyLive && @MDxWAARRIORxOP
#include <iostream>
#include <stdlib.h>
#include <windows.h>
#include <cstdio>
#pragma comment(lib, "Urlmon.lib")
using namespace std;
int help()
{
std::cout << "HELP MENU: Select one to download & Install\n";
std::cout << "Discord bot (Discord)\n";
std::cout << "Youtube bot (Youtube)\n";
std::cout << "Twitch bot (Twitch)\n";
std::cout << "You need git to run this installer!\n";
return true;
};
int downloadComplete()
{
std::cout << "Downloaded and installed! I have also installed the node modules for you. Rename `Config-template.json` to `config.json`, fill out the values and run `npm run start`! \n You can now close this installer.\n";
return true;
};
int downloadFile(string downloadType)
{
if (downloadType == "discord") {
std::string git = "git clone https://github.com/UFO-Studios/Alienbot-Discord.git ";
const char * cGit = git.c_str();
const char * GString = cGit;
system(GString);
return true;
} else if (downloadType == "youtube") {
std::string git = "git clone https://github.com/UFO-Studios/Alienbot-youtube.git";
const char * cGit = git.c_str();
const char * GString = cGit;
system(GString);
return true;
} else if (downloadType == "twitch") {
std::string git = "git clone https://github.com/UFO-Studios/Alienbot-Twitch.git";
const char * cGit = git.c_str();
const char * GString = cGit;
system(GString);
return true;
} else {
std::cout << "Error: Invalid download type";
};
};
int installNodeModules(string packageManager, string botType)
{
if (packageManager == "npm"){
std::string npm = "cd Alienbot-" + botType + " && npm install";
const char * cNpm = npm.c_str();
const char * NpmString = cNpm;
system(NpmString);
} else if (packageManager == "yarn"){
std::string npm = "cd Alienbot- " + botType + " && yarn install";
const char * cNpm = npm.c_str();
const char * NpmString = cNpm;
system(NpmString);
} else if (packageManager == "pnpm"){
std::string npm = "cd Alienbot-" + botType + " && pnpm install";
const char * cNpm = npm.c_str();
const char * NpmString = cNpm;
system(NpmString);
} else {
std::cout << "Error: Invalid package manager";
}
return true;
};
int credits ()
{
std::cout << " AA L III EEEE N N BBBB OOO TTTTTT \n";
std::cout << "A A L I E NN N B B O O TT \n";
std::cout << "AAAA L I EEE N N N BBBB O O TT \n";
std::cout << "A A L I E N NN B B O O TT \n";
std::cout << "A A LLLL III EEEE N N BBBB OOO TT \n";
std::cout << "Made by NiceygyLive and MDxWAARRIORxOP\n";
std::cout << "Niceygy: @NiceygyLive (most platforms)\n";
std::cout << "MDxWAARRIORxOP: @MDxWARRIORxOP or Kingerious (most platforms)\n";
std::cout << "Copyright UFO Studios 2022. To see more refer to LICENCE in the github repo\n";
std::cout << "Report any errors or issues to the repo. Thanks for using this software!\n";
return true;
}
int main()
{
std::cout << "Loading system... Please stand by\n";
//Any future loading things go here
std::cout << "Loaded! What would you like to install?\n";
std::cout << "Type `help` to see all options & type `credits` to see credits\n";
std::cout << "Make sure this installer is in the folder you want to install to!\n";
std::string operation;
std::cin >> operation;
//FOR DEBUG std::cout << "You asked for " + operation;
if (operation == "help")
{
help();
}
if (operation == "credits")
{
credits();
} else {
std::cout << "Please select your package manager for nodeJS (If you dont know what this is, type `npm`)\n Possible options:\n npm\n yarn\n pnpm\n";
std::string packageManager;
std::cin >> packageManager;
std::cout << "Unfortunatly you cannot select the install location in this version, please make sure the installer is in a empty directory!\n";
//std::string installDIRusr;
//std::cin >> installDIRusr;
{
if (operation == "discord")
{
std::cout << "Downloading...";
downloadFile("discord");
std::cout << "Downloaded! Installing node modules...";
installNodeModules(packageManager, "Discord");
} else if (operation == "twitch")
{
downloadFile("twitch");
std::cout << "Downloaded! Installing node modules...";
installNodeModules(packageManager, "Twitch");
} else if (operation == "youtube")
{
downloadFile("youtube");
std::cout << "Downloaded! Installing node modules...";
installNodeModules(packageManager, "Youtube");
} else {
std::cout << "Error: Invalid download type";
//abort();
};
downloadComplete();
};
};
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file