Create initial bot framework (#7)

#1

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/7
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
Ethan Lane 2023-08-19 16:56:22 +01:00 committed by Vylpes
parent cb548898ce
commit c706737369
35 changed files with 5876 additions and 0 deletions

36
src/bot.ts Normal file
View file

@ -0,0 +1,36 @@
import * as dotenv from "dotenv";
import { CoreClient } from "./client/client";
import { IntentsBitField } from "discord.js";
import Registry from "./registry";
dotenv.config();
const requiredConfigs: string[] = [
"BOT_TOKEN",
"BOT_VER",
"BOT_AUTHOR",
"BOT_OWNERID",
"BOT_CLIENTID",
"DB_HOST",
"DB_PORT",
"DB_AUTH_USER",
"DB_AUTH_PASS",
"DB_SYNC",
"DB_LOGGING",
]
requiredConfigs.forEach(config => {
if (!process.env[config]) {
throw `${config} is required in .env`;
}
});
const client = new CoreClient([
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
]);
Registry.RegisterCommands();
Registry.RegisterEvents();
client.start();