JaBa/commands/Fun/joke.js

39 lines
830 B
JavaScript
Raw Normal View History

const Command = require("../../base/Command"),
2022-01-04 02:18:28 +05:00
Discord = require("discord.js");
class Joke extends Command {
constructor(client) {
super(client, {
name: "joke",
dirname: __dirname,
enabled: true,
guildOnly: false,
2022-01-05 22:04:46 +05:00
aliases: ["jo"],
2022-01-04 02:18:28 +05:00
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
2022-01-14 00:52:51 +05:00
const joke = await this.client.icanhazdadjoke();
2022-01-14 01:13:22 +05:00
if (joke.status !== 200) return message.error("misc:ERR_OCCURRED");
2022-01-04 02:18:28 +05:00
const embed = new Discord.MessageEmbed()
2022-01-14 00:52:51 +05:00
.setDescription(joke.joke)
.setFooter({
2022-01-14 00:52:51 +05:00
text: message.translate("fun/joke:FOOTER", {
id: joke.id
})
})
.setColor(data.config.embed.color);
2022-01-04 02:18:28 +05:00
message.reply({
embeds: [embed]
});
2022-01-04 02:18:28 +05:00
}
2022-01-13 00:26:23 +05:00
}
2022-01-04 02:18:28 +05:00
module.exports = Joke;