bolt-js icon indicating copy to clipboard operation
bolt-js copied to clipboard

Accept an array of patterns for message matching

Open BenAlderfer opened this issue 6 years ago • 3 comments

Description

In the docs, there seems to only be support for a single pattern to match and then do an action:

app.message(':wave:', async ({ message, say}) => {
  say(`Hello, <@${message.user}>`);
});

I'd like to be able to supply multiple patterns to match different ways of saying the same command without having to duplicate that block of code. See other chatbots like Alexa where you supply many invocations for a single command.

What type of issue is this? (place an x in one of the [ ])

  • [ ] bug
  • [x] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

BenAlderfer avatar Oct 07 '19 14:10 BenAlderfer

Seconding this - especially when trying to make bots more conversational, passing multiple messages to trigger on would be wonderful.

beacrea avatar May 14 '20 00:05 beacrea

#761 was not a solution for this

seratch avatar Mar 24 '21 05:03 seratch

As the list of the middleware is also an array, supporting an array of string | regexp is not so simple.

seratch avatar Mar 24 '21 05:03 seratch