add option to disable api loading

This commit is contained in:
Erik 2022-04-22 18:12:06 +03:00
parent c5d2b292aa
commit c15530dc90
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 5 additions and 2 deletions

View File

@ -46,6 +46,7 @@
}
},
"api": {
"load": false,
"http": {
"port": 5000
},

View File

@ -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');