blob: 3d0972d40c8ae250c51dc2dfd9351dd2a8a325fb [file] [log] [blame]
import "@total-typescript/ts-reset";
import runServer from "./api/index.js";
import client from "./utils/client.js";
import config from "./config/main.js";
import register from "./utils/commandRegistration/register.js";
import { record as recordPerformance } from "./utils/performanceTesting/record.js";
client.on("ready", async () => {
console.log(`Logged in as ${client.user!.tag}!`);
register();
runServer(client);
if (config.enableDevelopment) {
client.fetchedCommands = await client.guilds.cache.get(config.developmentGuildID)?.commands.fetch()!;
} else {
client.fetchedCommands = await client.application?.commands.fetch()!;
}
await client.database.premium.checkAllPremium();
});
process.on("unhandledRejection", (err) => {
console.error(err);
});
process.on("uncaughtException", (err) => {
console.error(err);
});
await client.login(config.enableDevelopment ? config.developmentToken : config.token);
await recordPerformance();