JaBa/commands/Fun/joke.js
2022-01-05 22:04:46 +05:00

39 lines
No EOL
945 B
JavaScript

const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Joke extends Command {
constructor(client) {
super(client, {
name: "joke",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["jo"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
if (!this.client.config.apiKeys.blagueXYZ) return message.error("misc:COMMAND_DISABLED");
// const joke = await this.client.joker.randomJoke(data.guild.language.substr(0, 2));
const joke = await this.client.joker.randomJoke("en");
const embed = new Discord.MessageEmbed()
.setDescription(joke.toDiscordSpoils())
.setFooter({
text: message.translate("fun/joke:FOOTER")
})
.setColor(data.config.embed.color);
message.channel.send({
embeds: [embed]
});
}
};
module.exports = Joke;