pkgs/bot/src/index.ts (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import config from "./config.ts";
import logger from "./utils/logging.ts";
import { migrateDb } from "./database/index.ts";
import client from "./discord.ts";
import "./server";
async function main() {
await migrateDb();
try {
await client.login(config.discord.token);
} catch (error) {
logger.error(error, "failed to login:");
process.exit(1);
}
}
main();
process.on("unhandledRejection", (error) => {
logger.error(error, "unhandled promise rejection:");
console.error(error);
});
process.on("uncaughtException", (error) => {
logger.error(error, "uncaught exception");
console.error(error);
});
|