Use a respond as a fallback
See original GitHub issueHey guys,
We have a service that we can chat with the bot (AI) and we don’t want hubot calling it when other plugins already did something.
That’s the plugin:
module.exports = (robot) ->
robot.respond /(.+)/i, (msg) ->
msg
.http("http://www.ed.conpet.gov.br/mod_perl/bot_gateway.cgi")
.query(server: "0.0.0.0:8085", charset_post: "utf-8", pure: 1, msg: msg.match[1])
.get() (err, res, body) ->
msg.reply body.replace(/<[^<>]*>/g, "")
If I have another plugin like this one:
module.exports = (robot) ->
uis = [
"http://2.bp.blogspot.com/--Tt_oRekUSE/T62ZFQF_kdI/AAAAAAAAOvk/0BmpdLRxe0U/s1600/meme+UI+colorido.png",
"http://youpix.com.br/wp-content/uploads/2012/01/ui.jpg"]
robot.hear /\bui\b/i, (msg) ->
msg.send msg.random uis
And send a message like hubot ui
it will call both.
That’s possible? I mean, a fallback respond that got called only when no other respond matched?
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Fallback - ChatBot
The fallback interaction is triggered when your chatbot doesn't recognize the user's message. You can use it to ask the user to reword...
Read more >A best practice guide to fallback responses - EBM
A best practice guide to fallback responses · Acknowledge the failure · Guide the user in the right direction · Be friendly ·...
Read more >Managing fallback responses - Chrome Developers
A fallback is a generic, one-size-fits-all response that's a better placeholder than what the browser would provide by default when a request ...
Read more >Use the New Fallback Intent to Respond ... - Amazon Developer
FallbackIntent lets you respond gracefully to an out-of-domain request to your Alexa skill. You can provide a specific handler for this intent in...
Read more >Fallback and Human Handoff - Rasa
The default ultimate fallback action is to call action_default_fallback . This action causes the bot to utter the utter_default response and to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
One workaround is:
msg.finish()
in script to mark a message so it doesn’t get processed by any other listenersWith that,
hubot ui
would indicate the message is done processing, so the other listener doesn’t fire.I’d definitely be open to something specifically to handle respond blocks that aren’t answered. It’d be a great thing to hook into help.coffee, as people often say commands at hubot and it’s frustrating when you don’t know if you messed it up, or it’s just working, or it was just silent. Not sure on best name, but
respondFallback
is a decent start.This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.