Files
xiao/commands/randomimg/dog.js
T
2017-05-25 23:20:58 +00:00

24 lines
629 B
JavaScript

const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
module.exports = class DogCommand extends Command {
constructor(client) {
super(client, {
name: 'dog',
group: 'randomimg',
memberName: 'dog',
description: 'Sends a random dog image.'
});
}
async run(msg) {
try {
const { body } = await snekfetch
.get('https://random.dog/woof.json');
return msg.say(body.url);
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
}
}
};