diff --git a/commands/search/neopet.js b/commands/search/neopet.js index c45767e8..d69b1d6d 100644 --- a/commands/search/neopet.js +++ b/commands/search/neopet.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const petImage = require('neopet-image-finder'); +const request = require('node-superfetch'); const { list } = require('../../util/Util'); const moods = { happy: 1, @@ -45,10 +45,10 @@ module.exports = class NeopetCommand extends Command { async run(msg, { pet, mood }) { try { - const data = await petImage(pet, { mood: moods[mood] }); - if (!data) return msg.say('Could not find any results.'); - return msg.say({ files: [{ attachment: data.data, name: `${pet}.png` }] }); + const { body } = await request.get(`http://pets.neopets.com/cpn/${encodeURIComponent(name)}/${mood}/5.png`); + return msg.say({ files: [{ attachment: body, name: `${pet}-${mood}.png` }] }); } catch (err) { + if (err.status === 404) return msg.say('Could not find any results.'); return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } } diff --git a/package.json b/package.json index 96d93f78..61c36467 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "moment": "^2.24.0", "moment-duration-format": "^2.3.2", "moment-timezone": "^0.5.25", - "neopet-image-finder": "^5.0.2", "node-superfetch": "^0.1.9", "random-js": "^2.1.0", "winston": "^3.2.1"