const Command = require('../../structures/Command'); const request = require('node-superfetch'); const { MessageEmbed } = require('discord.js'); module.exports = class DoomsdayClockCommand extends Command { constructor(client) { super(client, { name: 'doomsday-clock', group: 'events', memberName: 'doomsday-clock', description: 'Responds with the current time of the Doomsday Clock.' }); } async run(msg) { try { const { text } = await request.get('https://thebulletin.org/doomsday-clock/past-announcements/'); const time = text.match(/
(.+)<\/p>/)[1];
const image = text.match(/(.+)<\/a>/, '[$2]($1)'));
return msg.embed(embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};