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 memUsage = process.memoryUsage(); const memoryUsage = (memUsage.heapUsed / 1024 / 1024).toFixed(2); const memoryTotal = (memUsage.rss / 1024 / 1024).toFixed(1); const uptimeSeconds = process.uptime(); const uptime = new Date(uptimeSeconds * 1000).toISOString().substr(11, 8); // HH:MM:SS const startTimestamp = Date.now() - (uptimeSeconds * 1000); // Real activity logs const activityLogs = getRecentLogs(); const memPercent = Math.min(100, (memUsage.heapUsed / memUsage.rss) * 100).toFixed(1); // Get top guilds const topGuilds = AuroraClient.guilds.cache .sort((a, b) => b.memberCount - a.memberCount) .first(5); const content = `