Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

allow for matching on any nickname mention #210

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/SlackBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ function Slackbot(configuration) {

var direct_mention = new RegExp('^\<\@' + bot.identity.id + '\>', 'i');
var mention = new RegExp('\<\@' + bot.identity.id + '\>', 'i');
var broad_mention = new RegExp(bot.identity.name, 'i');

if (message.text.match(direct_mention)) {
// this is a direct mention
Expand All @@ -496,6 +497,10 @@ function Slackbot(configuration) {
message.event = 'mention';
slack_botkit.trigger('mention', [bot, message]);
return false;
} else if (message.text.match(broad_mention)) {
message.event = 'broad_mention';
slack_botkit.trigger('broad_mention', [bot, message]);
return false;
} else {
message.event = 'ambient';
slack_botkit.trigger('ambient', [bot, message]);
Expand Down