Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 11 lines (11 sloc) 0.382 kb
1 2 3 4 5 6 7 8 9 10 11
#gets tweet from user
module.exports = (robot) ->
  robot.respond /(twitter|lasttweet) (.+)$/, (msg) ->
   username = msg.match[2]
   msg.http("http://api.twitter.com/1/statuses/user_timeline/#{escape(username)}.json?count=1")
    .get() (err, res, body) ->
      response = JSON.parse body
      if response[0]
       msg.send response[0]["text"]
      else
       msg.send "Error"
Something went wrong with that request. Please try again.