I have a Slack Bolt Java SDK bot (based on Spring Boot) and am using the app.message()
function. It is documented in the events API here - https://slack.dev/java-slack-sdk/guides/events-api.
The function seems to take in a regex and a handler, so you can basically say "if a user says a message with the word hello, do XYZ".
I have this working fine.
When I try to have more than one message handler though, even with different regex, they seem to stomp on each other. Stepping into the slack code, it seems like the handlers are held in a map of handler-type-string (e.g. "message") to handler.
So, the SDK really looks like it's designed to let you have a bunch of app.message("regex", handler) events, but it doesn't seem to work in practice and I can't find that limitation in their documentation.
Am I missing something / doing something wrong? Or do I literally need a single ".*" regex if I need a bot to watch all messages in its channels? It seems very unlikely any significant bot would only care to watch one single regex across all of its channels, so this seems like an odd limitation.