summaryrefslogtreecommitdiffstats
path: root/news
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2014-03-17 01:05:55 +0100
committertv <tv@nomic.retiolum>2014-03-17 01:05:55 +0100
commit45dae6eb0ac52a2eee2e24b0bfb553a0d7371a2e (patch)
treece2060c38bc7d2261ff978342a746f8dad25bc24 /news
parenta857b628b5a6d9e4e6e5d0f0192ab6f657afaffb (diff)
newsbot.js: use guid to identify articles
Diffstat (limited to 'news')
-rw-r--r--news/newsbot.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/news/newsbot.js b/news/newsbot.js
index 998482cd..18a7fb07 100644
--- a/news/newsbot.js
+++ b/news/newsbot.js
@@ -134,22 +134,22 @@ function create_feedbot (nick, uri, channels) {
return a.date - b.date
})
- var indexOfLastTitle = items
- .map(function (x) { return x.title })
- .indexOf(client.lastTitle)
+ var indexOfLastGuid = items
+ .map(function (x) { return x.guid })
+ .indexOf(client.lastGuid)
var newitems = items
var olditems = []
- // if items contain lastTitle, then only items after that are news
- if (!!~indexOfLastTitle) {
- olditems = newitems.splice(0, indexOfLastTitle + 1)
+ // if items contain lastGuid, then only items after that are news
+ if (!!~indexOfLastGuid) {
+ olditems = newitems.splice(0, indexOfLastGuid + 1)
}
if (newitems.length > 0) {
// only broadcast news if we're not starting up
- // (i.e. we already have a lastTitle)
- if (client.lastTitle) {
+ // (i.e. we already have a lastGuid)
+ if (client.lastGuid) {
newitems.forEach(function (item) {
return getShortLink(item.link, function (error, shortlink) {
return broadcast(item.title + ' ' + shortlink)
@@ -157,7 +157,7 @@ function create_feedbot (nick, uri, channels) {
})
}
- client.lastTitle = newitems[newitems.length - 1].title
+ client.lastGuid = newitems[newitems.length - 1].guid
}
return setTimeout(loop_feedparser, feedbot_loop_delay)