2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-22 18:08:51 +00:00
the-guard-bot/index.js

37 lines
876 B
JavaScript
Raw Normal View History

2020-05-13 22:59:23 +02:00
// @ts-check
2017-07-24 17:12:38 +02:00
'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]];
2024-12-02 12:50:11 +01:00
}
util.isArray = Array.isArray;
2024-12-02 12:50:11 +01:00
2019-03-18 19:05:16 +01:00
process.chdir(__dirname);
2020-04-29 18:01:53 +02:00
require('ts-node').register({ transpileOnly: true });
2019-03-18 19:05:16 +01:00
// Make sure data folder exists
const fs = require('fs');
fs.mkdirSync('./data', { recursive: true });
2017-07-24 17:12:38 +02:00
// Utils
const { logError } = require('./utils/log');
2017-09-21 13:57:49 +04:30
const bot = require('./bot');
bot.use(
require('./handlers/middlewares'),
2017-10-27 18:43:33 +02:00
require('./plugins'),
require('./handlers/commands'),
require('./handlers/regex'),
require('./handlers/unmatched'),
);
bot.catch(logError);
2020-02-19 14:32:25 +01:00
2020-05-13 22:59:23 +02:00
// eslint-disable-next-line @typescript-eslint/no-floating-promises
2020-02-19 14:32:25 +01:00
bot.launch();