vylbot-app/commands/bunny.js

36 lines
968 B
JavaScript
Raw Normal View History

// Required components
2020-11-04 17:00:23 +00:00
const { command } = require('vylbot-core');
const { MessageEmbed } = require('discord.js');
2021-02-17 18:12:45 +00:00
const randomBunny = require('random-bunny');
2020-11-04 17:00:23 +00:00
// Command variables
2020-11-04 17:00:23 +00:00
const embedColor = "0x3050ba";
// Command class
2020-11-04 17:00:23 +00:00
class bunny extends command {
constructor() {
// Set run method, description, and category
2020-11-04 17:00:23 +00:00
super("bunny");
super.description = "Gives you a random bunny";
super.category = "Fun";
}
// Run method
2020-11-04 17:00:23 +00:00
bunny(context) {
// Get a random post from r/Rabbits
2021-02-17 18:12:45 +00:00
randomBunny('rabbits', 'hot', (image, title) => {
// Create an embed containing the random image
2021-02-17 18:12:45 +00:00
const embed = new MessageEmbed()
2020-11-04 17:00:23 +00:00
.setColor(embedColor)
2021-02-17 18:12:45 +00:00
.setTitle(title)
.setImage(image)
.setFooter('r/Rabbits');
2020-11-04 17:00:23 +00:00
// Send the embed
2020-11-04 17:00:23 +00:00
context.message.channel.send(embed);
});
}
}
module.exports = bunny;