blob: 3d0972d40c8ae250c51dc2dfd9351dd2a8a325fb [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();
pineafane625d782022-05-09 18:04:32 +010019});
TheCodedProf94ff6de2023-02-22 17:47:26 -050020
Skyler Greyda16adf2023-03-05 10:22:12 +000021process.on("unhandledRejection", (err) => {
22 console.error(err);
23});
24process.on("uncaughtException", (err) => {
25 console.error(err);
26});
pineafan1dc15722022-03-14 21:27:34 +000027
Skyler Greyda16adf2023-03-05 10:22:12 +000028await client.login(config.enableDevelopment ? config.developmentToken : config.token);
PineaFan538d3752023-01-12 21:48:23 +000029
TheCodedProf4f79da12023-01-31 16:50:37 -050030await recordPerformance();