From c15530dc9021fa9a0d270c241ea3b8b82b615052 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 22 Apr 2022 18:12:06 +0300 Subject: [PATCH] add option to disable api loading --- options.json | 1 + src/middleware/BaseClient.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/options.json b/options.json index 2158201..d3aca0c 100644 --- a/options.json +++ b/options.json @@ -46,6 +46,7 @@ } }, "api": { + "load": false, "http": { "port": 5000 }, diff --git a/src/middleware/BaseClient.js b/src/middleware/BaseClient.js index 1005df3..5fa8c6c 100644 --- a/src/middleware/BaseClient.js +++ b/src/middleware/BaseClient.js @@ -37,8 +37,10 @@ class BaseClient extends EventEmitter { process.exit(); // Prevent a boot loop when shards die due to an error in the client }); - const API = await import('/Documents/My programs/GBot/api/index.js') - .catch(() => this.logger.warn(`Error importing API files, continuing without`)); + this.logger.status('Shards spawned'); + + const API = this._options.api.load ? await import('/Documents/My programs/GBot/api/index.js') + .catch(() => this.logger.warn(`Error importing API files, continuing without`)) : null; // const API = await import('./api/index.js').catch(() => this.logger.warn(`Error importing API files, continuing without`)); if (API) { this.logger.info('Booting up API');