Files
xiao/commands/random/dog.js
T
Daniel Odendahl Jr 45c8d62dd5 Credit Command
2019-04-14 00:03:38 +00:00

31 lines
733 B
JavaScript

const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class DogCommand extends Command {
constructor(client) {
super(client, {
name: 'dog',
aliases: ['puppy'],
group: 'random',
memberName: 'dog',
description: 'Responds with a random dog image.',
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Dog API',
url: 'https://dog.ceo/dog-api/'
}
]
});
}
async run(msg) {
try {
const { body } = await request.get('https://dog.ceo/api/breeds/image/random');
return msg.say({ files: [body.message] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};