Skip to content

Commit

Permalink
Merge pull request #327 from futuraprime/roles-grammar-fix
Browse files Browse the repository at this point in the history
Roles will correctly semicolon-delimit the list of roles if one (or more) roles contain a comma.
  • Loading branch information
tombell committed Jul 31, 2012
2 parents 35fb4d2 + 702b518 commit c47b8af
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/scripts/roles.coffee
Expand Up @@ -16,6 +16,7 @@ module.exports = (robot) ->
"Be more specific, I know #{users.length} people named like that: #{(user.name for user in users).join(", ")}"

robot.respond /who is @?([\w .-]+)\?*$/i, (msg) ->
joiner = ', '
name = msg.match[1].trim()

if name is "you"
Expand All @@ -28,7 +29,9 @@ module.exports = (robot) ->
user = users[0]
user.roles = user.roles or [ ]
if user.roles.length > 0
msg.send "#{name} is #{user.roles.join(", ")}."
if user.roles.join('').search(',') > -1
joiner = '; '
msg.send "#{name} is #{user.roles.join(joiner)}."
else
msg.send "#{name} is nothing to me."
else if users.length > 1
Expand Down

0 comments on commit c47b8af

Please sign in to comment.