[github] new command to retrieve SSH keys
This commit is contained in:
parent
a3236cd67a
commit
d4b6283e23
@ -28,6 +28,11 @@ def info_user(username):
|
||||
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):
|
||||
rp = info_repos(repo)
|
||||
if rp["items"]:
|
||||
@ -129,6 +134,23 @@ def cmd_github_user(msg):
|
||||
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",
|
||||
help="Display repository's issues",
|
||||
help_usage={
|
||||
|
Loading…
Reference in New Issue
Block a user