Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (39 sloc) 1.39 KB
# Description:
# Github Credentials allows you to map your user against your GitHub user.
# This is specifically in order to work with apps that have GitHub Oauth users.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot who do you know - List all the users with github logins tracked by Hubot
# hubot i am `maddox` - map your user to the github login `maddox`
# hubot who am i - reveal your mapped github login
# hubot forget me - de-map your user to your github login
#
# Author:
# maddox
module.exports = (robot) ->
robot.respond /who do you know/i, (msg) ->
theReply = "Here is who I know:\n"
for own key, user of robot.brain.data.users
if(user.githubLogin)
theReply += user.name + " is " + user.githubLogin + "\n"
msg.send theReply
robot.respond /i am ([a-z0-9-]+)/i, (msg) ->
githubLogin = msg.match[1]
msg.message.user.githubLogin = githubLogin
msg.send "Ok, you are " + githubLogin + " on GitHub"
robot.respond /who am i/i, (msg) ->
user = msg.message.user
if user.githubLogin
msg.reply "You are known as " + user.githubLogin + " on GitHub"
else
msg.reply "I don't know who you are. You should probably identify yourself with your GitHub login"
robot.respond /forget me/i, (msg) ->
user = msg.message.user
user.githubLogin = null
msg.reply("Ok, I have no idea who you are anymore.")