blob: 442b18278e4118b38e0d3ce4d9c3adeb1066a277 [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}!`);
await 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();
await client.database.guilds.updateAllGuilds();
});
process.on("unhandledRejection", (err) => {
console.error(err);
});
process.on("uncaughtException", (err) => {
console.error(err);
});
await client.login(config.token);
await recordPerformance();