0

I'm using a cleverbot script to have my bot respond to any type of messages. The script works but currently requires a user to call for the bot via "hey"

For example

"@bot hey what is going on?"
bot: Not too much.

Code:

robot.respond(/hey (.*)/i, function(msg) {
//code for reply
}

What I want to do is have it so I can just ask the question directly to my bot without requiring the "hey" part. I originally got rid of the "hey" tag but it interferes with my other scripts that are set to respond to certain text. In other words, I get two responses from my bot.

Any ideas on how to tell my cleverbot script to only respond if all the other scripts have been confirmed first? Thank you!

kkomaz
  • 261
  • 2
  • 10

1 Answers1

0

Use @robot.catchAll. A CatchAll listener will execute iff no other regex matched the message, but know that means it won't execute if you have any scripts that match all messages (e.g. robot.hear /.*/).

Some documentation (part of a separate PR waiting to be merged, so ignore catchAllAddressed) -- https://github.com/michaelansel/hubot/blob/issues/683/docs/scripting.md#catch-all