This commit is contained in:
Cedric Hoelzl 2020-07-02 20:58:17 +02:00
parent 521e7d037c
commit 0411a48371

View File

@ -55,21 +55,17 @@ module.exports = function(rssi){
}); });
}, },
action : (bot,event,message)=>{ action : (bot,event,message)=>{
return Promise.all(this.rssi.map(entry=>{ return Promise.all(this.rssi.map(entry=>
console.log(entry); db.get_v(entry.chat).then(v=>
return db.get_v(entry.chat).then(v=>{ get_rss(entry.url,v).then(articles=>
console.log(v) articles.forEach(art=>
return get_rss(entry.url,v).then(articles=>{ db.set_v(entry.chat,parseInt(art.guid)).then(rr=>
console.log(articles)
articles.forEach(art=>{
console.log(art.title)
return db.set_v(entry.url,parseInt(art.guid)).then(rr=>
this.bot.telegram.sendMessage(entry.chat,article_to_mess(art),{"parse_mode":"Markdown"}) 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)=> { action : (bot)=> {
this.bot = bot; this.bot = bot;
return ()=>{ return ()=>{
return this.rssi.forEach(entry=> return Promise.all(this.rssi.map(entry=>
db.get_v(entry.chat).then(v=> db.get_v(entry.chat).then(v=>
get_rss(entry.url,v).then(articles=> get_rss(entry.url,v).then(articles=>
articles.forEach(art=> 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"}) this.bot.telegram.sendMessage(entry.chat,article_to_mess(art),{"parse_mode":"Markdown"})
) )
) )
) )
) )
) ));
}; };
} }
} }