fix project not found
This commit is contained in:
parent
0e4329492e
commit
2a35abdce0
1 changed files with 17 additions and 3 deletions
|
@ -42,9 +42,23 @@ export const modrinthCommand = async (
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = (await fetch('https://api.modrinth.com/v2/project/' + id).then(
|
const res = await fetch('https://api.modrinth.com/v2/project/' + id);
|
||||||
(a) => a.json()
|
const data = (await res.json()) as
|
||||||
)) as ModrinthProject | { error: string; description: string };
|
| ModrinthProject
|
||||||
|
| { error: string; description: string };
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
await i.editReply({
|
||||||
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setTitle('Error!')
|
||||||
|
.setDescription('Not found!')
|
||||||
|
.setColor(COLORS.red),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ('error' in data) {
|
if ('error' in data) {
|
||||||
console.error(data);
|
console.error(data);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue