Random Bird and Shiba

This commit is contained in:
Daniel Odendahl Jr
2018-09-26 23:39:40 +00:00
parent 8aaca6d46f
commit d4be43bfd7
4 changed files with 58 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
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 { body } = await request.get('http://random.birb.pw/tweet.json/');
return msg.say({ files: [`http://random.birb.pw/img/${body.file}`] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+30
View File
@@ -0,0 +1,30 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class ShibaCommand extends Command {
constructor(client) {
super(client, {
name: 'shiba',
aliases: ['shiba-inu', 'shibe', 'shibe-inu', 'doge'],
group: 'random',
memberName: 'shiba',
description: 'Responds with a random image of a Shiba Inu.',
clientPermissions: ['ATTACH_FILES']
});
}
async run(msg) {
try {
const { body } = await request
.get('https://shibe.online/api/shibes')
.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!`);
}
}
};