From 9829b2bf9b26bda37a7c1e96145cf21750a94d65 Mon Sep 17 00:00:00 2001 From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Date: Fri, 16 Sep 2022 22:00:08 +0800 Subject: [PATCH] oops --- src/commands/modrinth.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands/modrinth.ts b/src/commands/modrinth.ts index 3dbaddc..a2ea7fc 100644 --- a/src/commands/modrinth.ts +++ b/src/commands/modrinth.ts @@ -43,9 +43,6 @@ export const modrinthCommand = async ( } const res = await fetch('https://api.modrinth.com/v2/project/' + id); - const data = (await res.json()) as - | ModrinthProject - | { error: string; description: string }; if (!res.ok) { await i.editReply({ @@ -60,6 +57,10 @@ export const modrinthCommand = async ( return; } + const data = (await res.json()) as + | ModrinthProject + | { error: string; description: string }; + if ('error' in data) { console.error(data);