Skip to content

Commit

Permalink
chore: small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Oct 29, 2023
1 parent 47a3d71 commit d7c1a50
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
6 changes: 2 additions & 4 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"watch": [
"**/*.ts"
],
"watch": ["**/*.ts"],
"exec": "ts-node --esm src/index.ts",
"ext": "js ts"
}
}
2 changes: 1 addition & 1 deletion src/handlers/EventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/InteractionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
6 changes: 5 additions & 1 deletion src/lib/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ export async function performAPIRequest<T>(options: Options<T>) {
},
}).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;

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"exclude": [".dev-data", ".data"],
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */

Expand Down

0 comments on commit d7c1a50

Please sign in to comment.