Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 25 lines (23 sloc) 0.536 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# Description:
# None
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot cheerlights - get last color from http://www.cheerlights.com
#
# Author:
# marciotoshio

module.exports = (robot) ->
  robot.respond /cheerlights/i, (msg) ->
   msg.http("http://api.thingspeak.com/channels/1417/field/1/last.json")
    .get() (err, res, body) ->
      response = JSON.parse body
      if response
       msg.send "The last color is: " + response["field1"]
      else
       msg.send "Error"
Something went wrong with that request. Please try again.