diff --git a/src/app/(pages)/player/[[...id]]/page.tsx b/src/app/(pages)/player/[[...id]]/page.tsx index a09fd85..db00ab5 100644 --- a/src/app/(pages)/player/[[...id]]/page.tsx +++ b/src/app/(pages)/player/[[...id]]/page.tsx @@ -16,6 +16,7 @@ type Params = { export async function generateMetadata({ params: { id } }: Params): Promise { try { + // No id provided if (!id || id.length === 0) { return generateEmbed({ title: "Player Lookup", @@ -35,6 +36,7 @@ export async function generateMetadata({ params: { id } }: Params): Promise { try { if (checkPlatform(platform) === false) { + // Invalid platform return generateEmbed({ title: "Server Not Found", description: "Invalid platform", }); } if (!hostname || hostname.length === 0) { + // No hostname return generateEmbed({ title: "Server Lookup", description: `Click to lookup a ${capitalizeFirstLetter(platform)} server.`, @@ -68,7 +70,9 @@ export async function generateMetadata({ params: { platform, hostname } }: Param const favicon = server ? getFavicon(platform, server) : undefined; - const description = `Hostname: ${serverHostname}\n${players.online}/${players.max} players online\n\nClick to view more information about the player.`; + let description = `Hostname:${serverHostname}\n`; + description += `${players.online}/${players.max} players online\n\n`; + description += "Click to view more information about the server."; return generateEmbed({ title: `${hostname}`, @@ -76,6 +80,7 @@ export async function generateMetadata({ params: { platform, hostname } }: Param image: favicon, }); } catch (err) { + // An error occurred return generateEmbed({ title: "Server Not Found", description: (err as McUtilsAPIError).message,