forked from Galactic/galactic-bot
24 lines
932 B
TypeScript
24 lines
932 B
TypeScript
|
// require('dotenv').config({ override: true });
|
||
|
import { config } from 'dotenv';
|
||
|
config({ override: true });
|
||
|
// eslint-disable-next-line no-console
|
||
|
console.log(`Starting in ${process.env.NODE_ENV} mode`);
|
||
|
|
||
|
// const BaseClient = require('./src/middleware/BaseClient.js');
|
||
|
import BaseClient from './src/middleware/Controller.js';
|
||
|
import { readFileSync } from 'node:fs';
|
||
|
// const options = require('./options.json');
|
||
|
const rawOptions = readFileSync('./options.json', { encoding: 'utf-8' });
|
||
|
const options = JSON.parse(rawOptions);
|
||
|
// const { version } = require('./package.json');
|
||
|
const rawPackage = readFileSync('./package.json', { encoding: 'utf-8' });
|
||
|
const pkg = JSON.parse(rawPackage);
|
||
|
const { version } = pkg;
|
||
|
|
||
|
new BaseClient(options, version)
|
||
|
.build();
|
||
|
|
||
|
process.on("unhandledRejection", (error) => {
|
||
|
console.error("[index.js] Unhandled promise rejection:", error); // eslint-disable-line no-console
|
||
|
throw error;
|
||
|
});
|