mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 14:00:22 +02:00
Random Bird Command
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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 image of a bird.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('https://shibe.online/api/birds')
|
||||
.query({
|
||||
count: 1,
|
||||
urls: true,
|
||||
httpsUrls: true
|
||||
});
|
||||
return msg.say({ files: [body[0]] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user