Permalink
Browse files

Merge pull request #327 from futuraprime/roles-grammar-fix

Roles will correctly semicolon-delimit the list of roles if one (or more) roles contain a comma.
  • Loading branch information...
2 parents 892072b + 96de575 commit 8241c61f8a85010a3c838cc32ca7472a31ef3b94 @tombell tombell committed Jul 31, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/scripts/roles.coffee
@@ -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"
@@ -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

0 comments on commit 8241c61

Please sign in to comment.