chore: update terminal service

This commit is contained in:
syntaxbullet
2026-01-06 20:36:26 +01:00
parent 69186ff3e9
commit 1dd269bf2f

View File

@@ -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 `<t:${time}:F> ${icon} ${user ? `<@${user.id}>` : '**Unknown**'}: ${text}`;
let text = tx.description || "Unknown interaction";
if (channelId.match(/^\d+$/)) {
text = text.replace(channelId, "").trim();
}
return `<t:${time}:R> ${icon} **${user ? user.username : 'Unknown'}**: ${text}`;
});
const echoesContainer = new ContainerBuilder()