vylbot-app/src/vylbot.ts

28 lines
587 B
TypeScript
Raw Normal View History

import { CoreClient } from "./client/client";
2021-11-28 14:24:53 +00:00
import * as dotenv from "dotenv";
import registry from "./registry";
2021-11-28 14:24:53 +00:00
dotenv.config();
const requiredConfigs: string[] = [
"BOT_TOKEN",
"BOT_VER",
"BOT_AUTHOR",
"BOT_DATE",
"BOT_OWNERID",
2021-12-02 11:44:56 +00:00
];
2021-11-29 11:27:44 +00:00
2021-12-02 11:44:56 +00:00
requiredConfigs.forEach(config => {
if (!process.env[config]) {
throw `${config} is required in .env`;
}
});
2021-11-28 14:24:53 +00:00
const devmode = process.argv.find(x => x.toLowerCase() == "--dev") != null;
const client = new CoreClient(devmode);
registry.RegisterCommands(client);
registry.RegisterEvents(client);
2021-11-28 14:24:53 +00:00
client.start();