kk
This commit is contained in:
		| @@ -15,8 +15,8 @@ var db = new db_js("rss_chan"); | |||||||
| const get_rss = function(url,min_id){ | const get_rss = function(url,min_id){ | ||||||
| 	return parser.parseURL(url).then(feed=>feed.items).then(items=>{ | 	return parser.parseURL(url).then(feed=>feed.items).then(items=>{ | ||||||
| 		let idx = items.findIndex(i => parseInt(i.guid) === min_id); | 		let idx = items.findIndex(i => parseInt(i.guid) === min_id); | ||||||
| 		if(idx>=0) return items.slice(0,idx); | 		if(idx>=0) return items.slice(0,idx).reverse(); | ||||||
| 		else return items; | 		else return items.reverse(); | ||||||
| 	}); | 	}); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -63,7 +63,7 @@ module.exports = function(rssi){ | |||||||
| 							Promise.all(articles.map(art=> | 							Promise.all(articles.map(art=> | ||||||
| 								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(rr=> | 							)).then(rr=> | ||||||
| 								(articles.length == 0) || db.set_v(entry.chat,parseInt(articles.pop().guid)) | 								(articles.length == 0) || db.set_v(entry.chat,parseInt(articles.shift().guid)) | ||||||
| 							) | 							) | ||||||
| 						) | 						) | ||||||
| 					) | 					) | ||||||
| @@ -98,7 +98,7 @@ module.exports = function(rssi){ | |||||||
| 									Promise.all(articles.map(art=> | 									Promise.all(articles.map(art=> | ||||||
| 										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(rr=> | 									)).then(rr=> | ||||||
| 										(articles.length == 0) || db.set_v(entry.chat,parseInt(articles.pop().guid)) | 										(articles.length == 0) || db.set_v(entry.chat,parseInt(articles.shift().guid)) | ||||||
| 									) | 									) | ||||||
| 								) | 								) | ||||||
| 							) | 							) | ||||||
|   | |||||||
| @@ -35,8 +35,8 @@ const get_url = function(opts){ | |||||||
| const get_rss = function(url,min_id){ | const get_rss = function(url,min_id){ | ||||||
| 	return parser.parseURL(url).then(feed=>feed.items).then(items=>{ | 	return parser.parseURL(url).then(feed=>feed.items).then(items=>{ | ||||||
| 		let idx = items.findIndex(i => parseInt(i.guid) === min_id); | 		let idx = items.findIndex(i => parseInt(i.guid) === min_id); | ||||||
| 		if(idx>=0) return items.slice(0,idx); | 		if(idx>=0) return items.slice(0,idx).reverse(); | ||||||
| 		else return items; | 		else return items.reverse(); | ||||||
| 	}); | 	}); | ||||||
| } | } | ||||||
| get_rss(get_url({org:ORG.BR, lang:'de',since:-3}),79718).then(r=>r.forEach(item=>{ | get_rss(get_url({org:ORG.BR, lang:'de',since:-3}),79718).then(r=>r.forEach(item=>{ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user