ravenbotv14/commands/general/joke.js

43 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-01-08 03:01:54 -05:00
const {
EmbedBuilder
} = require('discord.js');
var giveMeAJoke = require('give-me-a-joke');
2022-09-24 13:24:48 -04:00
module.exports = {
name: "joke",
description: "Gets a funny joke",
2023-01-08 03:01:54 -05:00
run: async (client, interaction) => {
giveMeAJoke.getRandomDadJoke(function (joke) {
2022-09-24 13:24:48 -04:00
2023-01-08 03:01:54 -05:00
if (joke.includes("?")){
let jokeData = joke.split("?")
const embed = new EmbedBuilder()
.setColor("#FF0000")
.setTitle("Here is your joke...")
.setDescription(jokeData[0] + "?||" + jokeData[1] + "||")
.setTimestamp()
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: `${interaction.user.displayAvatarURL()}`
});
interaction.editReply({
embeds: [embed]
});
} else {
const embed = new EmbedBuilder()
.setColor("#FF0000")
.setTitle("Here is your joke...")
.setDescription(joke)
.setTimestamp()
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: `${interaction.user.displayAvatarURL()}`
});
interaction.editReply({
embeds: [embed]
});
}
})
2022-09-24 13:24:48 -04:00
},
2023-01-08 03:01:54 -05:00
};