mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-05 13:53:12 +02:00
Neopets improvements
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { list } = require('../../util/Util');
|
||||
const moods = {
|
||||
happy: 1,
|
||||
sad: 2,
|
||||
angry: 3,
|
||||
sick: 4,
|
||||
none: 5
|
||||
};
|
||||
|
||||
module.exports = class NeopetCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -14,19 +22,30 @@ module.exports = class NeopetCommand extends Command {
|
||||
key: 'pet',
|
||||
prompt: 'What pet would you like to get an image of?',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
key: 'mood',
|
||||
prompt: `What mood should the pet be in? Either ${list(Object.keys(moods), 'or')}.`,
|
||||
type: 'string',
|
||||
default: 'happy',
|
||||
validate: mood => {
|
||||
if (moods[mood.toLowerCase()]) return true;
|
||||
return `Invalid mood, please enter either ${list(Object.keys(moods), 'or')}.`;
|
||||
},
|
||||
parse: mood => mood.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { pet }) {
|
||||
async run(msg, { pet, mood }) {
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
.get('http://www.sunnyneo.com/petimagefinder.php')
|
||||
.query({
|
||||
name: pet,
|
||||
size: 5,
|
||||
mood: 1
|
||||
mood: moods[mood]
|
||||
});
|
||||
const link = text.match(/http:\/\/pets\.neopets\.com\/cp\/.+\.png/);
|
||||
if (!link) return msg.say('Could not find any results.');
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "56.3.0",
|
||||
"version": "56.3.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "XiaoBot.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user