File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -100,12 +100,18 @@ async def github(self, evt: MessageEvent) -> None:
100100 pass
101101
102102 @github .subcommand ("login" , help = "Log into GitHub." )
103+ @command .argument ("flags" , required = False , pass_raw = True )
103104 @authenticated (required = False )
104- async def login (self , evt : MessageEvent , client : Optional [GitHubClient ]) -> None :
105+ async def login (self , evt : MessageEvent , flags : str , client : Optional [GitHubClient ]) -> None :
105106 redirect_url = (self .bot .webapp_url / "auth" ).with_query ({"user_id" : evt .sender })
107+ flags = flags .lower ()
108+ scopes = ["user:user" , "public_repo" , "admin:repo_hook" ]
109+ if "--no-hook" in flags :
110+ scopes .remove ("admin:repo_hook" )
111+ if "--private" in flags :
112+ scopes .append ("repo" )
106113 login_url = str (self .bot .clients .get (evt .sender , create = True ).get_login_url (
107- redirect_uri = redirect_url ,
108- scope = "user:user public_repo repo admin:repo_hook" ))
114+ redirect_uri = redirect_url , scope = " " .join (scopes )))
109115 if client :
110116 username = await client .query ("viewer { login }" , path = "viewer.login" )
111117 await evt .reply (f"You're already logged in as @{ username } , but you can "
You can’t perform that action at this time.
0 commit comments