diff --git a/src/modules/terminal/terminal.service.ts b/src/modules/terminal/terminal.service.ts index 79a314f..0e69692 100644 --- a/src/modules/terminal/terminal.service.ts +++ b/src/modules/terminal/terminal.service.ts @@ -94,11 +94,18 @@ export const terminalService = { orderBy: desc(lootdrops.createdAt) }); + // 4. System Stats + const memoryUsage = process.memoryUsage(); + const uptime = process.uptime(); + const uptimeHours = Math.floor(uptime / 3600); + const uptimeMinutes = Math.floor((uptime % 3600) / 60); + const ramUsed = Math.round(memoryUsage.heapUsed / 1024 / 1024); + // --- CONTAINER 1: Header --- const headerContainer = new ContainerBuilder() .addTextDisplayComponents( new TextDisplayBuilder().setContent("# 🌌 AURORA OBSERVATORY"), - new TextDisplayBuilder().setContent("*Current Moon Phase: Waxing Crescent 🌒*") + new TextDisplayBuilder().setContent(`*Current Moon Phase: Waxing Crescent 🌒 • System Online for ${uptimeHours}h ${uptimeMinutes}m*`) ); // --- CONTAINER 2: Observation Log --- @@ -116,7 +123,7 @@ export const terminalService = { const logContainer = new ContainerBuilder() .addTextDisplayComponents( new TextDisplayBuilder().setContent("## 🔭 OBSERVATION LOG"), - new TextDisplayBuilder().setContent(`> **Stargazers**: \`${totalUsers}\`\n> **Astral Wealth**: \`${totalWealth.toLocaleString()} AU\`${phenomenaContent}`) + new TextDisplayBuilder().setContent(`> **Stargazers**: \`${totalUsers}\`\n> **Astral Wealth**: \`${totalWealth.toLocaleString()} AU\`\n> **Memory**: \`${ramUsed}MB\`${phenomenaContent}`) ); // --- CONTAINER 3: Leaders --- @@ -137,13 +144,19 @@ export const terminalService = { const time = Math.floor(tx.createdAt!.getTime() / 1000); let icon = "💫"; if (tx.type.includes("LOOT")) icon = "🌠"; - if (tx.type.includes("GIFT")) icon = "🌕"; + if (tx.type.includes("GIFT")) icon = "🎁"; + if (tx.type.includes("SHOP")) icon = "🛒"; + if (tx.type.includes("DAILY")) icon = "☀️"; const user = allUsers.find(u => u.id === tx.userId); - // the description might contain a channel id all the way at the end + // Clean up description const channelId = tx.description?.split(" ").pop() || ""; - const text = tx.description?.replace(channelId, "<#" + channelId + ">") || ""; - return ` ${icon} ${user ? `<@${user.id}>` : '**Unknown**'}: ${text}`; + let text = tx.description || "Unknown interaction"; + if (channelId.match(/^\d+$/)) { + text = text.replace(channelId, "").trim(); + } + + return ` ${icon} **${user ? user.username : 'Unknown'}**: ${text}`; }); const echoesContainer = new ContainerBuilder()