vylbot-app/src/vylbot.ts

33 lines
723 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";
import { Intents } from "discord.js";
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([
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MEMBERS,
], devmode);
registry.RegisterCommands(client);
registry.RegisterEvents(client);
2021-11-28 14:24:53 +00:00
client.start();