From 44251ed3052600115488a0da0544749337fbba4a Mon Sep 17 00:00:00 2001 From: Navy Date: Sun, 6 Jun 2021 16:30:53 +0300 Subject: [PATCH] accomodations for API integration --- Manager.js | 8 +++++--- middleware/logger/Logger.js | 6 +++--- structure/client/components/observers/MessageCache.js | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Manager.js b/Manager.js index ffc70d0..5e3fc9e 100644 --- a/Manager.js +++ b/Manager.js @@ -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'); diff --git a/middleware/logger/Logger.js b/middleware/logger/Logger.js index 04d9339..0a730a4 100644 --- a/middleware/logger/Logger.js +++ b/middleware/logger/Logger.js @@ -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); } diff --git a/structure/client/components/observers/MessageCache.js b/structure/client/components/observers/MessageCache.js index 1e28fa2..31262f5 100644 --- a/structure/client/components/observers/MessageCache.js +++ b/structure/client/components/observers/MessageCache.js @@ -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;