question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use a respond as a fallback

See original GitHub issue

Hey 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:closed
  • Created 9 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
technicalpicklescommented, Apr 25, 2014

One workaround is:

  • use msg.finish() in script to mark a message so it doesn’t get processed by any other listeners
  • make sure the ‘catch all’ respond is the last script defined (ie rename it to be like ZZZ_somescript.coffee

With 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.

0reactions
stale[bot]commented, Aug 24, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found