Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #344 from nesQuick/events
Allow hubot to react on events
- Loading branch information
Showing
3 changed files
with
73 additions
and
4 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
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
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Description: | ||
# Event system related utilities | ||
# | ||
# Commands: | ||
# hubot fake event <event> - Triggers the <event> event for debugging reasons | ||
# | ||
# Events: | ||
# debug - {user: <user object to send message to>} | ||
|
||
util = require 'util' | ||
|
||
module.exports = (robot) -> | ||
|
||
robot.respond /FAKE EVENT (.*)/i, (msg) -> | ||
msg.send "fake event '#{msg.match[1]}' triggered" | ||
robot.emit msg.match[1], {user: msg.message.user} | ||
|
||
robot.on 'debug', (event) -> | ||
robot.send event.user, util.inspect event |