Created
September 12, 2012 21:02
-
-
Save jpadilla/3709906 to your computer and use it in GitHub Desktop.
Hubot Github Status command
This file contains hidden or 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 | |
# A command to check the status of the web and git operations for github.com | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: | |
# hubot github status - Returns status of Git, Pages, and Downloads | |
# | |
# Notes: | |
# | |
# | |
# Author: | |
# jpadilla | |
module.exports = (robot) -> | |
robot.respond /(github)( status)?/i, (msg) -> | |
msg.http('https://status.github.com/realtime.json') | |
.get() (err, res, body) -> | |
data = JSON.parse(body) | |
if data.git and data.pages and data.downloads | |
msg.send 'Battle station fully operational' | |
else | |
if data.git | |
git = 'up' | |
else | |
git = 'down' | |
if data.pages | |
pages = 'up' | |
else | |
pages = 'down' | |
if data.downloads | |
downloads = 'up' | |
else | |
downloads = 'down' | |
msg.send "Git is #{git}.\n" + | |
"Pages is #{pages}.\n" + | |
"Downloads is #{downloads}.\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment