From 23d6ed821220d95f7a26ac3e40485b19324e2070 Mon Sep 17 00:00:00 2001 From: Navy Date: Wed, 9 Jun 2021 03:19:22 +0300 Subject: [PATCH] fix API import errors when missing files --- Manager.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Manager.js b/Manager.js index ff0723b..105b388 100644 --- a/Manager.js +++ b/Manager.js @@ -41,8 +41,9 @@ class Manager extends EventEmitter { await this.shardManager.spawn(); // 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}`)); - if (APIManager) { + const API = await import('./api/index.js').catch((err) => this.error(`Import of API Manager failed.\n${err.stack}`)); + if (API) { + const { default: APIManager } = API; this.apiManager = new APIManager(this); await this.apiManager.init(); this.info('API done. Manager built.'); @@ -91,6 +92,7 @@ class Manager extends EventEmitter { const { type } = message; switch (type) { case 'statsQuery': + break; // TODO: Figure out best strategy for stats querying - push/pull, prometheus, simple polling //return this.aggregateStatistics(); }