Skip to content

Instantly share code, notes, and snippets.

@aodin aodin/gn.coffee
Created Dec 1, 2014

Embed
What would you like to do?
# Description:
# Get the top news item from HN
#
# Commands:
# hubot hn - Return the top item on HN
module.exports = (robot) ->
robot.respond /hn( me)?$/i, (msg) ->
story = hnTopStory(msg)
console.log story
if story?
msg.send 'Something interesting #{story}'
else
msg.send 'There is nothing interesting on HN. As usual.'
hnTopStory = (msg) ->
msg.http('https://hacker-news.firebaseio.com/v0/topstories/0.json')
.get() (err, res, body) ->
console.log body
body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.