blob: 875bf45b08195c0f9ebbdd0ef56893316fc7c909 [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();
20
pineafane625d782022-05-09 18:04:32 +010021});
TheCodedProf94ff6de2023-02-22 17:47:26 -050022
Skyler Greyda16adf2023-03-05 10:22:12 +000023process.on("unhandledRejection", (err) => {
24 console.error(err);
25});
26process.on("uncaughtException", (err) => {
27 console.error(err);
28});
pineafan1dc15722022-03-14 21:27:34 +000029
Skyler Greyda16adf2023-03-05 10:22:12 +000030await client.login(config.enableDevelopment ? config.developmentToken : config.token);
PineaFan538d3752023-01-12 21:48:23 +000031
TheCodedProf4f79da12023-01-31 16:50:37 -050032await recordPerformance();