attempt to query database before loading bot
This commit is contained in:
parent
9940d21e42
commit
1ec1b927fb
1 changed files with 10 additions and 3 deletions
13
src/index.ts
13
src/index.ts
|
@ -12,6 +12,13 @@ login(client);
|
|||
|
||||
export { client }
|
||||
|
||||
// Load modules
|
||||
import('./bot/modules/command_handler');
|
||||
import('./bot/modules/mod_logs');
|
||||
(async () => {
|
||||
// Wait for a database query to succeed before loading the rest
|
||||
logger.info('Connecting to database...');
|
||||
await db.get('servers').findOne({});
|
||||
logger.done('DB ready!');
|
||||
|
||||
// Load modules
|
||||
import('./bot/modules/command_handler');
|
||||
import('./bot/modules/mod_logs');
|
||||
})();
|
||||
|
|
Loading…
Reference in a new issue