2022-01-04 23:05:52 +00:00
|
|
|
import { config } from 'dotenv';
|
|
|
|
config();
|
2021-10-08 21:36:46 +00:00
|
|
|
|
|
|
|
import logger from './bot/logger';
|
|
|
|
import AutomodClient, { login } from './struct/AutomodClient';
|
|
|
|
import MongoDB from './bot/db';
|
|
|
|
|
|
|
|
logger.info('Initializing client');
|
|
|
|
|
|
|
|
let db = MongoDB();
|
2022-02-05 14:59:45 +00:00
|
|
|
let client = new AutomodClient({
|
|
|
|
pongTimeout: 10,
|
|
|
|
onPongTimeout: 'RECONNECT',
|
|
|
|
fixReplyCrash: true,
|
|
|
|
messageTimeoutFix: true
|
|
|
|
}, db);
|
2021-10-08 21:36:46 +00:00
|
|
|
login(client);
|
|
|
|
|
|
|
|
export { client }
|
|
|
|
|
2021-12-05 14:16:41 +00:00
|
|
|
(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');
|
2021-12-06 19:03:17 +00:00
|
|
|
import('./bot/modules/event_handler');
|
|
|
|
import('./bot/modules/tempbans');
|
2021-12-09 21:04:33 +00:00
|
|
|
import('./bot/modules/user_scan');
|
2022-01-22 21:37:59 +00:00
|
|
|
import('./bot/modules/api_communication');
|
2022-02-12 14:25:24 +00:00
|
|
|
import('./bot/modules/metrics');
|
2021-12-05 14:16:41 +00:00
|
|
|
})();
|