Use neopet-image-finder

This commit is contained in:
lilyissillyyy
2025-10-03 20:10:33 -04:00
parent 0263cfdc1a
commit 86e389d2ad
3 changed files with 5 additions and 7 deletions
+1
View File
@@ -723,6 +723,7 @@ Total: 514
* [moment](https://www.npmjs.com/package/moment)
* [moment-duration-format](https://www.npmjs.com/package/moment-duration-format)
* [moment-timezone](https://www.npmjs.com/package/moment-timezone)
* [neopet-image-finder](https://www.npmjs.com/package/neopet-image-finder)
* [node-superfetch](https://www.npmjs.com/package/node-superfetch)
* [nsfwjs](https://www.npmjs.com/package/nsfwjs)
* [ntcjs](https://www.npmjs.com/package/ntcjs)
+3 -7
View File
@@ -1,6 +1,5 @@
const Command = require('../../framework/Command');
const request = require('node-superfetch');
const UserAgent = require('user-agents');
const petImage = require('neopet-image-finder');
const { list } = require('../../util/Util');
const moods = {
happy: 1,
@@ -44,11 +43,8 @@ module.exports = class NeopetCommand extends Command {
async run(msg, { pet, mood }) {
try {
const agent = new UserAgent();
const { body } = await request
.get(`http://pets.neopets.com/cpn/${encodeURIComponent(pet)}/${mood}/5.png`)
.set({ 'User-Agent': agent.toString() });
return msg.say({ files: [{ attachment: body, name: `${pet}-${mood}.png` }] });
const petImg = await petImage(pet, { mood, size: 5 });
return msg.say({ files: [{ attachment: petImg.data, name: `${pet}-${mood}.png` }] });
} catch (err) {
if (err.status === 404) return msg.say('Could not find any results.');
throw err;
+1
View File
@@ -66,6 +66,7 @@
"moment": "^2.30.1",
"moment-duration-format": "^2.3.2",
"moment-timezone": "^0.6.0",
"neopet-image-finder": "^5.0.3",
"node-superfetch": "^0.3.5",
"nsfwjs": "^4.2.1",
"ntcjs": "^1.1.3",