Created
February 4, 2015 23:39
-
-
Save nategrieb/d0bd735c34e1870b14d0 to your computer and use it in GitHub Desktop.
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: | |
# Do something when an alert is received on the timeline | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: | |
# victorops alert <alert_json> | |
TextMessage = require('hubot').TextMessage | |
module.exports = (robot) -> | |
robot.respond /VictorOps alert (.*)/i, (msg) -> | |
alert = JSON.parse msg.match[1] | |
for annotation in alert.ANNOTATIONS when annotation[0] == "HUBOT COMMAND" | |
command = alert[annotation[1]] | |
user = robot.brain.userForId "VictorOps" | |
console.log "Found hubot command in annotation: #{command}" | |
msg.send "Auto running command from annotation '#{command}'" | |
robot.receive new TextMessage user, "hubot #{command}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment