This repository has been archived by the owner on Jun 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jon Evans
committed
Feb 22, 2012
1 parent
f4cba00
commit 079acf9
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
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
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 == '!!' |