bolt-js
bolt-js copied to clipboard
Introduce "mention()" middleware for catching all mentions in messages
Description
directMention()
middleware matches only when a bot user is mentioned as the first person in a message. This is because the middleware was designed to be compatible with Hubot's robot.respond() functionality.
Also, Slapp (the ancestor of Bolt for JS) defines "direct mention" as being mentioned at the start of a message while "mention" means being mentioned anywhere in a message.
With full respect for the original meaning of "direct mention" in Slapp, I propose to add built-in mention()
middleware to Bolt for JS. I'll be working on this sometime soon, but if anyone is interested in implementing this, any contribution is welcome!
What type of issue is this? (place an x
in one of the [ ]
)
- [ ] bug
- [x] enhancement (feature request)
- [ ] question
- [ ] documentation related
- [ ] testing related
- [x] 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.
@seratch I don't see how to use directMention()
in the documentation, do you have an example somewhere?
@captDaylight You can use it this way:
const { App, directMention } = require("@slack/bolt");
const app = new App();
app.message(directMention(), "hello", async ({}) => {
});