muse/src/index.ts

23 lines
598 B
TypeScript
Raw Normal View History

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';
import container from './inversify.config.js';
import {TYPES} from './types.js';
import Bot from './bot.js';
import {sequelize} from './utils/db.js';
import Config from './services/config.js';
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({alter: true});
2020-03-17 01:37:54 +01:00
2020-05-31 04:37:40 +02:00
await bot.listen();
2020-03-13 04:41:26 +01:00
})();