slackapi / bolt-js

A framework to build Slack apps using JavaScript
https://slack.dev/bolt-js
MIT License
2.73k stars 391 forks source link

Accept an array of patterns for message matching #281

Open BenAlderfer opened 4 years ago

BenAlderfer commented 4 years ago

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 [ ])

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

beacrea commented 4 years ago

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

seratch commented 3 years ago

761 was not a solution for this

seratch commented 3 years ago

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