all repos — stealth-developers @ 370c3cfed785af5c63907c6152427e81b5f1c7ba

feat: prettier ban container
vi v@vt3e.cat
Sun, 01 Mar 2026 04:07:08 +0000
commit

370c3cfed785af5c63907c6152427e81b5f1c7ba

parent

25f8fcb5ae1044a683b1a6935228890b9d88502b

1 files changed, 27 insertions(+), 17 deletions(-)

jump to
M src/utils/profile.tssrc/utils/profile.ts

@@ -5,6 +5,9 @@ RobloxUserId,

UserRestrictionLog, } from "@/roblox/types"; import { + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, ContainerBuilder, SectionBuilder, SeparatorBuilder,

@@ -126,13 +129,6 @@

// -- cards ---------------------------------------------------------------------------------------- // ---- bans ------------------------------------------------------------------- -const STATUS_MARKERS: Record<string, string> = { - ACTIVE: "🟥 ACTIVE", - SUPERSEDED: "⚠️ SUPERSEDED", - EXPIRED: "✅ EXPIRED", -}; -type Status = "ACTIVE" | "SUPERSEDED" | "EXPIRED" | string; - export async function constructBansContainer( bans: UserRestrictionLog[] | null, opts: { limit?: number; showPrivate?: boolean; userId?: string } = {},

@@ -187,10 +183,6 @@

const lines = shown.map(async (log) => { if (!log) return undefined; - const status = (statuses.get(log.createTime) ?? "EXPIRED") as Status; - const statusMarker = - STATUS_MARKERS[status ?? "EXPIRED"] ?? STATUS_MARKERS.EXPIRED; - const reason = log.displayReason || "no public reason"; const moderator = await moderatorMention(log.moderator); const startRel = tsRelative(log.createTime);

@@ -199,13 +191,22 @@ duration: log.duration,

startDate: new Date(log.createTime), }); + const bannedFor = + formatDurationShort(log.duration) === "permanent" + ? "permanently" + : `for ${formatDurationShort(log.duration)}`; + const endString = + endAbsolute === "permanent" + ? undefined + : `> **Ends:** ${endAbsolute} (${endRelative})`; + return [ - `- ${statusMarker} • banned ${startRel} by ${moderator === "Banned in-game" ? "ingame script" : moderator}`, - ` - **Reason:** ${reason}`, + `Banned **${bannedFor}**, ${startRel}, by **${moderator}**`, + `> **Reason:** ${reason}`, showPrivate - ? ` - **Private Reason:** ${log.privateReason || "none"}` + ? `> **Private Reason:** ${log.privateReason || "no private reason"}` : undefined, - ` - **End:** ${endAbsolute} (${endRelative})`, + endString, ] .filter(Boolean) .join("\n");

@@ -246,7 +247,7 @@

const bodyText = text( [ `## ${profile.displayName}`, - `[@${profile.name}](${profileUrl}) - ${profile.id} - created ${createdAtString}`, + `@${profile.name} - ${profile.id} - created ${createdAtString}`, ].join("\n"), ); const aboutText = text(

@@ -270,5 +271,14 @@ userId: profile.id,

showPrivate: extras?.showPrivate ?? false, }); - return { mainContainer, bans }; + const profileButton = new ButtonBuilder() + .setLabel("View Profile") + .setStyle(ButtonStyle.Link) + .setURL(profileUrl); + + mainContainer.addActionRowComponents( + new ActionRowBuilder<ButtonBuilder>().addComponents(profileButton), + ); + + return { mainContainer, bans, buttons: [profileButton] }; }