muse/src/index.ts

25 lines
678 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 Config from './services/config.js';
import FileCacheProvider from './services/file-cache.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
2022-01-05 21:30:32 +01:00
const startBot = 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 container.get<FileCacheProvider>(TYPES.FileCache).cleanup();
2020-05-31 04:37:40 +02:00
await bot.listen();
2022-01-05 21:30:32 +01:00
};
export {startBot};