Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds support for <@userId|username> syntax for mentions and direct_mentions #189

Merged
merged 2 commits into from
May 23, 2016

Conversation

colestrode
Copy link
Contributor

For Slack, the RegExp for mentions and direct_mentions does not match if the message uses the valid <@userid|username> syntax. This PR updates the regex so that botkit will emit mention and direct_mention events if the username is included.

Note: usernames can only be in the set [a-z0-9] so there won't be any special characters that could cause problems constructing a regex including usernames. See https://get.slack.help/hc/en-us/articles/216360827-Changing-your-username

@crunchywelch
Copy link

related, other option for a way to do this in #210

fine with either way, just want to be able to get events on nickname mentions as well

@@ -416,6 +416,9 @@ function Slackbot(configuration) {

slack_botkit.log('** Setting up custom handlers for processing Slack messages');
slack_botkit.on('message_received', function(bot, message) {
var mentionSyntax = '<@' + bot.identity.id + '(\\|' + bot.identity.name + ')?>';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like usernames can contain ".", we'll need to escape those

@benbrown benbrown merged commit c71ff24 into howdyai:master May 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants