Files
aurorabot/src/index.ts
2026-01-08 17:15:28 +05:30

27 lines
721 B
TypeScript

import { AuroraClient } from "@/lib/BotClient";
import { env } from "@lib/env";
import { webServer } from "./web/src";
// Load commands & events
await AuroraClient.loadCommands();
await AuroraClient.loadEvents();
await AuroraClient.deployCommands();
webServer.start();
console.log("Web server is running on http://localhost:3000")
// login with the token from .env
if (!env.DISCORD_BOT_TOKEN) {
throw new Error("❌ DISCORD_BOT_TOKEN is not set in environment variables.");
}
AuroraClient.login(env.DISCORD_BOT_TOKEN);
// Handle graceful shutdown
const shutdownHandler = () => {
webServer.stop();
AuroraClient.shutdown();
};
process.on("SIGINT", shutdownHandler);
process.on("SIGTERM", shutdownHandler);