update embeds
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m0s

This commit is contained in:
Lee 2024-04-17 17:26:10 +01:00
parent ace88be518
commit 6d3663ccb9
2 changed files with 13 additions and 1 deletions

View File

@ -16,6 +16,12 @@ type Params = {
export async function generateMetadata({ params: { id } }: Params): Promise<Metadata> {
try {
if (!id || id.length === 0) {
return generateEmbed({
title: "Player Not Found",
description: "Click to lookup a player.",
});
}
const player = await getPlayer(id);
const { username, uniqueId, skin } = player;

View File

@ -57,6 +57,12 @@ export async function generateMetadata({ params: { platform, hostname } }: Param
description: "Invalid platform",
});
}
if (!hostname || hostname.length === 0) {
return generateEmbed({
title: "Server Lookup",
description: `Click to lookup a ${capitalizeFirstLetter(platform)} server.`,
});
}
const server = await getServer(platform, hostname);
const { hostname: serverHostname, players } = server as CachedJavaMinecraftServer | CachedBedrockMinecraftServer;
@ -80,7 +86,7 @@ export async function generateMetadata({ params: { platform, hostname } }: Param
export default async function Page({ params: { platform, hostname } }: Params): Promise<JSX.Element> {
let error: string | undefined = undefined; // The error to display
let server: CachedJavaMinecraftServer | CachedBedrockMinecraftServer | undefined = undefined; // The server to display
let invalidPlatform = checkPlatform(platform) === false;
let invalidPlatform = checkPlatform(platform) === false; // Whether the platform is invalid
// Try and get the player to display
try {