blob: ddcd97b4b860e9e1964e866683160ed765fa73b7 [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
PineaFan0d06edc2023-01-17 22:10:31 +000021process.on("unhandledRejection", (err) => { console.error(err) });
22process.on("uncaughtException", (err) => { console.error(err) });
pineafan1dc15722022-03-14 21:27:34 +000023
PineaFan0d06edc2023-01-17 22:10:31 +000024await client.login(config.enableDevelopment ? config.developmentToken : config.token)
PineaFan538d3752023-01-12 21:48:23 +000025
TheCodedProf4f79da12023-01-31 16:50:37 -050026await recordPerformance();