diff --git a/commands/update.js b/commands/update.js index fd73444..facfbc2 100644 --- a/commands/update.js +++ b/commands/update.js @@ -5,7 +5,11 @@ module.exports = { description: 'Get RSS Source Link', execute(message, args) { message.reply(`Loading Feeds from Sources`); - libFlayer.loadFeeds(); + try { + libFlayer.loadFeeds(); + } catch (error) { + console.log(error); + } feedArray = libFlayer.getFeeds(); } diff --git a/index.js b/index.js index 9c94f65..35a6930 100644 --- a/index.js +++ b/index.js @@ -41,8 +41,12 @@ server.all("/",(req, res) => { function keepAlive() { server.listen(PORT, () => { console.log("Keep Alive Server Running"); + try { libFlayer.loadFeeds(); libFlayer.feedArray = libFlayer.getFeeds(); + } catch (error) { + console.log(error); + } }) } @@ -78,8 +82,11 @@ client.on('message', message => { console.log("Link Flayer Bot Activating"); keepAlive(); client.login(token); //Load Client Discord Token - +try { libFlayer.loadFeeds(); +} catch (error) { + console.log(error); + } diff --git a/libFlayer.js b/libFlayer.js index 5834cf1..a5484d5 100644 --- a/libFlayer.js +++ b/libFlayer.js @@ -168,13 +168,12 @@ exports.loadFeeds = function () { feeds.forEach(feedBlock => { (async () => { - try { + const feed = parser.parseURL(feedBlock.link, function (err, feed) { if (err) { console.log(err + " " + feedBlock.link); //return; } - console.log(feed.title); feed.items.forEach(item => { var foundFeed = false; @@ -196,9 +195,7 @@ exports.loadFeeds = function () { }); }) - } catch (error) { - console.log(error); - } + })().then(); }); return;