make the embed fancy
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 55s

This commit is contained in:
Lee 2024-04-16 22:59:30 +01:00
parent 95737f3db5
commit f480b0ccc8

@ -44,11 +44,13 @@ async function getData(): Promise<CachedEndpointStatus> {
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {
const { endpoints } = await getData(); const { endpoints } = await getData();
const maxStatusLength = Math.max(...Object.values(endpoints).map((status) => formatStatus(status).length));
let description = "The current status of Mojang Services\n\n"; let description = "The current status of Mojang Services\n\n";
description += Object.entries(endpoints) description += Object.entries(endpoints)
.map(([url, status]) => { .map(([url, status]) => {
return `**${url}**: ${formatStatus(status)}`; const formattedStatus = formatStatus(status).padEnd(maxStatusLength, " "); // Pad the status to ensure uniform width
return `${url}: ${formattedStatus}`;
}) })
.join("\n"); .join("\n");