mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-10 19:04:42 +02:00
Display links in all embed URLs
This commit is contained in:
@@ -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}`)
|
||||
|
||||
@@ -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.');
|
||||
|
||||
Reference in New Issue
Block a user