Files
aurorabot/bot/modules/economy/shop.view.ts
syntaxbullet 34958aa220
All checks were successful
Deploy to Production / test (push) Successful in 44s
feat: implement comprehensive item management system with admin UI, API, and asset handling utilities.
2026-02-06 12:19:14 +01:00

26 lines
1.2 KiB
TypeScript

import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import { createBaseEmbed } from "@/lib/embeds";
import { resolveAssetUrl } from "@shared/lib/assets";
export function getShopListingMessage(item: { id: number; name: string; description: string | null; formattedPrice: string; iconUrl: string | null; imageUrl: string | null; price: number | bigint }) {
// Resolve asset URLs to full URLs for Discord embeds
const resolvedIconUrl = resolveAssetUrl(item.iconUrl);
const resolvedImageUrl = resolveAssetUrl(item.imageUrl);
const embed = createBaseEmbed(`Shop: ${item.name}`, item.description || "No description available.", "Green")
.addFields({ name: "Price", value: item.formattedPrice, inline: true })
.setThumbnail(resolvedIconUrl)
.setImage(resolvedImageUrl)
.setFooter({ text: "Click the button below to purchase instantly." });
const buyButton = new ButtonBuilder()
.setCustomId(`shop_buy_${item.id}`)
.setLabel(`Buy for ${item.price} 🪙`)
.setStyle(ButtonStyle.Success)
.setEmoji("🛒");
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(buyButton);
return { embeds: [embed], components: [row] };
}