galactic-bot/index.ts

35 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

// 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/>.
2023-06-22 01:07:19 +02:00
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';
2023-06-22 01:07:19 +02:00
import { readFileSync } from 'node:fs';
import path from 'node:path';
2023-12-05 19:31:53 +01:00
import { ControllerOptions } from './@types/Controller.js';
2023-12-05 19:31:53 +01:00
const options = JSON.parse(readFileSync('./options.json', { encoding: 'utf-8' })) as ControllerOptions;
const pkg = JSON.parse(readFileSync('./package.json', { encoding: 'utf-8' }));
2023-06-22 01:07:19 +02:00
const { version } = pkg;
const srcDir = path.join(process.cwd(), 'build', 'src');
2023-12-05 19:31:53 +01:00
options.rootDir = srcDir;
2023-06-22 01:07:19 +02:00
new Controller(options, version)
.build();