blob: 6bab090c00965dad141fd822464a441d050158c1 (
plain)
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
|
/**
* The core / global reference object
*
* Version: v2.0.0
* Developer: Marzavec ( https://github.com/marzavec )
* License: WTFPL ( http://www.wtfpl.net/txt/copying/ )
*
*/
const path = require('path');
const {
CommandManager,
ConfigManager,
ImportsManager,
MainServer,
StatsManager
} = require('./');
class CoreApp {
/**
* Create the main core instance.
*/
constructor () {
}
async init () {
await this.buildConfigManager();
this.buildImportManager();
this.buildCommandsManager();
this.buildStatsManager();
this.buildMainServer();
}
async buildConfigManager () {
this.configManager = new ConfigManager(path.join(__dirname, '../..'));
this.config = await this.configManager.load();
if (this.config === false) {
console.error('Missing config.json, have you run: npm run config');
process.exit(0);
}
}
buildImportManager () {
this.dynamicImports = new ImportsManager(path.join(__dirname, '../..'));
}
buildCommandsManager () {
this.commands = new CommandManager(this);
this.commands.loadCommands();
}
buildStatsManager () {
this.stats = new StatsManager(this);
this.stats.set('start-time', process.hrtime());
}
buildMainServer () {
this.server = new MainServer(this);
}
}
module.exports = CoreApp;
|