Return Embeds and Button
Embed
const { ..., EmbedBuilder } = require('discord.js');// Reply command
client.on('interactionCreate', async interaction => {
...
if (commandName === 'ping') {
...
} else if (commandName === 'animal') {
const animalInput = interaction.options.getString('animal');
const animalOutput = animals.find(animal => animal.name_en == animalInput);
const embed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle(animalOutput.name_en)
.setURL(animalOutput.reference_url)
.setAuthor({
name: 'zookeeper',
iconURL: "https://i.imgur.com/dxeXsqc.jpeg",
url: 'https://khaokheow.zoothailand.org/intro.php'
})
.setDescription(animalOutput.description)
.setThumbnail(animalOutput.image_url)
.addFields(
{ name: 'Scientific Name', value: animalOutput.scientific_name, inline: true },
{ name: 'Food', value: animalOutput.diet },
{ name: 'Zoo Place', value: animalOutput.place, inline: true },
)
.setImage(animalOutput.image_url)
.setTimestamp()
.setFooter({ text: '❤️', iconURL: "https://i.imgur.com/dxeXsqc.jpeg" }
);
await interaction.reply({ embeds: [embed] });
}
});

Button
Last updated