Skip to content
This repository has been archived by the owner on Nov 14, 2019. It is now read-only.

Allow audience to include multiple mentions, including individual user mentions #158

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions lib/bot/setAudience.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var models = require('../../models');
var _ = require('underscore');

function setUserGroup(bot, message) {
log.verbose('Heard a request to set an audience');
log.verbose(`Heard a request to set an audience to ${message.match[2]}`);

// Currently, bots cannot access the usergroups api endpoint, so we can't check
// See https://api.slack.com/bot-users

Expand Down Expand Up @@ -36,7 +37,7 @@ function setUserGroup(bot, message) {
}
}
).then(function (){
bot.reply(message, ':thumbsup: Set audience to `'+message.match[2]+'`. If you\'re using a '+
bot.reply(message, ':thumbsup: Set audience to `' + message.match[2] + '`. If you\'re using a '+
'user group, make sure that it exists');
});
} else {
Expand All @@ -47,7 +48,7 @@ function setUserGroup(bot, message) {
}

function attachListener(controller) {
controller.hears(['(usergroup|audience) (<!(subteam|here|channel).*?>)'],['direct_mention'], setUserGroup);
controller.hears(['(usergroup|audience)\\s+((?:[^>]+>[\\s;,]*)+)'],['direct_mention'], setUserGroup);
log.verbose('Attached');
}

Expand Down