-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
44 lines (36 loc) · 1.26 KB
/
index.js
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
var path = require('path');
require('console-stamp')(console, 'mm-dd HH:MM:ss');
const readline = require('readline');
const fs = require('fs')
global.appRoot = path.resolve(__dirname);
global.setupUser = ""
global.setupPassword = ""
if (!fs.existsSync('data/db.json')) {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('Please type a username: ', (answer) => {
global.setupUser = answer
rl.question('Please type a password: ', (answer) => {
global.setupPassword = answer
rl.close();
fs.closeSync(fs.openSync('data/db.json', 'w'));
const Backend = require('./modules/backend')
Backend.startServer()
global.bot = require('./modules/bot');
console.log("\nPlease go to http://localhost:1337 and login using the credentials provided")
console.log("\nMake sure to provide a Token and the Guild ID of your bot")
})
})
}
else{
global.bot = require('./modules/bot');
const DB = require('./modules/db')
var botToken = DB.getBotData().token
if(botToken){
bot.login(botToken)
}
const Backend = require('./modules/backend')
Backend.startServer()
}