import { BaseLayout } from "../views/layout"; import { AuroraClient } from "@/lib/BotClient"; import { getRecentLogs } from "@/lib/logger"; export function dashboardRoute(): Response { // Gather real data const guildCount = AuroraClient.guilds.cache.size; const userCount = AuroraClient.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0); const commandCount = AuroraClient.commands.size; const ping = AuroraClient.ws.ping; // Real system metrics const memoryUsage = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2); const uptimeSeconds = process.uptime(); const uptime = new Date(uptimeSeconds * 1000).toISOString().substr(11, 8); // HH:MM:SS // Real activity logs const activityLogs = getRecentLogs(); const content = `

Servers

${guildCount}

Users

${userCount}

Commands

${commandCount}

Ping

${ping < 0 ? "?" : ping}ms

Live Activity

LIVE
    ${activityLogs.length > 0 ? activityLogs.map(log => `
  • ${log.time} ${log.message}
  • `).join('') : `
  • --:--:-- No recent activity.
  • `}

System Health

Uptime ${uptime}
Memory (Heap) ${memoryUsage} MB
Node Version ${process.version}
Platform ${process.platform}

Quick Actions

`; const html = BaseLayout({ title: "Dashboard", content }); return new Response(html, { headers: { "Content-Type": "text/html" }, }); }