From c57d218997f4af407935a78db21a34b9f32f9325 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sun, 14 May 2017 21:20:17 +0000 Subject: [PATCH] Fixes in Anime --- commands/search/anime.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/commands/search/anime.js b/commands/search/anime.js index 955ab726..3f9dd0af 100644 --- a/commands/search/anime.js +++ b/commands/search/anime.js @@ -32,13 +32,19 @@ module.exports = class AnimeCommand extends Command { .get(`https://${ANIMELIST_LOGIN}@myanimelist.net/api/anime/search.xml?q=${query}`) .buffer(true); const $ = cheerio.load(text, { xmlMode: true }); + const synopsis = $('synopsis').first().text().substr(0, 2000) + .replace(/(
)/g, '') + .replace(/(')/g, '\'') + .replace(/(—)/g, '—') + .replace(/(")/g, '"') + .replace(/(&)/g, '&'); const embed = new RichEmbed() .setColor(0x2D54A2) .setAuthor('My Anime List', 'https://i.imgur.com/R4bmNFz.png') .setURL(`https://myanimelist.net/anime/${$('id').first().text()}`) .setThumbnail($('image').first().text()) - .setTitle(`${$('title').first().text()} (${$('english').first().text()})`) - .setDescription($('synopsis').first().text().replace(/(
)/g, '').substr(0, 2000)) + .setTitle(`${$('title').first().text()} (English: ${$('english').first().text() || 'N/A'})`) + .setDescription(synopsis) .addField('Type', `${$('type').first().text()} - ${$('status').first().text()}`, true) .addField('Episodes',