blob: 3c132bc35e9ff2d94f93fa6d93418e0bda16e390 [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";
pineafana2e39c72023-02-21 18:37:32 +00003import 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
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 }
TheCodedProfd0a166d2023-02-19 00:04:53 -050016 setInterval(async () => {
17 await client.database.premium.checkAllPremium();
18 }, 1000 * 60 * 3);
pineafane625d782022-05-09 18:04:32 +010019});
PineaFan0d06edc2023-01-17 22:10:31 +000020process.on("unhandledRejection", (err) => { console.error(err) });
21process.on("uncaughtException", (err) => { console.error(err) });
pineafan1dc15722022-03-14 21:27:34 +000022
PineaFan0d06edc2023-01-17 22:10:31 +000023await client.login(config.enableDevelopment ? config.developmentToken : config.token)
PineaFan538d3752023-01-12 21:48:23 +000024
TheCodedProf4f79da12023-01-31 16:50:37 -050025await recordPerformance();