From b200426c100dc3fe9bcd61e8289f634aa2183719 Mon Sep 17 00:00:00 2001 From: Cedric Hoelzl Date: Thu, 2 Jul 2020 20:32:54 +0200 Subject: [PATCH] newv --- config.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index 634fe1a..f21ba24 100644 --- a/config.js +++ b/config.js @@ -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 : [],