Development (#11)
We need this NOW.
---------
Co-authored-by: PineaFan <ash@pinea.dev>
Co-authored-by: pineafan <pineapplefanyt@gmail.com>
Co-authored-by: PineappleFan <PineaFan@users.noreply.github.com>
Co-authored-by: Skyler <skyler3665@gmail.com>
diff --git a/src/index.ts b/src/index.ts
index 362b805..12f6659 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,17 +1,24 @@
import runServer from "./api/index.js";
import client from "./utils/client.js";
-import config from "./config/main.json" assert { type: "json" };
+import config from "./config/main.js";
import register from "./utils/commandRegistration/register.js";
import { record as recordPerformance } from "./utils/performanceTesting/record.js";
-client.on("ready", () => {
+client.on("ready", async () => {
console.log(`Logged in as ${client.user!.tag}!`);
register();
runServer(client);
+ if (config.enableDevelopment) {
+ client.fetchedCommands = await client.guilds.cache.get(config.developmentGuildID)?.commands.fetch()!;
+ } else {
+ client.fetchedCommands = await client.application?.commands.fetch()!;
+ }
+ await client.database.premium.checkAllPremium();
});
+
process.on("unhandledRejection", (err) => { console.error(err) });
process.on("uncaughtException", (err) => { console.error(err) });
await client.login(config.enableDevelopment ? config.developmentToken : config.token)
-await recordPerformance();
\ No newline at end of file
+await recordPerformance();