I would like to add a new role for a user, when he is able to give the right password to Hubot.
Here is the script i have for now :
module.exports = (robot) ->
robot.respond /PasswOrd (.*)/, (res) ->
paSS = res.match[1]
if paSS is "1234"
role = 'h1'
user = robot.brain.userForName(res.message.user.name)
#CODE TO ADD ROLE h1 FOR THIS USER ???
res.reply "Correct." + user.id
else
res.reply "Incorrect password."
It's launching correctly with @bot PasswOrd 1234
But i don't know how to add the role.
Thanks.