JaBa/commands/Fun/joke.js

39 lines
941 B
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Joke extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "joke",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
2021-12-10 21:39:54 +05:00
memberPermissions: [],
2021-12-26 19:29:37 +05:00
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 2000
2021-12-10 21:39:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2021-12-18 19:43:06 +05:00
if (!this.client.config.apiKeys.blagueXYZ) return message.error("misc:COMMAND_DISABLED");
2021-12-10 21:39:54 +05:00
// const joke = await this.client.joker.randomJoke(data.guild.language.substr(0, 2));
2021-12-26 19:29:37 +05:00
const joke = await this.client.joker.randomJoke("en");
2021-12-10 21:39:54 +05:00
const embed = new Discord.MessageEmbed()
.setDescription(joke.toDiscordSpoils())
2022-01-04 00:35:11 +05:00
.setFooter({
text: message.translate("fun/joke:FOOTER")
})
2022-01-03 23:20:33 +05:00
.setColor(data.config.embed.color);
2021-12-10 21:39:54 +05:00
2022-01-04 00:35:11 +05:00
message.channel.send({
embeds: [embed]
});
2021-12-10 21:39:54 +05:00
}
};
module.exports = Joke;