accomodations for API integration

This commit is contained in:
Erik 2021-06-06 16:30:53 +03:00
parent fd4c6a44f5
commit 44251ed305
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16
3 changed files with 9 additions and 7 deletions

View File

@ -38,9 +38,11 @@ class Manager extends EventEmitter {
// G:\Documents\My programs\GBot\New GBot\api\index.cjs
this.info('Shards done, booting up API...');
const { default: APIManager } = await import('./api/index.js').catch((err) => this.error(`Import of API Manager failed.\n${err.stack}`));
this.apiManager = new APIManager(this);
await this.apiManager.init();
this.info('API done. Manager built.');
if (APIManager) {
this.apiManager = new APIManager(this);
await this.apiManager.init();
this.info('API done. Manager built.');
} else this.info('Missing API source, skipping');
this._built = true;
this.emit('built');

View File

@ -47,10 +47,10 @@ class Logger {
}
write(type = 'silly', string = '', shard = null) {
write(type = 'silly', string = '', shard = null, api = false) {
const color = Constants.Colors[type];
const header = `${chalk[color](`[${this.date}][${shard ? `shard${this._shardId(shard)}` : 'manager'}]`)}`;
const header = `${chalk[color](`[${this.date}][${shard ? `${api ? 'api-' : ''}shard${this._shardId(shard)}` : `${api ? 'api-' : ''}manager`}]`)}`;
this.logger.log(type, `${header} : ${string}`);
@ -60,7 +60,7 @@ class Logger {
//Messages coming from the shards process.send functions.
_handleMessage(shard, message) {
this.write(message.type, message.message, shard);
this.write(message.type, message.message, shard, message._api);
}

View File

@ -104,7 +104,7 @@ class MessageCache extends Observer {
if(message.attachments.size > 0
&& message.guild.premium >= 2
&& messageLog.channel
&& !messageLog.ignoredChannels.includes(message.channel.id)
&& !messageLog.ignore.includes(message.channel.id)
&& !ignoredRole) {
let size = 0;