From a6903c88d8ea558429041f77a54ffb0752239b81 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 10 Sep 2020 10:31:35 -0400 Subject: [PATCH] Fix unspoiler nothing, Upgrade Yu-Gi-Oh API --- commands/edit-text/unspoiler.js | 5 ++++- commands/search/yu-gi-oh.js | 8 ++++---- package.json | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/commands/edit-text/unspoiler.js b/commands/edit-text/unspoiler.js index 5e779c9c..9deebf76 100644 --- a/commands/edit-text/unspoiler.js +++ b/commands/edit-text/unspoiler.js @@ -4,6 +4,7 @@ module.exports = class UnspoilerCommand extends Command { constructor(client) { super(client, { name: 'unspoiler', + aliases: ['unspoil'], group: 'edit-text', memberName: 'unspoiler', description: 'Removes all spoilers from a message.', @@ -18,6 +19,8 @@ module.exports = class UnspoilerCommand extends Command { } run(msg, { message }) { - return msg.say(message.content.replace(/\|\|([^|]+)\|\|/g, '$1')); + const unspoiled = message.content.replace(/\|\|([^|]+)\|\|/g, '$1'); + if (!unspoiled.trim()) return msg.say('_ _'); + return msg.say(unspoiled); } }; diff --git a/commands/search/yu-gi-oh.js b/commands/search/yu-gi-oh.js index 83fdb52b..522cdc48 100644 --- a/commands/search/yu-gi-oh.js +++ b/commands/search/yu-gi-oh.js @@ -39,19 +39,19 @@ module.exports = class YuGiOhCommand extends Command { async run(msg, { card }) { try { const { body } = await request - .get('https://db.ygoprodeck.com/api/v4/cardinfo.php') + .get('https://db.ygoprodeck.com/api/v7/cardinfo.php') .query({ - name: card, + fname: card, la: 'english' }); - const data = body[0][0]; + const data = body.data[0]; const embed = new MessageEmbed() .setColor(0xBE5F1F) .setTitle(data.name) .setURL(`https://db.ygoprodeck.com/card/?search=${data.id}`) .setDescription(data.type === 'Normal Monster' ? `_${shorten(data.desc)}_` : shorten(data.desc)) .setAuthor('Yu-Gi-Oh!', 'https://i.imgur.com/AJNBflD.png', 'http://www.yugioh-card.com/') - .setThumbnail(data.image_url) + .setThumbnail(data.card_images.image_url) .setFooter(data.id) .addField('❯ Type', data.type, true) .addField(data.type.includes('Monster') ? '❯ Race' : '❯ Spell Type', data.race, true); diff --git a/package.json b/package.json index 5fc76e49..4ff6a38f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.23.3", + "version": "119.23.4", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {