Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
Add bang-bang script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Evans committed Feb 22, 2012
1 parent f4cba00 commit 079acf9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/scripts/bang-bang.coffee
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,18 @@
# !! - Repeat the last command directed at hubot
module.exports = (robot) ->
robot.respond /(.+)/i, (msg) ->
store msg

robot.respond /!!/i, (msg) ->

if exports.last_command?
msg.send exports.last_command
msg['message']['text'] = "hubot: #{exports.last_command}"
robot.receive(msg['message'])
msg['message']['done'] = true
else
msg.send "i don't remember hearing anything."

store = (msg) ->
command = msg.match[1].trim()
exports.last_command = command unless command == '!!'

0 comments on commit 079acf9

Please sign in to comment.