Skip to content

Commit

Permalink
Roles will correctly semicolon-delimit the list of roles if one conta…
Browse files Browse the repository at this point in the history
…ins a comma.
  • Loading branch information
futuraprime committed Jul 30, 2012
1 parent 35fb4d2 commit 702b518
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(", ")}" "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) -> robot.respond /who is @?([\w .-]+)\?*$/i, (msg) ->
joiner = ', '
name = msg.match[1].trim() name = msg.match[1].trim()


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

0 comments on commit 702b518

Please sign in to comment.