blob: 50a1526245e469e25e058468c654d59976b2bac6 [file] [log] [blame]
Skyler Greycf771402023-03-05 07:06:37 +00001import "@total-typescript/ts-reset";
2
pineafan63fc5e22022-08-04 22:04:10 +01003import runServer from "./api/index.js";
pineafan63fc5e22022-08-04 22:04:10 +01004import client from "./utils/client.js";
pineafana2e39c72023-02-21 18:37:32 +00005import config from "./config/main.js";
PineaFan64486c42022-12-28 09:21:04 +00006import register from "./utils/commandRegistration/register.js";
PineaFan538d3752023-01-12 21:48:23 +00007import { record as recordPerformance } from "./utils/performanceTesting/record.js";
Skyler Turner66ac7942022-02-24 01:59:22 +00008
TheCodedProf1c3ad3c2023-01-25 17:58:36 -05009client.on("ready", async () => {
PineaFan64486c42022-12-28 09:21:04 +000010 console.log(`Logged in as ${client.user!.tag}!`);
11 register();
pineafane625d782022-05-09 18:04:32 +010012 runServer(client);
TheCodedProff86ba092023-01-27 17:10:07 -050013 if (config.enableDevelopment) {
14 client.fetchedCommands = await client.guilds.cache.get(config.developmentGuildID)?.commands.fetch()!;
15 } else {
16 client.fetchedCommands = await client.application?.commands.fetch()!;
17 }
TheCodedProf94ff6de2023-02-22 17:47:26 -050018 await client.database.premium.checkAllPremium();
TheCodedProfb7a7b992023-03-05 16:11:59 -050019 await client.database.guilds.updateAllGuilds();
pineafane625d782022-05-09 18:04:32 +010020});
TheCodedProf94ff6de2023-02-22 17:47:26 -050021
Skyler Greyda16adf2023-03-05 10:22:12 +000022process.on("unhandledRejection", (err) => {
23 console.error(err);
24});
25process.on("uncaughtException", (err) => {
26 console.error(err);
27});
pineafan1dc15722022-03-14 21:27:34 +000028
Skyler Greyda16adf2023-03-05 10:22:12 +000029await client.login(config.enableDevelopment ? config.developmentToken : config.token);
PineaFan538d3752023-01-12 21:48:23 +000030
TheCodedProf4f79da12023-01-31 16:50:37 -050031await recordPerformance();