Skip to content

Commit 9e22170

Browse files
committed
refactor: remove dollar sign from usage instructions in various commands for consistency
chore: remove error handling blocks from dev.py to simplify code and rely on global error handling refactor: remove dollar sign from usage instructions in command decorators for clarity and consistency across all command usage instructions feat(error.py): add prefix to command usage in error messages for better clarity refactor(error.py): change error messages to be more descriptive and accurate feat(error.py): use embeds for error messages for better readability refactor(error.py): comment out specific error handlers to allow global handler to catch all errors for consistency refactor(help.py): remove static prefix and add dynamic prefix fetching to improve flexibility feat(help.py): add command aliases to help command categories for better command visibility refactor(help.py): change several methods to async to support dynamic prefix fetching feat(embeds.py): add create_error_embed method to standardize error embed creation
1 parent 7384af8 commit 9e22170

File tree

27 files changed

+133
-141
lines changed

27 files changed

+133
-141
lines changed

.archive/notes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, bot: commands.Bot) -> None:
1414
@commands.hybrid_group(
1515
name="notes",
1616
aliases=["n"],
17-
usage="$notes <subcommand>",
17+
usage="notes <subcommand>",
1818
)
1919
@commands.guild_only()
2020
async def notes(self, ctx: commands.Context[commands.Bot]) -> None:
@@ -32,7 +32,7 @@ async def notes(self, ctx: commands.Context[commands.Bot]) -> None:
3232
@notes.command(
3333
name="create",
3434
aliases=["c", "add", "a"],
35-
usage="$notes create [target] [content]",
35+
usage="notes create [target] [content]",
3636
)
3737
@commands.guild_only()
3838
async def create_note(self, ctx: commands.Context[commands.Bot], target: discord.Member, content: str) -> None:
@@ -67,7 +67,7 @@ async def create_note(self, ctx: commands.Context[commands.Bot], target: discord
6767
@notes.command(
6868
name="delete",
6969
aliases=["d"],
70-
usage="$notes delete [note_id]",
70+
usage="notes delete [note_id]",
7171
)
7272
@commands.guild_only()
7373
async def delete_note(self, ctx: commands.Context[commands.Bot], note_id: int) -> None:
@@ -108,7 +108,7 @@ async def delete_note(self, ctx: commands.Context[commands.Bot], note_id: int) -
108108
@notes.command(
109109
name="update",
110110
aliases=["u", "edit", "e", "modify", "m"],
111-
usage="$notes update [note_id] [content]",
111+
usage="notes update [note_id] [content]",
112112
)
113113
@commands.guild_only()
114114
async def update_note(self, ctx: commands.Context[commands.Bot], note_id: int, content: str) -> None:
@@ -152,7 +152,7 @@ async def update_note(self, ctx: commands.Context[commands.Bot], note_id: int, c
152152
@notes.command(
153153
name="view",
154154
aliases=["v", "get", "g"],
155-
usage="$notes view [note_id]",
155+
usage="notes view [note_id]",
156156
)
157157
@commands.guild_only()
158158
async def view_note(

tux/cogs/admin/dev.py

Lines changed: 6 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, bot: commands.Bot) -> None:
1212
@commands.hybrid_group(
1313
name="dev",
1414
aliases=["d"],
15-
usage="$dev <subcommand>",
15+
usage="dev <subcommand>",
1616
)
1717
@commands.guild_only()
1818
@checks.has_pl(8)
@@ -38,7 +38,7 @@ async def dev(self, ctx: commands.Context[commands.Bot]) -> None:
3838
@dev.command(
3939
name="sync_tree",
4040
aliases=["st", "sync", "s"],
41-
usage="$dev sync_tree [guild]",
41+
usage="dev sync_tree [guild]",
4242
)
4343
@commands.guild_only()
4444
@checks.has_pl(8)
@@ -69,21 +69,10 @@ async def sync_tree(self, ctx: commands.Context[commands.Bot], guild: discord.Gu
6969
await self.bot.tree.sync(guild=ctx.guild)
7070
await ctx.send("Application command tree synced.")
7171

72-
@sync_tree.error
73-
async def sync_error(self, ctx: commands.Context[commands.Bot], error: Exception) -> None:
74-
if isinstance(error, commands.MissingRequiredArgument):
75-
await ctx.send(
76-
f"Please specify a guild to sync application commands to. {error}",
77-
ephemeral=True,
78-
delete_after=30,
79-
)
80-
else:
81-
logger.error(f"Error syncing application commands: {error}")
82-
8372
@dev.command(
8473
name="clear_tree",
8574
aliases=["ct", "clear", "c"],
86-
usage="$dev clear_tree",
75+
usage="dev clear_tree",
8776
)
8877
@commands.guild_only()
8978
@checks.has_pl(8)
@@ -118,7 +107,7 @@ async def clear_tree(self, ctx: commands.Context[commands.Bot]) -> None:
118107
@dev.command(
119108
name="load_cog",
120109
aliases=["lc", "load", "l"],
121-
usage="$dev load_cog [cog]",
110+
usage="dev load_cog [cog]",
122111
)
123112
@commands.guild_only()
124113
@checks.has_pl(8)
@@ -156,30 +145,10 @@ async def load_cog(self, ctx: commands.Context[commands.Bot], *, cog: str) -> No
156145
await ctx.send(f"Cog {cog} loaded.")
157146
logger.info(f"Cog {cog} loaded.")
158147

159-
@load_cog.error
160-
async def load_error(self, ctx: commands.Context[commands.Bot], error: Exception) -> None:
161-
if isinstance(error, commands.MissingRequiredArgument):
162-
await ctx.send(f"Please specify an cog to load. {error}", ephemeral=True, delete_after=30)
163-
elif isinstance(error, commands.ExtensionAlreadyLoaded):
164-
await ctx.send(f"The specified cog is already loaded. {error}", ephemeral=True, delete_after=30)
165-
elif isinstance(error, commands.ExtensionNotFound):
166-
await ctx.send(f"The specified cog is not found. {error}", ephemeral=True, delete_after=30)
167-
elif isinstance(error, commands.ExtensionFailed):
168-
await ctx.send(f"Failed to load cog: {error}", ephemeral=True, delete_after=30)
169-
elif isinstance(error, commands.NoEntryPointError):
170-
await ctx.send(
171-
f"The specified cog does not have a setup function. {error}",
172-
ephemeral=True,
173-
delete_after=30,
174-
)
175-
else:
176-
await ctx.send(f"Failed to load cog: {error}", ephemeral=True, delete_after=30)
177-
logger.error(f"Failed to load cog: {error}")
178-
179148
@dev.command(
180149
name="unload_cog",
181150
aliases=["uc", "unload", "u"],
182-
usage="$dev unload_cog [cog]",
151+
usage="dev unload_cog [cog]",
183152
)
184153
@commands.guild_only()
185154
@checks.has_pl(8)
@@ -211,19 +180,10 @@ async def unload_cog(self, ctx: commands.Context[commands.Bot], *, cog: str) ->
211180
logger.info(f"Cog {cog} unloaded.")
212181
await ctx.send(f"Cog {cog} unloaded.", ephemeral=True, delete_after=30)
213182

214-
@unload_cog.error
215-
async def unload_error(self, ctx: commands.Context[commands.Bot], error: Exception) -> None:
216-
if isinstance(error, commands.MissingRequiredArgument):
217-
await ctx.send(f"Please specify an extension to unload. {error}", ephemeral=True, delete_after=30)
218-
elif isinstance(error, commands.ExtensionNotLoaded):
219-
await ctx.send(f"That cog is not loaded. {error}", ephemeral=True, delete_after=30)
220-
else:
221-
logger.error(f"Error unloading cog: {error}")
222-
223183
@dev.command(
224184
name="reload_cog",
225185
aliases=["rc", "reload", "r"],
226-
usage="$dev reload_cog [cog]",
186+
usage="dev reload_cog [cog]",
227187
)
228188
@commands.guild_only()
229189
@checks.has_pl(8)
@@ -256,16 +216,6 @@ async def reload_cog(self, ctx: commands.Context[commands.Bot], *, cog: str) ->
256216
await ctx.send(f"Cog {cog} reloaded.", ephemeral=True, delete_after=30)
257217
logger.info(f"Cog {cog} reloaded.")
258218

259-
@reload_cog.error
260-
async def reload_error(self, ctx: commands.Context[commands.Bot], error: Exception) -> None:
261-
if isinstance(error, commands.MissingRequiredArgument):
262-
await ctx.send(f"Please specify a cog to reload. {error}", ephemeral=True, delete_after=30)
263-
elif isinstance(error, commands.ExtensionNotLoaded):
264-
await ctx.send(f"That cog is not loaded. {error}", ephemeral=True, delete_after=30)
265-
else:
266-
await ctx.send(f"Error reloading cog: {error}", ephemeral=True, delete_after=30)
267-
logger.error(f"Error reloading cog: {error}")
268-
269219

270220
async def setup(bot: commands.Bot) -> None:
271221
await bot.add_cog(Dev(bot))

tux/cogs/admin/eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, bot: commands.Bot) -> None:
4545
@commands.command(
4646
name="eval",
4747
aliases=["e"],
48-
usage="$eval [expression]",
48+
usage="eval [expression]",
4949
)
5050
@commands.guild_only()
5151
@checks.has_pl(9)

tux/cogs/admin/git.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def __init__(self, bot: commands.Bot) -> None:
403403
@commands.hybrid_group(
404404
name="git",
405405
aliases=["g"],
406-
usage="$git <subcommand>",
406+
usage="git <subcommand>",
407407
)
408408
@commands.guild_only()
409409
@checks.has_pl(8)
@@ -423,7 +423,7 @@ async def git(self, ctx: commands.Context[commands.Bot]) -> None:
423423
@git.command(
424424
name="get_repo",
425425
aliases=["r"],
426-
usage="$git get_repo",
426+
usage="git get_repo",
427427
)
428428
@commands.guild_only()
429429
@checks.has_pl(8)
@@ -461,7 +461,7 @@ async def get_repo(self, ctx: commands.Context[commands.Bot]) -> None:
461461
@git.command(
462462
name="create_issue",
463463
aliases=["ci"],
464-
usage="$git create_issue [title] [body]",
464+
usage="git create_issue [title] [body]",
465465
)
466466
@commands.guild_only()
467467
# @checks.has_pl(8)
@@ -503,7 +503,7 @@ async def create_issue(self, ctx: commands.Context[commands.Bot], title: str, bo
503503
@git.command(
504504
name="get_issue",
505505
aliases=["gi", "issue", "i"],
506-
usage="$git get_issue [issue_number]",
506+
usage="git get_issue [issue_number]",
507507
)
508508
@commands.guild_only()
509509
@checks.has_pl(8)

tux/cogs/fun/random.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, bot: commands.Bot) -> None:
1212
@commands.hybrid_group(
1313
name="random",
1414
aliases=["rand"],
15-
usage="$random <subcommand>",
15+
usage="random <subcommand>",
1616
)
1717
@commands.guild_only()
1818
async def random(self, ctx: commands.Context[commands.Bot]) -> None:
@@ -30,7 +30,7 @@ async def random(self, ctx: commands.Context[commands.Bot]) -> None:
3030
@random.command(
3131
name="coinflip",
3232
aliases=["cf"],
33-
usage="$random coinflip",
33+
usage="random coinflip",
3434
)
3535
@commands.guild_only()
3636
async def coinflip(self, ctx: commands.Context[commands.Bot]) -> None:
@@ -50,7 +50,7 @@ async def coinflip(self, ctx: commands.Context[commands.Bot]) -> None:
5050
@random.command(
5151
name="8ball",
5252
aliases=["eightball", "8b"],
53-
usage="$random 8ball [question]",
53+
usage="random 8ball [question]",
5454
)
5555
@commands.guild_only()
5656
async def eight_ball(self, ctx: commands.Context[commands.Bot], *, question: str, cow: bool = False) -> None:
@@ -140,7 +140,7 @@ async def eight_ball(self, ctx: commands.Context[commands.Bot], *, question: str
140140
@random.command(
141141
name="dice",
142142
aliases=["d"],
143-
usage="$random dice <sides>",
143+
usage="random dice <sides>",
144144
)
145145
@commands.guild_only()
146146
async def dice(self, ctx: commands.Context[commands.Bot], sides: int = 6) -> None:
@@ -170,7 +170,7 @@ async def dice(self, ctx: commands.Context[commands.Bot], sides: int = 6) -> Non
170170
@random.command(
171171
name="number",
172172
aliases=["n"],
173-
usage="$random number <min> <max>",
173+
usage="random number <min> <max>",
174174
)
175175
@commands.guild_only()
176176
async def random_number(

tux/cogs/fun/xkcd.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self, bot: commands.Bot) -> None:
1515
@commands.hybrid_group(
1616
name="xkcd",
1717
aliases=["xk"],
18-
usage="$xkcd <subcommand>",
18+
usage="xkcd <subcommand>",
1919
)
2020
@commands.guild_only()
2121
async def xkcd(self, ctx: commands.Context[commands.Bot], comic_id: int | None = None) -> None:
@@ -38,7 +38,7 @@ async def xkcd(self, ctx: commands.Context[commands.Bot], comic_id: int | None =
3838
@xkcd.command(
3939
name="latest",
4040
aliases=["l", "new", "n"],
41-
usage="$xkcd latest",
41+
usage="xkcd latest",
4242
)
4343
@commands.guild_only()
4444
async def latest(self, ctx: commands.Context[commands.Bot]) -> None:
@@ -61,7 +61,7 @@ async def latest(self, ctx: commands.Context[commands.Bot]) -> None:
6161
@xkcd.command(
6262
name="random",
6363
aliases=["rand", "r"],
64-
usage="$xkcd random",
64+
usage="xkcd random",
6565
)
6666
@commands.guild_only()
6767
async def random(self, ctx: commands.Context[commands.Bot]) -> None:
@@ -84,7 +84,7 @@ async def random(self, ctx: commands.Context[commands.Bot]) -> None:
8484
@xkcd.command(
8585
name="specific",
8686
aliases=["s", "id", "num"],
87-
usage="$xkcd specific [comic_id]",
87+
usage="xkcd specific [comic_id]",
8888
)
8989
@commands.guild_only()
9090
async def specific(self, ctx: commands.Context[commands.Bot], comic_id: int) -> None:

tux/cogs/info/avatar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async def slash_avatar(
3636
@commands.command(
3737
name="avatar",
3838
aliases=["av"],
39-
usage="$avatar <member>",
39+
usage="avatar <member>",
4040
)
4141
@commands.guild_only()
4242
async def prefix_avatar(

tux/cogs/misc/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ async def send_embedded_reply(
232232
@commands.command(
233233
name="run",
234234
aliases=["compile", "exec"],
235-
usage="$run [code]",
235+
usage="run [code]",
236236
)
237237
async def run(
238238
self,
@@ -302,7 +302,7 @@ async def run_error(
302302
@commands.command(
303303
name="languages",
304304
aliases=["langs"],
305-
usage="$languages",
305+
usage="languages",
306306
)
307307
async def languages(self, ctx: commands.Context[commands.Bot]) -> None:
308308
"""

tux/cogs/moderation/ban.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, bot: commands.Bot) -> None:
1818
@commands.hybrid_command(
1919
name="ban",
2020
aliases=["b"],
21-
usage="$ban [target] <flags>",
21+
usage="ban [target] <flags>",
2222
)
2323
@commands.guild_only()
2424
@checks.has_pl(3)

tux/cogs/moderation/cases.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, bot: commands.Bot) -> None:
3333
@commands.hybrid_group(
3434
name="cases",
3535
aliases=["c"],
36-
usage="$cases <subcommand>",
36+
usage="cases <subcommand>",
3737
)
3838
@commands.guild_only()
3939
@checks.has_pl(2)
@@ -47,7 +47,7 @@ async def cases(self, ctx: commands.Context[commands.Bot]) -> None:
4747
@cases.command(
4848
name="view",
4949
aliases=["v", "ls", "list"],
50-
usage="$cases view <case_number> <flags>",
50+
usage="cases view <case_number> <flags>",
5151
)
5252
@commands.guild_only()
5353
@checks.has_pl(2)
@@ -83,7 +83,7 @@ async def cases_view(
8383
@cases.command(
8484
name="modify",
8585
aliases=["m", "edit"],
86-
usage="$cases modify [case_number] <flags>",
86+
usage="cases modify [case_number] <flags>",
8787
)
8888
@commands.guild_only()
8989
@checks.has_pl(2)

0 commit comments

Comments
 (0)