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