[github] new command to retrieve SSH keys

This commit is contained in:
nemunaire 2015-11-29 11:40:55 +01:00
parent a3236cd67a
commit d4b6283e23

View File

@ -28,6 +28,11 @@ def info_user(username):
return user return user
def user_keys(username):
keys = web.getURLContent("https://github.com/%s.keys" % quote(username))
return keys.split('\n')
def info_issue(repo, issue=None): def info_issue(repo, issue=None):
rp = info_repos(repo) rp = info_repos(repo)
if rp["items"]: if rp["items"]:
@ -129,6 +134,23 @@ def cmd_github_user(msg):
return res return res
@hook.command("github_user_keys",
help="Display user SSH keys",
help_usage={
"USERNAME": "Show USERNAME's SSH keys",
})
def cmd_github_user_keys(msg):
if not len(msg.args):
raise IMException("indicate a user name to search")
res = Response(channel=msg.channel, nomore="No more keys")
for k in user_keys(" ".join(msg.args)):
res.append_message(k)
return res
@hook.command("github_issue", @hook.command("github_issue",
help="Display repository's issues", help="Display repository's issues",
help_usage={ help_usage={