raiseIRCException("indicate a repository name to search")
repos=info_repos("".join(msg.cmds[1:]))
res=Response(msg.sender,channel=msg.channel,nomore="No more repository",count=" (%d more repo)")
forrepoinrepos["items"]:
homepage=""
ifrepo["homepage"]isnotNone:
homepage=repo["homepage"]+" - "
res.append_message("Repository %s: %s%s Main language: %s; %d forks; %d stars; %d watchers; %d opened_issues; view it at %s"%(repo["full_name"],homepage,repo["description"],repo["language"],repo["forks"],repo["stargazers_count"],repo["watchers_count"],repo["open_issues_count"],repo["html_url"]))
returnres
@hook("cmd_hook","github_user")
defcmd_github(msg):
iflen(msg.cmds)<2:
raiseIRCException("indicate a user name to search")
res=Response(msg.sender,channel=msg.channel,nomore="No more user")
user=info_user("".join(msg.cmds[1:]))
if"login"inuser:
ifuser["repos"]:
kf=" Known for: "+", ".join([repo["name"]forrepoinuser["repos"]])
else:
kf=""
if"name"inuser:
name=user["name"]
else:
name=user["login"]
res.append_message("User %s: %d public repositories; %d public gists; %d followers; %d following; view it at %s.%s"%(name,user["public_repos"],user["public_gists"],user["followers"],user["following"],user["html_url"],kf))
else:
raiseIRCException("User not found")
returnres
@hook("cmd_hook","github_issue")
defcmd_github(msg):
iflen(msg.cmds)<2:
raiseIRCException("indicate a user name to search")
res=Response(msg.sender,channel=msg.channel,nomore="No more issue",count=count)
issues=info_issue(repo,issue)
forissueinissues:
res.append_message("%s%s issue #%d: \x03\x02%s\x03\x02 opened by %s on %s: %s"%(issue["state"][0].upper(),issue["state"][1:],issue["number"],issue["title"],issue["user"]["login"],issue["created_at"],issue["body"].replace("\n","")))