Fix HTML Tags in Doomsday Clock

This commit is contained in:
Dragon Fire
2020-01-22 11:36:26 -05:00
parent 5422f74f96
commit 11412be037
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -25,13 +25,15 @@ module.exports = class DoomsdayClockCommand extends Command {
const { text } = await request.get('https://thebulletin.org/doomsday-clock/past-announcements/');
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];
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(/<em>(.+)<\/em>/i, '_$1_');
const embed = new MessageEmbed()
.setTitle(`${year}: ${time}`)
.setColor(0x000000)
.setURL('https://thebulletin.org/doomsday-clock/current-time/')
.setAuthor('Bulletin of the Atomic Scientists', undefined, 'https://thebulletin.org/')
.setDescription(description.replace(/<a href="(.+)" target="_blank" rel="noopener">(.+)<\/a>/, '[$2]($1)'));
.setDescription(description);
return msg.embed(embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "110.1.1",
"version": "110.1.2",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {