Haha-Yes/commands/fun/randodog.js

27 lines
804 B
JavaScript
Raw Normal View History

2018-09-26 13:47:21 +02:00
const { Command } = require('discord.js-commando');
const Discord = require('discord.js');
const snekfetch = require('snekfetch');
2018-09-26 13:48:54 +02:00
module.exports = class RandoDogCommand extends Command {
2018-09-26 13:47:21 +02:00
constructor(client) {
super(client, {
2018-09-26 13:48:54 +02:00
name: 'randodog',
2018-09-26 13:47:21 +02:00
group: 'fun',
2018-09-26 13:48:54 +02:00
memberName: 'randodog',
2018-09-26 13:47:21 +02:00
description: `Show a random doggy`,
});
}
async run(message, { city }) {
const { body } = await snekfetch.get(`https://random.dog/woof.json`);
if (body.cod == '404') {
return message.say(`No results found for **${city}**`);
}
const dogEmbed = new Discord.RichEmbed()
.setColor("#ff9900")
.setTitle('Woof')
.setImage(body.url)
message.say(dogEmbed);
}
};