mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 18:05:01 +02:00
Use noopet-image-finder
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const request = require('node-superfetch');
|
const petImage = require('neopet-image-finder');
|
||||||
const { list } = require('../../util/Util');
|
const { list } = require('../../util/Util');
|
||||||
const moods = {
|
const moods = {
|
||||||
happy: 1,
|
happy: 1,
|
||||||
@@ -40,16 +40,9 @@ module.exports = class NeopetCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { pet, mood }) {
|
async run(msg, { pet, mood }) {
|
||||||
try {
|
try {
|
||||||
const { text } = await request
|
const link = await petImage(pet, { mood });
|
||||||
.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/);
|
|
||||||
if (!link) return msg.say('Could not find any results.');
|
if (!link) return msg.say('Could not find any results.');
|
||||||
return msg.say(link[0]);
|
return msg.say(link);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
"discord.js-commando": "github:discordjs/Commando",
|
"discord.js-commando": "github:discordjs/Commando",
|
||||||
"erlpack": "github:discordapp/erlpack",
|
"erlpack": "github:discordapp/erlpack",
|
||||||
"mathjs": "^5.1.1",
|
"mathjs": "^5.1.1",
|
||||||
|
"neopet-image-finder": "^4.0.0",
|
||||||
"node-opus": "^0.3.0",
|
"node-opus": "^0.3.0",
|
||||||
"node-superfetch": "^0.1.4",
|
"node-superfetch": "^0.1.4",
|
||||||
"random-js": "^1.0.8",
|
"random-js": "^1.0.8",
|
||||||
|
|||||||
Reference in New Issue
Block a user