Change cat API

This commit is contained in:
Dragon Fire
2020-06-29 20:18:01 -04:00
parent 1b94e959d0
commit c8156470e9
3 changed files with 15 additions and 7 deletions
+2 -2
View File
@@ -1398,8 +1398,6 @@ here.
- [Random-d.uk](https://random-d.uk/)
* duck ([API](https://random-d.uk/api))
* http-duck ([API](https://random-d.uk/http))
- [random.cat](https://random.cat/)
* cat (API)
- [RandomFox](https://randomfox.ca/)
* fox (API)
- [Recipe Puppy](http://www.recipepuppy.com/)
@@ -1524,6 +1522,8 @@ here.
* newspaper (API)
- [The Onion](https://www.theonion.com/)
* the-onion ([RSS Feed](https://www.theonion.com/rss))
- [TheCatAPI](https://thecatapi.com/)
* cat ([API](https://docs.thecatapi.com/))
- [This Artwork Does Not Exist](https://thisartworkdoesnotexist.com/)
* ai-artwork (API)
- [This Cat Does Not Exist](https://thiscatdoesnotexist.com/)
+12 -4
View File
@@ -1,5 +1,6 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { THECATAPI_KEY } = process.env;
module.exports = class CatCommand extends Command {
constructor(client) {
@@ -12,9 +13,10 @@ module.exports = class CatCommand extends Command {
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'random.cat',
url: 'https://random.cat/',
reason: 'API'
name: 'TheCatAPI',
url: 'https://thecatapi.com/',
reason: 'API',
reasonURL: 'https://docs.thecatapi.com/'
}
]
});
@@ -22,7 +24,13 @@ module.exports = class CatCommand extends Command {
async run(msg) {
try {
const { body } = await request.get('https://aws.random.cat/meow');
const { body } = await request
.get('https://api.thecatapi.com/images/search')
.query({
limit: 1,
mime_types: 'jpg,png'
})
.set({ 'x-api-key': THECATAPI_KEY });
return msg.say({ files: [body.file] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "117.4.0",
"version": "117.4.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {