diff --git a/README.md b/README.md index 7bcdca2c..b9bee971 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/commands/random-img/cat.js b/commands/random-img/cat.js index 5adc3ca0..2c314a85 100644 --- a/commands/random-img/cat.js +++ b/commands/random-img/cat.js @@ -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!`); diff --git a/package.json b/package.json index be50d82c..452641b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "117.4.0", + "version": "117.4.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {