const { EmbedBuilder } = require('discord.js'); const giveMeAJoke = require('give-me-a-joke'); module.exports = { name: "joke", description: "Gets a funny joke", async run(client, interaction) { let joke = await giveMeAJoke.getRandomDadJoke(); if (joke.includes("?")){ let jokeData = joke.split("?"); joke = `${jokeData[0]}?||${jokeData[1]}||`; } const embed = createJokeEmbed(joke, interaction.user); interaction.editReply({ embeds: [embed] }); }, }; function createJokeEmbed(joke, user) { return new EmbedBuilder() .setColor("#FF0000") .setTitle("Here is your joke...") .setDescription(joke) .setTimestamp() .setFooter({ text: `Requested by ${user.tag}`, iconURL: user.displayAvatarURL() }); }