-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathindex.js
36 lines (28 loc) · 876 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// @ts-check
'use strict';
// NeDB on life support
// some util methods are removed in node 23.x, monkeypatch them
const util = require('util');
const patch_methods = [ 'isDate', 'isRegExp' ];
for (let i = 0; i < patch_methods.length; i++) {
util[patch_methods[i]] = util.types[patch_methods[i]];
}
util.isArray = Array.isArray;
process.chdir(__dirname);
require('ts-node').register({ transpileOnly: true });
// Make sure data folder exists
const fs = require('fs');
fs.mkdirSync('./data', { recursive: true });
// Utils
const { logError } = require('./utils/log');
const bot = require('./bot');
bot.use(
require('./handlers/middlewares'),
require('./plugins'),
require('./handlers/commands'),
require('./handlers/regex'),
require('./handlers/unmatched'),
);
bot.catch(logError);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
bot.launch();