botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
68 stars 83 forks source link

Array support fo bp.hear #58

Closed enriquebrgn closed 6 years ago

enriquebrgn commented 7 years ago

Hey there!

Is there any way to add array support for the bp.hear() method? I want to match some item inside the array to avoid creating multiple functions with the same content for matching different messages.

Thanks a lot, botpress is awesome!

lesyk commented 6 years ago

Does this help?

const utterances = {
    hello: /GET_STARTED|hello|hi|hey|holla|hej|god dag|halløj/i
}

bp.hear(utterances.hello, (event, next) => {
    event.reply("#welcome");
  });
ofelt commented 6 years ago

Oh didn't saw this issue before I fixed it, I had the same need so I did a pull request, the feature is available in botpress 1.1.2. Check the docs to see how ^^ If it suits your need I think this issue can be closed :)

slvnperron commented 6 years ago

Closing as Olivier fixed this :)

enriquebrgn commented 6 years ago

Thanks!