Unused code
This commit is contained in:
parent
8642740f90
commit
060e991741
@ -71,7 +71,6 @@ export const generateMetadata = async ({
|
|||||||
params,
|
params,
|
||||||
}: PageProps): Promise<Metadata> => {
|
}: PageProps): Promise<Metadata> => {
|
||||||
const query: string | undefined = trimQuery(params.slug?.[0]);
|
const query: string | undefined = trimQuery(params.slug?.[0]);
|
||||||
let embed: Metadata | undefined; // The player embed, if any
|
|
||||||
if (query) {
|
if (query) {
|
||||||
try {
|
try {
|
||||||
const player: CachedPlayer = await getPlayer(query); // Get the player to embed
|
const player: CachedPlayer = await getPlayer(query); // Get the player to embed
|
||||||
@ -81,25 +80,15 @@ export const generateMetadata = async ({
|
|||||||
thumbnail: player.skin.parts.HEAD,
|
thumbnail: player.skin.parts.HEAD,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const code: number = (err as RestfulMCAPIError).code; // Get the error status code
|
|
||||||
if (code === 400) {
|
|
||||||
return Embed({
|
|
||||||
title: "Invalid Player",
|
|
||||||
description: `The player ${query} is invalid.`,
|
|
||||||
});
|
|
||||||
} else if (code === 404) {
|
|
||||||
return Embed({
|
return Embed({
|
||||||
title: "Player Not Found",
|
title: "Player Not Found",
|
||||||
description: `The player ${query} was not found.`,
|
description: `The player ${query} was not found.`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Return the page embed
|
// Return the page embed
|
||||||
return embed
|
return Embed({
|
||||||
? embed
|
|
||||||
: Embed({
|
|
||||||
title: "Player Lookup",
|
title: "Player Lookup",
|
||||||
description: "Search for a player to view their profile.",
|
description: "Search for a player to view their profile.",
|
||||||
});
|
});
|
||||||
|
@ -91,7 +91,6 @@ export const generateMetadata = async ({
|
|||||||
}: PageProps): Promise<Metadata> => {
|
}: PageProps): Promise<Metadata> => {
|
||||||
const platform: string | undefined = params.slug?.[0]; // The platform to search for
|
const platform: string | undefined = params.slug?.[0]; // The platform to search for
|
||||||
const hostname: string | undefined = params.slug?.[1]; // The hostname of the server to search for
|
const hostname: string | undefined = params.slug?.[1]; // The hostname of the server to search for
|
||||||
let embed: Metadata | undefined; // The server embed, if any
|
|
||||||
if (platform && hostname) {
|
if (platform && hostname) {
|
||||||
try {
|
try {
|
||||||
const server:
|
const server:
|
||||||
@ -106,25 +105,15 @@ export const generateMetadata = async ({
|
|||||||
thumbnail: (server as CachedJavaMinecraftServer).favicon?.url,
|
thumbnail: (server as CachedJavaMinecraftServer).favicon?.url,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const code: number = (err as RestfulMCAPIError).code; // Get the error status code
|
|
||||||
if (code === 400) {
|
|
||||||
return Embed({
|
|
||||||
title: "Invalid Platform or Hostname",
|
|
||||||
description: `The platform ${platform} or hostname ${hostname} is invalid.`,
|
|
||||||
});
|
|
||||||
} else if (code === 404) {
|
|
||||||
return Embed({
|
return Embed({
|
||||||
title: "Server Not Found",
|
title: "Server Not Found",
|
||||||
description: `The server ${hostname} was not found.`,
|
description: `The server ${hostname} was not found.`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Return the page embed
|
// Return the page embed
|
||||||
return embed
|
return Embed({
|
||||||
? embed
|
|
||||||
: Embed({
|
|
||||||
title: "Server Lookup",
|
title: "Server Lookup",
|
||||||
description: "Search for a server to view its data.",
|
description: "Search for a server to view its data.",
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user