Files
discord-rpg-concept/bot/modules/economy/lootdrop.view.ts
2026-01-08 16:09:26 +01:00

44 lines
1.7 KiB
TypeScript

import { ActionRowBuilder, AttachmentBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import { generateLootdropCard, generateClaimedLootdropCard } from "@/graphics/lootdrop";
export async function getLootdropMessage(reward: number, currency: string) {
const cardBuffer = await generateLootdropCard(reward, currency);
const attachment = new AttachmentBuilder(cardBuffer, { name: "lootdrop.png" });
const claimButton = new ButtonBuilder()
.setCustomId("lootdrop_claim")
.setLabel("CLAIM REWARD")
.setStyle(ButtonStyle.Secondary) // Changed to Secondary to fit the darker theme better? Or keep Success? Let's try Secondary with custom emoji
.setEmoji("🌠");
const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents(claimButton);
return {
content: "",
files: [attachment],
components: [row]
};
}
export async function getLootdropClaimedMessage(userId: string, username: string, avatarUrl: string, amount: number, currency: string) {
const cardBuffer = await generateClaimedLootdropCard(amount, currency, username, avatarUrl);
const attachment = new AttachmentBuilder(cardBuffer, { name: "lootdrop_claimed.png" });
const newRow = new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setCustomId("lootdrop_claim_disabled")
.setLabel("CLAIMED")
.setStyle(ButtonStyle.Secondary)
.setEmoji("✅")
.setDisabled(true)
);
return {
content: ``, // Remove content as the image says it all
files: [attachment],
components: [newRow]
};
}