     return groupMap
   else
     return buildGroupObject()
+
+getGroupsList = ->
+  if useDynamicGroups
+    groups = []
+    users = robot.brain.data.users
+    for own id, user of users
+      roles = robot.auth.userRoles(user)
+      groups = groups.concat(roles)
+    return _.uniq(groups)
+  else
+    return Object.keys(buildGroupObject())
 
 userFromName = (name) ->
   allUsers = robot.brain.data.users

    message = message.replace(reg, members)
  return message

buildRegExp = ->
  if useDynamicGroups
    aliases = '\\w+'
  else
    # Compile RegEx to match only the aliases
    # Note this matches (alias) :alias: and @alias
    aliases = _.keys(buildGroupObject()).join('|')
  # The last group is a set of stop conditions (word boundaries or end of line)
  atRE = '(?:@(' + aliases + ')(?:\\b[^.]|$))'
  emojiRE = '(?:[(:])(' + aliases + ')(?:[:)])'

  return new RegExp(atRE + '|' + emojiRE, 'i')

module.exports = (robot) ->

  groupCache = _.object(staticGroups)
  return groupCache

# Return Groups Mentioned in a message if there is a dynamic group.
getGroups = (text) ->
  if useDynamicGroups
    groupMap = {}
