Skip to content

Commit c6a43a3

Browse files
Merge pull request github#1487 from paulgreg/master
rsstodolist : respond in a single reply and show description if any...
2 parents c5140c1 + bd4df20 commit c6a43a3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/scripts/rsstodolist.coffee

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,20 @@ module.exports = (robot) ->
4343
.query(l: arg || 10)
4444
.get() (err, res, body) ->
4545
try
46+
reply = ''
4647
xml = jsdom.jsdom(body)
4748
for item in xml.getElementsByTagName("rss")[0].getElementsByTagName("channel")[0].getElementsByTagName("item")
4849
do (item) ->
4950
link = item.getElementsByTagName("link")[0].childNodes[0].nodeValue
5051
title = item.getElementsByTagName("title")[0].childNodes[0].nodeValue
51-
hubotReply = " - #{title}, [#{link}]"
52-
msg.reply hubotReply
52+
descriptionNode = item.getElementsByTagName("description")[0]
53+
description = descriptionNode.childNodes[0].nodeValue if descriptionNode.childNodes.length == 1
54+
55+
reply += " - #{title},"
56+
reply += " #{description}" if description?
57+
reply += " [#{link}]\n"
5358
catch err
5459
msg.reply err
60+
61+
msg.reply reply
62+

0 commit comments

Comments
 (0)