feat: dashboard

This commit is contained in:
eric
2026-02-26 14:45:57 +01:00
parent 94ad2896cc
commit 3756830ec2
43 changed files with 7043 additions and 2060 deletions

View File

@@ -1,6 +1,6 @@
/**
* Joel Discord Bot - Main Entry Point
*
*
* A well-structured Discord bot with clear separation of concerns:
* - core/ - Bot client, configuration, logging
* - commands/ - Slash command definitions and handling
@@ -17,10 +17,12 @@ import { config } from "./core/config";
import { createLogger } from "./core/logger";
import { registerEvents } from "./events";
import { stopSpontaneousMentionsCron } from "./features/joel";
import { startWebServer } from "./web";
import { buildWebCss, startWebCssWatcher, startWebServer } from "./web";
import { runMigrations } from "./database/migrate";
import type { FSWatcher } from "fs";
const logger = createLogger("Main");
let webCssWatcher: FSWatcher | null = null;
// Create the Discord client with required intents
const client = new BotClient({
@@ -32,7 +34,6 @@ const client = new BotClient({
GatewayIntentBits.GuildModeration,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
],
});
@@ -50,6 +51,8 @@ async function main(): Promise<void> {
await client.login(config.discord.token);
// Start web server after bot is logged in
await buildWebCss();
webCssWatcher = startWebCssWatcher();
await startWebServer(client);
} catch (error) {
logger.error("Failed to start bot", error);
@@ -60,6 +63,7 @@ async function main(): Promise<void> {
// Handle graceful shutdown
process.on("SIGINT", () => {
logger.info("Shutting down...");
webCssWatcher?.close();
stopSpontaneousMentionsCron();
client.destroy();
process.exit(0);
@@ -67,6 +71,7 @@ process.on("SIGINT", () => {
process.on("SIGTERM", () => {
logger.info("Shutting down...");
webCssWatcher?.close();
stopSpontaneousMentionsCron();
client.destroy();
process.exit(0);