2626 UserGitHubTokens ,
2727 UserLogin ,
2828)
29+ from ghutils .utils import l10n
2930from ghutils .utils .discord .embeds import set_embed_author
3031from ghutils .utils .discord .references import (
3132 CommitReference ,
@@ -53,48 +54,54 @@ class GitHubCog(GHUtilsCog, GroupCog, group_name="gh"):
5354
5455 # /gh
5556
56- @app_commands .command ()
57+ @app_commands .command (
58+ description = l10n .command_description ("gh issue" ),
59+ )
5760 @app_commands .rename (reference = "issue" )
61+ @l10n .describe (gh_issue = ["reference" ])
62+ @l10n .describe_common ("visibility" )
5863 async def issue (
5964 self ,
6065 interaction : Interaction ,
6166 reference : IssueReference ,
6267 visibility : MessageVisibility = "private" ,
6368 ):
64- """Get a link to a GitHub issue."""
65-
6669 await respond_with_visibility (
6770 interaction ,
6871 visibility ,
6972 embed = _create_issue_embed (* reference ),
7073 )
7174
72- @app_commands .command ()
75+ @app_commands .command (
76+ description = l10n .command_description ("gh pr" ),
77+ )
7378 @app_commands .rename (reference = "pr" )
79+ @l10n .describe (gh_pr = ["reference" ])
80+ @l10n .describe_common ("visibility" )
7481 async def pr (
7582 self ,
7683 interaction : Interaction ,
7784 reference : PRReference ,
7885 visibility : MessageVisibility = "private" ,
7986 ):
80- """Get a link to a GitHub pull request."""
81-
8287 await respond_with_visibility (
8388 interaction ,
8489 visibility ,
8590 embed = _create_issue_embed (* reference ),
8691 )
8792
88- @app_commands .command ()
93+ @app_commands .command (
94+ description = l10n .command_description ("gh commit" ),
95+ )
8996 @app_commands .rename (reference = "commit" )
97+ @l10n .describe (gh_commit = ["reference" ])
98+ @l10n .describe_common ("visibility" )
9099 async def commit (
91100 self ,
92101 interaction : Interaction ,
93102 reference : CommitReference ,
94103 visibility : MessageVisibility = "private" ,
95104 ):
96- """Get a link to a GitHub commit."""
97-
98105 repo , commit = reference
99106
100107 async with self .bot .github_app (interaction ) as (github , _ ):
@@ -128,15 +135,17 @@ async def commit(
128135
129136 await respond_with_visibility (interaction , visibility , embed = embed )
130137
131- @app_commands .command ()
138+ @app_commands .command (
139+ description = l10n .command_description ("gh repo" ),
140+ )
141+ @l10n .describe (gh_repo = ["repo" ])
142+ @l10n .describe_common ("visibility" )
132143 async def repo (
133144 self ,
134145 interaction : Interaction ,
135146 repo : FullRepositoryOption ,
136147 visibility : MessageVisibility = "private" ,
137148 ):
138- """Get a link to a GitHub repository."""
139-
140149 async with self .bot .github_app (interaction ) as (github , _ ):
141150 result = await github .async_graphql (
142151 """
@@ -164,10 +173,10 @@ async def repo(
164173
165174 await respond_with_visibility (interaction , visibility , embed = embed )
166175
167- @app_commands .command ()
176+ @app_commands .command (
177+ description = l10n .command_description ("gh login" ),
178+ )
168179 async def login (self , interaction : Interaction ):
169- """Authorize GitHub Utils to make requests on behalf of your GitHub account."""
170-
171180 user_id = interaction .user .id
172181 login_id = str (uuid .uuid4 ())
173182
@@ -188,10 +197,10 @@ async def login(self, interaction: Interaction):
188197 ephemeral = True ,
189198 )
190199
191- @app_commands .command ()
200+ @app_commands .command (
201+ description = l10n .command_description ("gh logout" ),
202+ )
192203 async def logout (self , interaction : Interaction ):
193- """Remove your GitHub account from GitHub Utils."""
194-
195204 with self .bot .db_session () as session :
196205 # TODO: this should delete the authorization too, but idk how
197206 # https://docs.github.com/en/rest/apps/oauth-applications?apiVersion=2022-11-28#delete-an-app-authorization
@@ -209,14 +218,15 @@ async def logout(self, interaction: Interaction):
209218 ephemeral = True ,
210219 )
211220
212- @app_commands .command ()
221+ @app_commands .command (
222+ description = l10n .command_description ("gh status" ),
223+ )
224+ @l10n .describe_common ("visibility" )
213225 async def status (
214226 self ,
215227 interaction : Interaction ,
216228 visibility : MessageVisibility = "private" ,
217229 ):
218- """Show information about GitHub Utils."""
219-
220230 if info := self .env .deployment :
221231 color = Color .green ()
222232 commit_url = f"https://github.com/object-Object/discord-github-utils/commit/{ info .commit_sha } "
@@ -268,10 +278,12 @@ async def status(
268278
269279 await respond_with_visibility (interaction , visibility , embed = embed )
270280
271- class Search (SubGroup ):
272- """Search for things on GitHub."""
273-
274- @app_commands .command ()
281+ class Search (SubGroup , description = l10n .command_description ("gh search" )):
282+ @app_commands .command (
283+ description = l10n .command_description ("gh search files" ),
284+ )
285+ @l10n .describe (gh_search_files = ["repo" , "query" , "ref" , "exact" , "limit" ])
286+ @l10n .describe_common ("visibility" )
275287 async def files (
276288 self ,
277289 interaction : Interaction ,
@@ -282,15 +294,6 @@ async def files(
282294 limit : Range [int , 1 , 25 ] = 5 ,
283295 visibility : MessageVisibility = "private" ,
284296 ):
285- """Search for files in a repository by name.
286-
287- Args:
288- ref: Branch name, tag name, or commit to search in. Defaults to the
289- default branch of the repo.
290- exact: If true, use exact search; otherwise use fuzzy search.
291- limit: Maximum number of results to show.
292- """
293-
294297 async with self .bot .github_app (interaction ) as (github , state ):
295298 if state != LoginState .LOGGED_IN :
296299 raise NotLoggedInError ()
0 commit comments