From 0411a48371295564ccfb0a3f776999d113a209ec Mon Sep 17 00:00:00 2001 From: Cedric Hoelzl Date: Thu, 2 Jul 2020 20:58:17 +0200 Subject: [PATCH] newv --- config.js | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/config.js b/config.js index 7133f45..9266497 100644 --- a/config.js +++ b/config.js @@ -55,21 +55,17 @@ module.exports = function(rssi){ }); }, action : (bot,event,message)=>{ - return Promise.all(this.rssi.map(entry=>{ - console.log(entry); - return db.get_v(entry.chat).then(v=>{ - console.log(v) - return get_rss(entry.url,v).then(articles=>{ - console.log(articles) - articles.forEach(art=>{ - console.log(art.title) - return db.set_v(entry.url,parseInt(art.guid)).then(rr=> + return Promise.all(this.rssi.map(entry=> + db.get_v(entry.chat).then(v=> + get_rss(entry.url,v).then(articles=> + articles.forEach(art=> + db.set_v(entry.chat,parseInt(art.guid)).then(rr=> this.bot.telegram.sendMessage(entry.chat,article_to_mess(art),{"parse_mode":"Markdown"}) ) - }) - }) - }) - })).then(r=>event.reply("Refreshed all Feeds")); + ) + ) + ) + )).then(r=>event.reply("Refreshed all Feeds")); } } ], @@ -94,17 +90,17 @@ module.exports = function(rssi){ action : (bot)=> { this.bot = bot; return ()=>{ - return this.rssi.forEach(entry=> + return Promise.all(this.rssi.map(entry=> db.get_v(entry.chat).then(v=> get_rss(entry.url,v).then(articles=> articles.forEach(art=> - db.set_v(entry.url,parseInt(art.guid)).then(rr=> + db.set_v(entry.chat,parseInt(art.guid)).then(rr=> this.bot.telegram.sendMessage(entry.chat,article_to_mess(art),{"parse_mode":"Markdown"}) ) ) ) ) - ) + )); }; } }