mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 05:51:35 +02:00
Neopets Item
This commit is contained in:
@@ -13,7 +13,7 @@ module.exports = class NeopetCommand extends Command {
|
|||||||
constructor(client) {
|
constructor(client) {
|
||||||
super(client, {
|
super(client, {
|
||||||
name: 'neopet',
|
name: 'neopet',
|
||||||
aliases: ['neopet-image', 'neopet-image-finder'],
|
aliases: ['neopet-pet', 'neopet-image', 'neopet-image-finder'],
|
||||||
group: 'search',
|
group: 'search',
|
||||||
memberName: 'neopet',
|
memberName: 'neopet',
|
||||||
description: 'Responds with the image of a specific Neopet.',
|
description: 'Responds with the image of a specific Neopet.',
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
const { Command } = require('discord.js-commando');
|
||||||
|
const snekfetch = require('snekfetch');
|
||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class NeopetItemCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'neopet-item',
|
||||||
|
aliases: ['jellyneo', 'jellyneo-item', 'jellyneo-item-database'],
|
||||||
|
group: 'search',
|
||||||
|
memberName: 'neopet-item',
|
||||||
|
description: 'Responds with information on a specific Neopets item.',
|
||||||
|
clientPermissions: ['EMBED_LINKS'],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'item',
|
||||||
|
prompt: 'What item would you like to get information on?',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { item }) {
|
||||||
|
try {
|
||||||
|
const search = await snekfetch
|
||||||
|
.get('https://items.jellyneo.net/search/')
|
||||||
|
.query({
|
||||||
|
name: item,
|
||||||
|
name_type: 3
|
||||||
|
});
|
||||||
|
const id = search.text.match(/\/item\/([0-9]+)/);
|
||||||
|
if (!id) return msg.say('Could not find any results.');
|
||||||
|
const { text } = await snekfetch.get(`https://items.jellyneo.net/item/${id[1]}/`);
|
||||||
|
const embed = new MessageEmbed()
|
||||||
|
.setColor(0xFFCE31)
|
||||||
|
.setAuthor('Neopets', 'https://i.imgur.com/umW0YwZ.png')
|
||||||
|
.setTitle(text.match(/<h1>(.+)<\/h1>/)[1])
|
||||||
|
.setDescription(text.match(/<em>(.+)<\/em>/)[1])
|
||||||
|
.setURL(`https://items.jellyneo.net/item/${id[1]}/`)
|
||||||
|
.setThumbnail(`https://items.jellyneo.net/assets/imgs/items/${id[1]}.gif`)
|
||||||
|
.addField('❯ Price',
|
||||||
|
search.text.match(/[0-9]+ NP/)[0]);
|
||||||
|
return msg.embed(embed);
|
||||||
|
} catch (err) {
|
||||||
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "56.4.0",
|
"version": "56.5.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "XiaoBot.js",
|
"main": "XiaoBot.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user