diff --git a/src/app/(pages)/mojang/page.tsx b/src/app/(pages)/mojang/page.tsx index 874d3fa..5f3cc9a 100644 --- a/src/app/(pages)/mojang/page.tsx +++ b/src/app/(pages)/mojang/page.tsx @@ -1,15 +1,12 @@ import { Card } from "@/app/components/card"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/app/components/ui/table"; +import { generateEmbed } from "@/common/embed"; import { cn } from "@/common/utils"; import { getMojangEndpointStatus } from "mcutils-library"; import { CachedEndpointStatus } from "mcutils-library/dist/types/cache/cachedEndpointStatus"; +import { Metadata } from "next"; import Link from "next/link"; -async function getData(): Promise { - const status = await getMojangEndpointStatus(); - return status; -} - /** * Gets the color of the status * @@ -29,6 +26,26 @@ function getColor(status: any): string { } } +async function getData(): Promise { + const status = await getMojangEndpointStatus(); + return status; +} + +export async function generateMetadata(): Promise { + const { endpoints } = await getData(); + + const description = Object.entries(endpoints) + .map(([url, status]) => { + return `${url}: ${status}`; + }) + .join("\n"); + + return generateEmbed({ + title: "Mojang Status", + description: description, + }); +} + export default async function Page(): Promise { const { endpoints } = await getData(); const endpointsSize = Object.entries(endpoints).length;