From 78f22236fd7719bfb0b9de179c626f19bafb0010 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 3 Nov 2015 01:11:23 -0800 Subject: [PATCH] Up version and cleanup docs/code --- README.md | 4 ++-- package.json | 8 +++++--- src/alias.coffee | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 00524c8..42031c9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index 6a7956c..db67fbe 100644 --- a/package.json +++ b/package.json @@ -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 ", "license": "MIT", "keywords": [ @@ -11,7 +11,9 @@ "alias", "groups", "mentions", - "emoji" + "emoji", + "slack", + "hipchat" ], "repository": { "type": "git", diff --git a/src/alias.coffee b/src/alias.coffee index 333775e..f877159 100644 --- a/src/alias.coffee +++ b/src/alias.coffee @@ -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[^.]|$))' @@ -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) \ No newline at end of file