|
| 1 | +import {ActionRowBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, EmbedBuilder, MessageFlags} from "discord.js"; |
| 2 | +import {ExtendedClient} from "../../../types/client.js"; |
| 3 | +import {convertToEmojiPng} from "../../../helper/emojis.js"; |
| 4 | +import {database} from "../../../main/database.js"; |
| 5 | + |
| 6 | +export default { |
| 7 | + id: "vanity-show-embed", |
| 8 | + |
| 9 | + /** |
| 10 | + * |
| 11 | + * @param {ButtonInteraction} interaction |
| 12 | + * @param {ExtendedClient} client |
| 13 | + */ |
| 14 | + async execute(interaction: ButtonInteraction, client: ExtendedClient) { |
| 15 | + |
| 16 | + const data = await database.vanityEmbed.findFirst({ |
| 17 | + where: { |
| 18 | + VanityId: interaction.customId.split(":")[1] |
| 19 | + }, |
| 20 | + include: { |
| 21 | + Author: true |
| 22 | + } |
| 23 | + }); |
| 24 | + |
| 25 | + |
| 26 | + await interaction.reply({ |
| 27 | + embeds: [ |
| 28 | + new EmbedBuilder() |
| 29 | + .setDescription( |
| 30 | + [`## ${await convertToEmojiPng("link", client.user.id)} Vanity Embed`, |
| 31 | + ``, |
| 32 | + `${await convertToEmojiPng("message", client.user.id)} **Title**: ${data.Title ?? "N/A"}`, |
| 33 | + `${await convertToEmojiPng("message", client.user.id)} **Description**: ${data.Description ?? "N/A"}`, |
| 34 | + `${await convertToEmojiPng("color", client.user.id)} **Color**: ${data.Color ?? "N/A"}`, |
| 35 | + `${await convertToEmojiPng("image", client.user.id)} **Image**: ${data.ImageUrl ?? "N/A"}`, |
| 36 | + `${await convertToEmojiPng("image", client.user.id)} **Thumbnail**: ${data.ThumbnailUrl ?? "N/A"}`, |
| 37 | + `${await convertToEmojiPng("signature", client.user.id)} **Author**: ${data.Author ?? "N/A"}`, |
| 38 | + `- ${await convertToEmojiPng("renamesolid24", client.user.id)} **Name**: ${data.Author?.Name ?? "N/A"}`, |
| 39 | + `- ${await convertToEmojiPng("link", client.user.id)} **Url**: ${data.Author?.URL ?? "N/A"}`, |
| 40 | + `- ${await convertToEmojiPng("image", client.user.id)} **Icon**: ${data.Author?.IconURL ?? "N/A"}`, |
| 41 | + ].join("\n")) |
| 42 | + ], |
| 43 | + flags: MessageFlags.Ephemeral, |
| 44 | + }) |
| 45 | + } |
| 46 | +}; |
0 commit comments