Skip to content

Instantly share code, notes, and snippets.

@aaronstaves
Created May 19, 2015 17:16
Show Gist options
  • Select an option

  • Save aaronstaves/a814836c469e65560cab to your computer and use it in GitHub Desktop.

Select an option

Save aaronstaves/a814836c469e65560cab to your computer and use it in GitHub Desktop.
# Description:
# Utility commands surrounding Hubot uptime.
#
# Commands:
# hubot ping - Reply with pong
# hubot echo <text> - Reply back with <text>
# hubot time - Reply with current time
# hubot die - End hubot process
module.exports = (robot) ->
robot.respond /PING$/i, (msg) ->
msg.send "PONG"
robot.respond /ADAPTER$/i, (msg) ->
msg.send robot.adapterName
robot.respond /ECHO (.*)$/i, (msg) ->
msg.send msg.match[1]
robot.respond /TIME$/i, (msg) ->
msg.send "Server time is: #{new Date()}"
robot.respond /DIE$/i, (msg) ->
if robot.auth.hasRole(msg.envelope.user, "killer")
msg.send "Goodbye, cruel world."
process.exit 0
else
msg.send "Nope"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment