1 | # hubot-eavesdrop [![Build Status](https://img.shields.io/travis/catops/hubot-eavesdrop.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/catops/hubot-eavesdrop.svg?branch=master) [![npm](https://img.shields.io/npm/v/hubot-eavesdrop.svg?maxAge=2592000&style=flat-square)](https://www.npmjs.com/package/hubot-eavesdrop)
|
2 |
|
3 | A hubot script to have your bot respond to specified keywords.
|
4 |
|
5 | See [`src/eavesdrop.coffee`](src/eavesdrop.coffee) for full documentation.
|
6 |
|
7 | ![hubot-eavesdrop screenshot](screenshot.png)
|
8 |
|
9 | ## Installation
|
10 |
|
11 | In hubot project repo, run:
|
12 |
|
13 | `npm install hubot-eavesdrop --save`
|
14 |
|
15 | Then add **hubot-eavesdrop** to your `external-scripts.json`:
|
16 |
|
17 | ```json
|
18 | ["hubot-eavesdrop"]
|
19 | ```
|
20 |
|
21 | ## Sample Interaction
|
22 |
|
23 | ```
|
24 | user1>> hubot when you hear slow clap respond with http://i.imgur.com/0mKXcg1.gif
|
25 | user1>> slow clap
|
26 | hubot>> http://i.imgur.com/0mKXcg1.gif
|
27 |
|
28 | user1>> hubot stop listening for slow clap
|
29 | hubot>> Okay, I will ignore slow clap.
|
30 | ```
|
31 |
|
32 | Also supports regular expressions.
|
33 |
|
34 | ```
|
35 | user1>> hubot when you hear slow\s?clap(ping)? respond with http://i.imgur.com/0mKXcg1.gif
|
36 | user1>> slow clapping
|
37 | hubot>> http://i.imgur.com/0mKXcg1.gif
|
38 | user1>> slowclap
|
39 | hubot>> http://i.imgur.com/0mKXcg1.gif
|
40 | ```
|
41 |
|
42 | Multiple responses can be specified for a single keyword.
|
43 |
|
44 | ```
|
45 | user1>> hubot when you hear slow clap respond with 1|congrats!; 2|http://i.imgur.com/0mKXcg1.gif
|
46 | user1>> slow clap
|
47 | hubot>> congrats!
|
48 | hubot>> http://i.imgur.com/0mKXcg1.gif
|
49 | ```
|
50 |
|
51 | To reduce channel noise, keywords only trigger events once every thirty seconds.
|
52 | The length of this delay can be changed by setting a `HUBOT_EAVESDROP_DELAY` environment variable.
|
53 |
|
54 | ----
|
55 |
|
56 | ## Open source licensing info
|
57 | 1. [TERMS](TERMS.md)
|
58 | 2. [LICENSE](LICENSE)
|
59 | 3. [CFPB Source Code Policy](https://github.com/cfpb/source-code-policy/)
|