galactic-bot/index.ts

35 lines
1.4 KiB
TypeScript

// Galactic - Discord moderation bot
// Copyright (C) 2024 Navy.gif
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { config } from 'dotenv';
config({ override: true });
// eslint-disable-next-line no-console
console.log(`Starting in ${process.env.NODE_ENV} mode`);
import Controller from './src/middleware/Controller.js';
import { readFileSync } from 'node:fs';
import path from 'node:path';
import { ControllerOptions } from './@types/Controller.js';
const options = JSON.parse(readFileSync('./options.json', { encoding: 'utf-8' })) as ControllerOptions;
const pkg = JSON.parse(readFileSync('./package.json', { encoding: 'utf-8' }));
const { version } = pkg;
const srcDir = path.join(process.cwd(), 'build', 'src');
options.rootDir = srcDir;
new Controller(options, version)
.build();