Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
HuBot script for checking the latest average iOS and Mac App Store review times.
# 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) ->
.get() (error, response, body) ->
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