forked from Galactic/galactic-bot
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
const { EventEmitter } = require('events');
|
|
|
|
const ShardManager = require('./middleware/ShardManager.js');
|
|
const StorageManager = require('./storage/StorageManager.js');
|
|
const Registry = require('./Registry.js');
|
|
const Intercom = require('./Intercom.js');
|
|
const Logger = require('./Logger.js');
|
|
|
|
const { Command, Setting, Inhibitor } = require('./structure/interfaces/');
|
|
|
|
class Manager extends EventEmitter {
|
|
|
|
constructor(options) {
|
|
|
|
super();
|
|
|
|
this.registry = new Registry(this);
|
|
this.shardManager = new ShardManager('./middleware/client/DiscordClient.js', options);
|
|
this.storageManager = new StorageManager(this, options.storage)
|
|
.initialize();
|
|
|
|
this.intercom = new Intercom(this, this.shardManager);
|
|
|
|
this.logger = new Logger(this);
|
|
|
|
this._built = false;
|
|
|
|
}
|
|
|
|
async build() {
|
|
try {
|
|
await this.shardManager.spawn();
|
|
}catch(e) {
|
|
console.log(e);
|
|
}
|
|
await this.registry.loadComponents('components/commands/', Command);
|
|
|
|
|
|
this._built = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Manager; |