Files
xiao/commands/random/bird.js
T
Daniel Odendahl Jr 301e9d1783 Fix bird
2018-09-26 23:44:56 +00:00

25 lines
681 B
JavaScript

const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class BirdCommand extends Command {
constructor(client) {
super(client, {
name: 'bird',
aliases: ['birb'],
group: 'random',
memberName: 'bird',
description: 'Responds with a random bird image.',
clientPermissions: ['ATTACH_FILES']
});
}
async run(msg) {
try {
const { text } = await request.get('http://random.birb.pw/tweet.json/');
return msg.say({ files: [`https://random.birb.pw/img/${JSON.parse(text).file}`] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};