blob: 306811e1a8a47b5db5fbb921d8914e77d3e9cc5e [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";
PineaFan64486c42022-12-28 09:21:04 +00003import config from "./config/main.json" assert { type: "json" };
4import 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
TheCodedProf1c3ad3c2023-01-25 17:58:36 -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);
TheCodedProff86ba092023-01-27 17:10:07 -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 }
pineafane625d782022-05-09 18:04:32 +010016});
PineaFan0d06edc2023-01-17 22:10:31 +000017process.on("unhandledRejection", (err) => { console.error(err) });
18process.on("uncaughtException", (err) => { console.error(err) });
pineafan1dc15722022-03-14 21:27:34 +000019
PineaFan0d06edc2023-01-17 22:10:31 +000020await client.login(config.enableDevelopment ? config.developmentToken : config.token)
PineaFan538d3752023-01-12 21:48:23 +000021
TheCodedProf1c3ad3c2023-01-25 17:58:36 -050022await recordPerformance();