refactor: Extract UI component creation into new view files for lootdrop, trade, item wizard, and enrollment.
This commit is contained in:
41
src/modules/economy/lootdrop.view.ts
Normal file
41
src/modules/economy/lootdrop.view.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
|
||||
import { createBaseEmbed } from "@lib/embeds";
|
||||
|
||||
export function getLootdropMessage(reward: number, currency: string) {
|
||||
const embed = createBaseEmbed(
|
||||
"💰 LOOTDROP!",
|
||||
`A lootdrop has appeared! Click the button below to claim **${reward} ${currency}**!`,
|
||||
"#FFD700"
|
||||
);
|
||||
|
||||
const claimButton = new ButtonBuilder()
|
||||
.setCustomId("lootdrop_claim")
|
||||
.setLabel("CLAIM REWARD")
|
||||
.setStyle(ButtonStyle.Success)
|
||||
.setEmoji("💸");
|
||||
|
||||
const row = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(claimButton);
|
||||
|
||||
return { embeds: [embed], components: [row] };
|
||||
}
|
||||
|
||||
export function getLootdropClaimedMessage(originalTitle: string, userId: string, amount: number, currency: string) {
|
||||
const newEmbed = createBaseEmbed(
|
||||
originalTitle || "💰 LOOTDROP!",
|
||||
`✅ Claimed by <@${userId}> for **${amount} ${currency}**!`,
|
||||
"#00FF00"
|
||||
);
|
||||
|
||||
const newRow = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("lootdrop_claim_disabled")
|
||||
.setLabel("CLAIMED")
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
.setEmoji("✅")
|
||||
.setDisabled(true)
|
||||
);
|
||||
|
||||
return { embeds: [newEmbed], components: [newRow] };
|
||||
}
|
||||
Reference in New Issue
Block a user