hubot-regex-response
v1.0.0
Published
Respond messages by RegExp configs
Downloads
10
Maintainers
Readme
hubot-regex-response
Respond messages by RegExp configs.
Installation
npm install hubot-regex-response --save
Then add hubot-regex-response to your external-scripts.json
:
["hubot-regex-response"]
Sample Interaction
User> hey hey moqada is okada
Hubot> moqada is okama
User> i love potato
Hubot> User: potato
This interactions configured following configs.
[
{
"from": "(moqada is )okada",
"to": "<%= m[1] %> okama",
},
{
"from": "(potato)",
"to": "<%= m[1] %>",
"method": "reply"
}
]
to Environment variables.
export HUBOT_REGEX_RESPONSE_CONFIGS='[{"from":"(moqada is )okada","to":"<%= m[1] %> okama"},{"from":"(potato)","to":"<%= m[1] %>","method":"reply"}]'
Commands
<config_from_text> - Reply or Send config_to_text
Configurations
HUBOT_REGEX_RESPONSE_CONFIGS - Set JSON string for config response
This JSON string is Array of following Object.
from
: Target messages (using RegExp string)to
: Template of Responding message (using lodash.template)method
:send
orreply
(optional, default:send
)
See Sample configs at section of Sample Interaction