Use noopet-image-finder

This commit is contained in:
Dragon Fire
2018-08-24 19:04:02 -04:00
parent fcc7227964
commit a1227cb446
2 changed files with 4 additions and 10 deletions
+3 -10
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const petImage = require('neopet-image-finder');
const { list } = require('../../util/Util');
const moods = {
happy: 1,
@@ -40,16 +40,9 @@ module.exports = class NeopetCommand extends Command {
async run(msg, { pet, mood }) {
try {
const { text } = await request
.get('http://www.sunnyneo.com/petimagefinder.php')
.query({
name: pet,
size: 5,
mood: moods[mood]
});
const link = text.match(/http:\/\/pets\.neopets\.com\/cp\/.+\.png/);
const link = await petImage(pet, { mood });
if (!link) return msg.say('Could not find any results.');
return msg.say(link[0]);
return msg.say(link);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1
View File
@@ -40,6 +40,7 @@
"discord.js-commando": "github:discordjs/Commando",
"erlpack": "github:discordapp/erlpack",
"mathjs": "^5.1.1",
"neopet-image-finder": "^4.0.0",
"node-opus": "^0.3.0",
"node-superfetch": "^0.1.4",
"random-js": "^1.0.8",