diff --git a/commands/search/nasa.js b/commands/search/nasa.js index d850c81a..c58b988e 100644 --- a/commands/search/nasa.js +++ b/commands/search/nasa.js @@ -34,7 +34,7 @@ module.exports = class NASACommand extends Command { const data = images[Math.floor(Math.random() * images.length)]; const embed = new MessageEmbed() .setTitle(data.data[0].title) - .setDescription(shorten(data.data[0].description)) + .setDescription(shorten(this.cleanHTML(data.data[0].description))) .setColor(0x2E528E) .setAuthor('NASA', 'https://i.imgur.com/Wh8jY9c.png', 'https://www.nasa.gov/multimedia/imagegallery/index.html') .setImage(data.links[0].href) @@ -46,4 +46,11 @@ module.exports = class NASACommand extends Command { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } } + + cleanHTML(text) { + return text + .replace(/<\/?b>/g, '**') + .replace(/<\/?i>/g, '*') + .replace(/)?(.+)<\/a>/g, '[$2]($1)'); + } };