relevant-animals
Version:
Return cute animals, made for everyone with useful methods using promises and snekfetch.
29 lines (23 loc) • 762 B
JavaScript
const snekfetch = require('snekfetch');
function shibe() {
return snekfetch.get('http://shibe.online/api/shibes?count=1&urls=true&httpsUrls=true')
.then(res => res.body && res.body[0] ? res.body[0] : Promise.reject(null));
}
function cat() {
return snekfetch.get('http://random.cat/meow')
.then(res => res.body && res.body.file ? res.body.file : Promise.reject(null));
}
function dog() {
return snekfetch.get('http://random.dog/woof')
.then(res => res.body ? `http://random.dog/${res.body}` : Promise.reject(null));
}
function wolf() {
return snekfetch.get('http://i-hate.ovh/api/images/wolf.html')
.then(res => res ? res : Promise.reject(null));
}
module.exports = {
shibe,
cat,
dog,
wolf
};