blob: 12f6659b8c3724eb53d436f3d4536125d4142cf4 [file] [log] [blame]
pineafan63fc5e22022-08-04 22:04:10 +01001import runServer from "./api/index.js";
pineafan63fc5e22022-08-04 22:04:10 +01002import client from "./utils/client.js";
Samuel Shuert27bf3cd2023-03-03 15:51:25 -05003import config from "./config/main.js";
PineaFan64486c42022-12-28 09:21:04 +00004import register from "./utils/commandRegistration/register.js";
PineaFan538d3752023-01-12 21:48:23 +00005import { record as recordPerformance } from "./utils/performanceTesting/record.js";
Skyler Turner66ac7942022-02-24 01:59:22 +00006
Samuel Shuert27bf3cd2023-03-03 15:51:25 -05007client.on("ready", async () => {
PineaFan64486c42022-12-28 09:21:04 +00008 console.log(`Logged in as ${client.user!.tag}!`);
9 register();
pineafane625d782022-05-09 18:04:32 +010010 runServer(client);
Samuel Shuert27bf3cd2023-03-03 15:51:25 -050011 if (config.enableDevelopment) {
12 client.fetchedCommands = await client.guilds.cache.get(config.developmentGuildID)?.commands.fetch()!;
13 } else {
14 client.fetchedCommands = await client.application?.commands.fetch()!;
15 }
16 await client.database.premium.checkAllPremium();
pineafane625d782022-05-09 18:04:32 +010017});
Samuel Shuert27bf3cd2023-03-03 15:51:25 -050018
PineaFan0d06edc2023-01-17 22:10:31 +000019process.on("unhandledRejection", (err) => { console.error(err) });
20process.on("uncaughtException", (err) => { console.error(err) });
pineafan1dc15722022-03-14 21:27:34 +000021
PineaFan0d06edc2023-01-17 22:10:31 +000022await client.login(config.enableDevelopment ? config.developmentToken : config.token)
PineaFan538d3752023-01-12 21:48:23 +000023
Samuel Shuert27bf3cd2023-03-03 15:51:25 -050024await recordPerformance();