2020-03-17 01:37:54 +01:00
|
|
|
import makeDir from 'make-dir';
|
2020-03-17 18:30:27 +01:00
|
|
|
import path from 'path';
|
2020-03-17 01:37:54 +01:00
|
|
|
import container from './inversify.config';
|
2020-03-13 04:41:26 +01:00
|
|
|
import {TYPES} from './types';
|
|
|
|
import Bot from './bot';
|
2020-03-17 01:37:54 +01:00
|
|
|
import {sequelize} from './utils/db';
|
2021-09-20 01:50:25 +02:00
|
|
|
import Config from './services/config';
|
2020-03-09 17:57:39 +01:00
|
|
|
|
2021-09-20 01:50:25 +02:00
|
|
|
const bot = container.get<Bot>(TYPES.Bot);
|
2020-10-31 15:42:06 +01:00
|
|
|
|
|
|
|
(async () => {
|
2020-03-17 01:37:54 +01:00
|
|
|
// Create data directories if necessary
|
2021-09-20 01:50:25 +02:00
|
|
|
const config = container.get<Config>(TYPES.Config);
|
|
|
|
|
|
|
|
await makeDir(config.DATA_DIR);
|
|
|
|
await makeDir(config.CACHE_DIR);
|
|
|
|
await makeDir(path.join(config.CACHE_DIR, 'tmp'));
|
2020-03-17 01:37:54 +01:00
|
|
|
|
|
|
|
await sequelize.sync({});
|
|
|
|
|
2020-05-31 04:37:40 +02:00
|
|
|
await bot.listen();
|
2020-03-13 04:41:26 +01:00
|
|
|
})();
|