Display links in all embed URLs

This commit is contained in:
Dragon Fire
2020-03-28 21:57:02 -04:00
parent 3ce12b79cd
commit 1c272e3307
17 changed files with 44 additions and 36 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { MessageEmbed } = require('discord.js');
const { embedURL } = require('../../util/Util');
module.exports = class DoomsdayClockCommand extends Command {
constructor(client) {
@@ -26,7 +27,7 @@ module.exports = class DoomsdayClockCommand extends Command {
const time = text.match(/<h3 class="uabb-infobox-title">(.+)<\/h3>/)[1];
const year = text.match(/<h5 class="uabb-infobox-title-prefix">(.+)<\/h5>/)[1];
const description = text.match(/<div class="uabb-infobox-text uabb-text-editor">.+<p>(.+)<\/p>/)[1]
.replace(/<a href="(.+)" target="_blank" rel="noopener">(.+)<\/a>/, '[$2]($1)')
.replace(/<a href="(.+)" target="_blank" rel="noopener">(.+)<\/a>/, embedURL('$2', '$1'))
.replace(/<em>(.+)<\/em>/i, '_$1_');
const embed = new MessageEmbed()
.setTitle(`${year}: ${time}`)
+2 -2
View File
@@ -1,6 +1,7 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { embedURL } = require('../../util/Util');
module.exports = class TodayInHistoryCommand extends Command {
constructor(client) {
@@ -51,8 +52,7 @@ module.exports = class TodayInHistoryCommand extends Command {
.setTitle(`On this day (${body.date})...`)
.setTimestamp()
.setDescription(`${event.year}: ${event.text}`)
.addField(' See More',
event.links.map(link => `[${link.title}](${link.link.replace(/\)/g, '%29')})`).join('\n'));
.addField(' See More', event.links.map(link => embedURL(link.title, link.link)).join('\n'));
return msg.embed(embed);
} catch (err) {
if (err.status === 404 || err.status === 500) return msg.say('Invalid date.');