{"size": 760, "ext": "js", "max_stars_repo_path": "commands/OSRS_Utility/news.js", "max_stars_repo_name": "FearrMe/oldschoolbot", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "commands/OSRS_Utility/news.js", "max_issues_repo_name": "FearrMe/oldschoolbot", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "commands/OSRS_Utility/news.js", "max_forks_repo_name": "FearrMe/oldschoolbot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.5161290323, "max_line_length": 108, "alphanum_fraction": 0.6763157895}
const { Command } = require('klasa');
const { MessageEmbed } = require('discord.js');
const Parser = require('rss-parser');
const parser = new Parser();

module.exports = class extends Command {

	constructor(...args) {
		super(...args, {
			cooldown: 5,
			description: 'Shows the latest OSRS News Post.'
		});
	}

	async run(msg) {
		const feed = await parser.parseURL('http://services.runescape.com/m=news/latest_news.rss?oldschool=true');
		const news = feed.items[0];

		const embed = new MessageEmbed()
			.setTitle(news.title)
			.setDescription(news.contentSnippet)
			.setColor(52224)
			.setThumbnail(news.enclosure.url)
			.setURL(news.guid)
			.setFooter(news.categories[0], 'http://i.imgur.com/fVakfwp.png');

		return msg.send({ embed });
	}

};
