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);