# Description:
#   Shows a link to phabricator tasks and issues mentioned in comments
#
# Dependencies:
#   None
#
# Configuration:
#   None
#
# Commands:
#   D#### - show a link to phabricator review
#   T#### - show a link to phabricator task
#
# Author:
#   tzjames

module.exports = (robot) ->
  robot.hear /\b((D|T)\d+)\b/i, (msg) ->
    if robot.fromSelf msg
        return
    robot.fancyMessage({
        msg: "http://phabricator.khanacademy.org/" + msg.match[1],
        room: msg.envelope.room,
        from: "Phabot Rabbit",
        message_format: "text"
    });


# Description:
#   Shows a link to phabricator tasks and issues mentioned in comments
#
# Dependencies:
#   None
#
# Configuration:
#   None
#
# Commands:
#   D#### - show a link to phabricator review
#   T#### - show a link to phabricator task
#
# Author:
#   tzjames

module.exports = (robot) ->
  # We check for whitespace rather than a word boundary beforehand to make sure 
  # we don't match links, as / is considered a word boundary.
  robot.hear /(^|\s)((D|T)\d+)\b/i, (msg) ->
    if robot.fromSelf msg
        return
    robot.fancyMessage({
        msg: "http://phabricator.khanacademy.org/" + msg.match[2],
        room: msg.envelope.room,
        from: "Phabot Rabbit",
        message_format: "text"
    });


Make sure links aren't caught by Phabot Rabbit
Make sure links aren't caught by Phabot Rabbit

Test Plan:
set /bin/secrets to only be in jamestest room
bin/culturecow
type
D1234
check out D1234
http://phabricator.khanacademy.org/D1234
aD1

Make sure the frist two are responded to, but the last two aren't

Reviewers: csilvers

Reviewed By: csilvers

Differential Revision: http://phabricator.khanacademy.org/D14305
