Skip to content

Commit

Permalink
Add some comments on how to use the new listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyball committed Dec 18, 2014
1 parent 47b4c0b commit 178896a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/listener.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ class SlackRawListener extends Listener
# matcher - A Function that determines if this listener should trigger the
# callback. The matcher takes a SlackRawMessage.
# callback - A Function that is triggered if the incoming message matches.
#
# To use this listener in your own script, you can say
#
# robot.listeners.push new SlackRawListener(robot, matcher, callback)
constructor: (@robot, @matcher, @callback) ->

# Public: Invokes super only for instances of SlackRawMessage
Expand All @@ -27,6 +31,10 @@ class SlackBotListener extends Listener
# regex - A Regex that determines if this listener should trigger the
# callback.
# callback - A Function that is triggered if the incoming message matches.
#
# To use this listener in your own script, you can say
#
# robot.listeners.push new SlackBotListener(robot, regex, callback)
constructor: (@robot, @regex, @callback) ->
@matcher = (message) =>
if message instanceof SlackBotMessage
Expand Down

0 comments on commit 178896a

Please sign in to comment.