From 8c28fe60fc55797ad260fdddabe961a6a59c573d Mon Sep 17 00:00:00 2001 From: syntaxbullet Date: Wed, 24 Dec 2025 18:07:50 +0100 Subject: [PATCH] feat: Enable Components V2, use user mentions, and enhance transaction log display in terminal service. --- src/modules/terminal/terminal.service.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/modules/terminal/terminal.service.ts b/src/modules/terminal/terminal.service.ts index aa21df3..01a499a 100644 --- a/src/modules/terminal/terminal.service.ts +++ b/src/modules/terminal/terminal.service.ts @@ -69,11 +69,14 @@ export const terminalService = { const containers = await terminalService.buildMessage(); - // Should be using 'components' for containers + // Components V2 requires the IsComponentsV2 flag and no content/embeds + // Disable allowedMentions to prevent pings from the dashboard await message.edit({ content: null, + embeds: null as any, components: containers as any, - flags: MessageFlags.IsComponentsV2 + flags: MessageFlags.IsComponentsV2, + allowedMentions: { parse: [] } }); } catch (error) { @@ -93,7 +96,7 @@ export const terminalService = { const formatUser = (u: typeof users.$inferSelect, i: number) => { const star = i === 0 ? "🌟" : i === 1 ? "⭐" : "✨"; - return `${star} **${u.username}**`; + return `${star} <@${u.id}>`; }; const levelText = topLevels.map((u, i) => `> ${formatUser(u, i)} • Lvl ${u.level}`).join("\n") || "> *The sky is empty...*"; @@ -114,7 +117,6 @@ export const terminalService = { // --- CONTAINER 1: Header --- const headerContainer = new ContainerBuilder() - .setAccentColor(0x00ff99) .addTextDisplayComponents( new TextDisplayBuilder().setContent("# 🌌 AURORA OBSERVATORY"), new TextDisplayBuilder().setContent("*Current Moon Phase: Waxing Crescent 🌒*") @@ -129,7 +131,7 @@ export const terminalService = { } else if (recentDrops.length > 0 && recentDrops[0]) { const drop = recentDrops[0]; const claimer = allUsers.find(u => u.id === drop.claimedBy); - phenomenaContent = `\n**RECENT EVENT**\nStar yielded \`${drop.rewardAmount} ${drop.currency}\` to **${claimer?.username || 'Unknown'}**`; + phenomenaContent = `\n**RECENT EVENT**\nStar yielded \`${drop.rewardAmount} ${drop.currency}\` to ${claimer ? `<@${claimer.id}>` : '**Unknown**'}`; } const logContainer = new ContainerBuilder() @@ -158,7 +160,11 @@ export const terminalService = { if (tx.type.includes("LOOT")) icon = "🌠"; if (tx.type.includes("GIFT")) icon = "🌕"; const user = allUsers.find(u => u.id === tx.userId); - return `\`[]\` ${icon} **${user?.username || 'Unknown'}**: ${tx.description}`; + + // the description might contain a channel id all the way at the end + const channelId = tx.description?.split(" ").pop() || ""; + const text = tx.description?.replace(channelId, "<#" + channelId + ">") || ""; + return ` ${icon} ${user ? `<@${user.id}>` : '**Unknown**'}: ${text}`; }); const echoesContainer = new ContainerBuilder()