2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-22 01:49:29 +00:00
the-guard-bot/index.js
2024-12-02 12:58:51 +01:00

37 lines
876 B
JavaScript

// @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();