Created
January 9, 2014 00:05
-
-
Save calebd/8327122 to your computer and use it in GitHub Desktop.
HuBot script for checking the latest average iOS and Mac App Store review times.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: | |
# Fetch iOS and Mac App Store average review times. | |
# | |
# Commands: | |
# bot review times | |
# bot review time | |
module.exports = (robot) -> | |
robot.respond /review times?/i, (msg) -> | |
msg.http("http://reviewtimes.shinydevelopment.com/sb_trend30.json") | |
.get() (error, response, body) -> | |
try | |
sequences = JSON.parse(body).graph.datasequences | |
ios = 0 | |
osx = 0 | |
sequences.forEach (sequence) -> | |
title = sequence.title | |
points = sequence.datapoints | |
value = points[points.length - 1].value | |
value = Math.round(value) | |
if title.match /ios/i | |
ios = value | |
else if title.match /mac/i | |
osx = value | |
msg.send "iOS: #{ios} days\nOS X: #{osx} days" | |
catch error | |
msg.send "Unable to get review times." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment