diff --git a/nodemon.json b/nodemon.json index 5cd8161..da890c1 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,7 +1,5 @@ { - "watch": [ - "**/*.ts" - ], + "watch": ["**/*.ts"], "exec": "ts-node --esm src/index.ts", "ext": "js ts" -} \ No newline at end of file +} diff --git a/src/handlers/EventHandler.ts b/src/handlers/EventHandler.ts index 8feedc5..2dc20a9 100644 --- a/src/handlers/EventHandler.ts +++ b/src/handlers/EventHandler.ts @@ -14,7 +14,7 @@ export class EventHandler { async loadEvents() { try { const path = - process.env["NODE_ENV"] === "production" ? "./dist/events/**/*.js" : "./src/events/**/*.ts"; + process.env.NODE_ENV === "production" ? "./dist/events/**/*.js" : "./src/events/**/*.ts"; const files = await globby(path); await Promise.all(files.map(async (filename) => this.loadEvent(filename))); diff --git a/src/handlers/InteractionHandler.ts b/src/handlers/InteractionHandler.ts index 8a2d7d5..0ab503b 100644 --- a/src/handlers/InteractionHandler.ts +++ b/src/handlers/InteractionHandler.ts @@ -16,7 +16,7 @@ export class InteractionHandler { async loadInteractions() { try { const path = - process.env["NODE_ENV"] === "production" + process.env.NODE_ENV === "production" ? "./dist/commands/**/*.js" : "./src/commands/**/*.ts"; diff --git a/src/lib/request.ts b/src/lib/request.ts index a40b109..9df604c 100644 --- a/src/lib/request.ts +++ b/src/lib/request.ts @@ -27,7 +27,11 @@ export async function performAPIRequest(options: Options) { }, }).catch(() => null); - const json = ((await response?.body.json().catch(() => null)) as any) ?? null; + if (!response) { + return null; + } + + const json = (await response.body.json().catch(() => null)) as any | null; const errors = json?.errors ?? []; const data = json; diff --git a/tsconfig.json b/tsconfig.json index 0b7249c..2ffd482 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,5 @@ { + "exclude": [".dev-data", ".data"], "compilerOptions": { /* Visit https://aka.ms/tsconfig.json to read more about this file */