mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Use noopet-image-finder
This commit is contained in:
@@ -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!`);
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user