Created
May 8, 2015 10:43
-
-
Save 1syo/7ee665d336ba0882fdd0 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: | |
# airbrake | |
HUBOT_AIRBRAKE_KEY=process.env.HUBOT_AIRBRAKE_KEY | |
module.exports = (robot) -> | |
robot.router.post "/hubot/airbrake/:room", (req, res) -> | |
data = { project_id: req.body.error.project.id, notice_id: req.body.error.last_notice.id, group_id: req.body.error.id } | |
robot.brain.set('airbrake', data) | |
res.end "Done" | |
robot.respond /a(?:irbrake)? last( \| (general|backtrace|params|env|session|context))?/i, (msg) -> | |
msg.send msg.match[2] | |
# airbrake = robot.brain.get('airbrake') | |
# url = "https://airbrake.io/api/v3/projects/#{airbrake.project_id}/groups/#{airbrake.group_id}/notices/#{airbrake.notice_id}?key=#{HUBOT_AIRBRAKE_KEY}" | |
# msg.http(url).get() (err, res, body) -> | |
# unless err | |
# msg.send body | |
# else | |
# msg.send 'error!' | |
robot.respond /a(?:irbrake)? projects/i, (msg) -> | |
url = "https://airbrake.io/api/v3/projects?key=#{HUBOT_AIRBRAKE_KEY}" | |
msg.http(url).get() (err, res, body) -> | |
unless err | |
msg.send body | |
else | |
msg.send 'error!' | |
robot.respond /a(?:irbrake)? errors ([^\s]+)( \| (.+))?/i, (msg) -> | |
# url = "https://airbrake.io/api/v3/projects/#{airbrake.project_id}/groups/#{airbrake.group_id}?key=#{HUBOT_AIRBRAKE_KEY}" | |
msg.send msg.match[1], msg.match[3] | |
robot.respond /a(?:irbrake)? notice ([^\s]+)( \| (general|backtrace|params|env|session|context))?/i, (msg) -> | |
# url = "https://airbrake.io/api/v3/projects/#{airbrake.project_id}/groups/#{airbrake.group_id}?key=#{HUBOT_AIRBRAKE_KEY}" | |
msg.send msg.match[1], msg.match[3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment