From 178896a5720ad2877d47de4a199fe9ed7dd11d8a Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Thu, 18 Dec 2014 12:49:03 -0800 Subject: [PATCH] Add some comments on how to use the new listeners --- src/listener.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/listener.coffee b/src/listener.coffee index cf7e44ff..b8551aac 100644 --- a/src/listener.coffee +++ b/src/listener.coffee @@ -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 @@ -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