This commit is contained in:
Cedric Hoelzl 2020-07-02 20:32:54 +02:00
parent fc75ab2e69
commit b200426c10

View File

@ -24,7 +24,7 @@ const article_to_mess = function(art){
//=== MAIN MODULE CONFIG
const rssi = [
const rssi_ex = [
{
chat:'CHAT_ID',
url: 'RSS_URL',
@ -41,7 +41,33 @@ module.exports = function(rssi){
gps : false,
},
text : [
{
trigger : ["/refresh"],
public : false,
desc : {
0: "Force refresh the feeds",
},
requirements : (bot,event,message)=>{
return new Promise((resolve, reject)=>{
if(event.from && bot.admin.indexOf(event.from.id) == -1)
return reject(403);
return resolve(200);
});
},
action : (bot,event,message)=>{
return this.rssi.forEach(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=>
this.bot.telegram.sendMessage(entry.chat,article_to_mess(art),{"parse_mode":"Markdown"})
)
)
)
)
)
}
}
],
reply : [],
regex : [],