hubot-eavesdrop
Version:
A hubot script to perform actions when user-specified keywords are mentioned.
60 lines (41 loc) • 1.78 kB
Markdown
hubot-eavesdrop [](https://travis-ci.org/catops/hubot-eavesdrop.svg?branch=master) [](https://www.npmjs.com/package/hubot-eavesdrop)
A hubot script to have your bot respond to specified keywords.
See [`src/eavesdrop.coffee`](src/eavesdrop.coffee) for full documentation.

# Installation
In hubot project repo, run:
`npm install hubot-eavesdrop --save`
Then add **hubot-eavesdrop** to your `external-scripts.json`:
```json
["hubot-eavesdrop"]
```
# Sample Interaction
```
> hubot when you hear slow clap respond with http://i.imgur.com/0mKXcg1.gif
> slow clap
> http://i.imgur.com/0mKXcg1.gif
> hubot stop listening for slow clap
> Okay, I will ignore slow clap.
```
Also supports regular expressions.
```
> hubot when you hear slow\s?clap(ping)? respond with http://i.imgur.com/0mKXcg1.gif
> slow clapping
> http://i.imgur.com/0mKXcg1.gif
> slowclap
> http://i.imgur.com/0mKXcg1.gif
```
Multiple responses can be specified for a single keyword.
```
> hubot when you hear slow clap respond with 1|congrats!; 2|http://i.imgur.com/0mKXcg1.gif
> slow clap
> congrats!
> http://i.imgur.com/0mKXcg1.gif
```
To reduce channel noise, keywords only trigger events once every thirty seconds.
The length of this delay can be changed by setting a `HUBOT_EAVESDROP_DELAY` environment variable.
----
# Open source licensing info
1. [TERMS](TERMS.md)
2. [LICENSE](LICENSE)
3. [CFPB Source Code Policy](https://github.com/cfpb/source-code-policy/)