Skip to content

Commit

Permalink
Up version and cleanup docs/code
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead committed Nov 3, 2015
1 parent 25be729 commit 78f2223
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Hubot Group Alias

Group Alias is a simple [Hubot][hubot] plugin which allows you to define new **"@mentions"** which are automatically expanded by your bot. For example, you could define `@dev`, `@design` to send a message to all members of your teams.
Group Alias is a simple [Hubot][hubot] package which allows you to define new **"@mentions"** which are automatically expanded. For example, you could define `@dev`, `@design` to send a message to all members of your teams. Using `hubot-auth`, you can also dynamically define groups!

## Configuration
## Setup
1. All this package to your `package.json`. Do this by running this command:

```sh
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hubot-group-alias",
"description": "Hubot page for user @mention aliases",
"version": "2.0.0",
"description": "Easy @mention groups aliases for your chatroom",
"version": "2.1.0",
"author": "Michael Ball <[email protected]>",
"license": "MIT",
"keywords": [
Expand All @@ -11,7 +11,9 @@
"alias",
"groups",
"mentions",
"emoji"
"emoji",
"slack",
"hipchat"
],
"repository": {
"type": "git",
Expand Down
9 changes: 5 additions & 4 deletions src/alias.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ expand = (message, groups, user) ->
buildRegExp = ->
if useDynamicGroups
aliases = '\\w+'
else # Compile RegEx to match only defined aliases
else # match only defined aliases
aliases = _.keys(buildGroupObject()).join('|')
# The last group is a set of stop conditions (word boundaries or end of line)
atRE = '(?:@(' + aliases + ')(?:\\b[^.]|$))'
Expand All @@ -116,11 +116,12 @@ module.exports = (robot) ->
robot.logger.warning "Using dynamic groups requires hubot-auth to be loaded"
return

robot.respond /list groups? alias(es)?/i, (resp) ->
resp.send "The currently setup groups are: #{listToMentions(getGroupsList())}"
robot.respond /list groups?( alias(es)?)?/i, (resp) ->
groups = listToMentions(getGroupsList())
resp.send "The currently setup groups are: #{groups}"

regex = buildRegExp()
robot.hear regex, (resp) ->
groups = getGroups(resp.message.text)
if !_.isEqual(groups, {})
if !_.isEqual(groups, {}) # don't send message if no groups found.
resp.send expand(resp.message.text, groups, resp.message.user)

0 comments on commit 78f2223

Please sign in to comment.