Skip to content

Commit 3cfba32

Browse files
authored
Merge branch 'main' into donor-icons
2 parents 01b18a8 + d14a499 commit 3cfba32

35 files changed

+350
-488
lines changed

tux/cogs/admin/dev.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@
44

55
from tux.bot import Tux
66
from tux.utils import checks
7+
from tux.utils.flags import generate_usage
78

89

910
class Dev(commands.Cog):
1011
def __init__(self, bot: Tux) -> None:
1112
self.bot = bot
13+
self.sync_tree.usage = generate_usage(self.sync_tree)
14+
self.clear_tree.usage = generate_usage(self.clear_tree)
15+
self.load_cog.usage = generate_usage(self.load_cog)
16+
self.unload_cog.usage = generate_usage(self.unload_cog)
17+
self.reload_cog.usage = generate_usage(self.reload_cog)
18+
self.stop.usage = generate_usage(self.stop)
1219

1320
@commands.hybrid_group(
1421
name="dev",
1522
aliases=["d"],
16-
usage="dev <subcommand>",
1723
)
1824
@commands.guild_only()
1925
@checks.has_pl(8)
@@ -39,7 +45,6 @@ async def dev(self, ctx: commands.Context[Tux]) -> None:
3945
@dev.command(
4046
name="sync_tree",
4147
aliases=["st", "sync", "s"],
42-
usage="dev sync_tree [guild]",
4348
)
4449
@commands.guild_only()
4550
@checks.has_pl(8)
@@ -71,7 +76,6 @@ async def sync_tree(self, ctx: commands.Context[Tux], guild: discord.Guild) -> N
7176
@dev.command(
7277
name="clear_tree",
7378
aliases=["ct", "clear", "c"],
74-
usage="dev clear_tree",
7579
)
7680
@commands.guild_only()
7781
@checks.has_pl(8)
@@ -104,7 +108,6 @@ async def clear_tree(self, ctx: commands.Context[Tux]) -> None:
104108
@dev.command(
105109
name="load_cog",
106110
aliases=["lc", "load", "l"],
107-
usage="dev load_cog [cog]",
108111
)
109112
@commands.guild_only()
110113
@checks.has_pl(8)
@@ -145,7 +148,6 @@ async def load_cog(self, ctx: commands.Context[Tux], *, cog: str) -> None:
145148
@dev.command(
146149
name="unload_cog",
147150
aliases=["uc", "unload", "u"],
148-
usage="dev unload_cog [cog]",
149151
)
150152
@commands.guild_only()
151153
@checks.has_pl(8)
@@ -180,7 +182,6 @@ async def unload_cog(self, ctx: commands.Context[Tux], *, cog: str) -> None:
180182
@dev.command(
181183
name="reload_cog",
182184
aliases=["rc", "reload", "r"],
183-
usage="dev reload_cog [cog]",
184185
)
185186
@commands.guild_only()
186187
@checks.has_pl(8)
@@ -215,7 +216,6 @@ async def reload_cog(self, ctx: commands.Context[Tux], *, cog: str) -> None:
215216

216217
@dev.command(
217218
name="stop",
218-
usage="dev stop",
219219
)
220220
@commands.guild_only()
221221
@checks.has_pl(8)

tux/cogs/admin/eval.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from tux.bot import Tux
88
from tux.ui.embeds import EmbedCreator
99
from tux.utils import checks
10+
from tux.utils.flags import generate_usage
1011

1112

1213
def insert_returns(body: list[ast.stmt]) -> None:
@@ -41,25 +42,26 @@ def insert_returns(body: list[ast.stmt]) -> None:
4142
class Eval(commands.Cog):
4243
def __init__(self, bot: Tux) -> None:
4344
self.bot = bot
45+
self.eval.usage = generate_usage(self.eval)
4446

4547
@commands.command(
4648
name="eval",
4749
aliases=["e"],
48-
usage="eval [expression]",
4950
)
5051
@commands.guild_only()
5152
@checks.has_pl(8) # sysadmin or higher
52-
async def eval(self, ctx: commands.Context[Tux], *, cmd: str) -> None:
53+
async def eval(self, ctx: commands.Context[Tux], *, expression: str) -> None:
5354
"""
5455
Evaluate a Python expression. (Owner only)
5556
5657
Parameters
5758
----------
5859
ctx : commands.Context[Tux]
5960
The context in which the command is being invoked.
60-
cmd : str
61+
expression : str
6162
The Python expression to evaluate.
6263
"""
64+
cmd = expression
6365

6466
# Check if the user is in the discord.py owner_ids list in the bot instance
6567
if self.bot.owner_ids is None:

tux/cogs/admin/git.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from tux.ui.embeds import EmbedCreator
77
from tux.utils import checks
88
from tux.utils.constants import Constants as CONST
9+
from tux.utils.flags import generate_usage
910
from tux.wrappers.github import GithubService
1011

1112
# TODO: Rewrite this cog to use the new hybrid command system.
@@ -16,11 +17,14 @@ def __init__(self, bot: Tux) -> None:
1617
self.bot = bot
1718
self.github = GithubService()
1819
self.repo_url = CONST.GITHUB_REPO_URL
20+
self.git.usage = generate_usage(self.git)
21+
self.get_repo.usage = generate_usage(self.get_repo)
22+
self.create_issue.usage = generate_usage(self.create_issue)
23+
self.get_issue.usage = generate_usage(self.get_issue)
1924

2025
@commands.hybrid_group(
2126
name="git",
2227
aliases=["g"],
23-
usage="git <subcommand>",
2428
)
2529
@commands.guild_only()
2630
@checks.has_pl(8)
@@ -40,7 +44,6 @@ async def git(self, ctx: commands.Context[Tux]) -> None:
4044
@git.command(
4145
name="get_repo",
4246
aliases=["r"],
43-
usage="git get_repo",
4447
)
4548
@commands.guild_only()
4649
@checks.has_pl(8)
@@ -81,7 +84,6 @@ async def get_repo(self, ctx: commands.Context[Tux]) -> None:
8184
@git.command(
8285
name="create_issue",
8386
aliases=["ci"],
84-
usage="git create_issue [title] [body]",
8587
)
8688
@commands.guild_only()
8789
# @checks.has_pl(8)
@@ -127,7 +129,6 @@ async def create_issue(self, ctx: commands.Context[Tux], title: str, body: str)
127129
@git.command(
128130
name="get_issue",
129131
aliases=["gi", "issue", "i"],
130-
usage="git get_issue [issue_number]",
131132
)
132133
@commands.guild_only()
133134
@checks.has_pl(8)

tux/cogs/fun/random.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@
44

55
from tux.bot import Tux
66
from tux.ui.embeds import EmbedCreator
7+
from tux.utils.flags import generate_usage
78

89

910
class Random(commands.Cog):
1011
def __init__(self, bot: Tux) -> None:
1112
self.bot = bot
13+
self.random.usage = generate_usage(self.random)
14+
self.coinflip.usage = generate_usage(self.coinflip)
15+
self.eight_ball.usage = generate_usage(self.eight_ball)
16+
self.dice.usage = generate_usage(self.dice)
17+
self.random_number.usage = generate_usage(self.random_number)
1218

1319
@commands.hybrid_group(
1420
name="random",
1521
aliases=["rand"],
16-
usage="random <subcommand>",
1722
)
1823
@commands.guild_only()
1924
async def random(self, ctx: commands.Context[Tux]) -> None:
@@ -31,7 +36,6 @@ async def random(self, ctx: commands.Context[Tux]) -> None:
3136
@random.command(
3237
name="coinflip",
3338
aliases=["cf"],
34-
usage="random coinflip",
3539
)
3640
@commands.guild_only()
3741
async def coinflip(self, ctx: commands.Context[Tux]) -> None:
@@ -51,7 +55,6 @@ async def coinflip(self, ctx: commands.Context[Tux]) -> None:
5155
@random.command(
5256
name="8ball",
5357
aliases=["eightball", "8b"],
54-
usage="random 8ball [question]",
5558
)
5659
@commands.guild_only()
5760
async def eight_ball(self, ctx: commands.Context[Tux], *, question: str, cow: bool = False) -> None:
@@ -155,7 +158,6 @@ async def eight_ball(self, ctx: commands.Context[Tux], *, question: str, cow: bo
155158
@random.command(
156159
name="dice",
157160
aliases=["d"],
158-
usage="random dice <sides>",
159161
)
160162
@commands.guild_only()
161163
async def dice(self, ctx: commands.Context[Tux], sides: int = 6) -> None:
@@ -188,7 +190,6 @@ async def dice(self, ctx: commands.Context[Tux], sides: int = 6) -> None:
188190
@random.command(
189191
name="number",
190192
aliases=["n"],
191-
usage="random number <min> <max>",
192193
)
193194
@commands.guild_only()
194195
async def random_number(

tux/cogs/fun/xkcd.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@
55
from tux.bot import Tux
66
from tux.ui.buttons import XkcdButtons
77
from tux.ui.embeds import EmbedCreator
8+
from tux.utils.flags import generate_usage
89
from tux.wrappers import xkcd
910

1011

1112
class Xkcd(commands.Cog):
1213
def __init__(self, bot: Tux) -> None:
1314
self.bot = bot
1415
self.client = xkcd.Client()
16+
self.xkcd.usage = generate_usage(self.xkcd)
17+
self.latest.usage = generate_usage(self.latest)
18+
self.random.usage = generate_usage(self.random)
19+
self.specific.usage = generate_usage(self.specific)
1520

1621
@commands.hybrid_group(
1722
name="xkcd",
1823
aliases=["xk"],
19-
usage="xkcd <subcommand>",
2024
)
2125
@commands.guild_only()
2226
async def xkcd(self, ctx: commands.Context[Tux], comic_id: int | None = None) -> None:
@@ -39,7 +43,6 @@ async def xkcd(self, ctx: commands.Context[Tux], comic_id: int | None = None) ->
3943
@xkcd.command(
4044
name="latest",
4145
aliases=["l", "new", "n"],
42-
usage="xkcd latest",
4346
)
4447
@commands.guild_only()
4548
async def latest(self, ctx: commands.Context[Tux]) -> None:
@@ -62,7 +65,6 @@ async def latest(self, ctx: commands.Context[Tux]) -> None:
6265
@xkcd.command(
6366
name="random",
6467
aliases=["rand", "r"],
65-
usage="xkcd random",
6668
)
6769
@commands.guild_only()
6870
async def random(self, ctx: commands.Context[Tux]) -> None:
@@ -85,7 +87,6 @@ async def random(self, ctx: commands.Context[Tux]) -> None:
8587
@xkcd.command(
8688
name="specific",
8789
aliases=["s", "id", "num"],
88-
usage="xkcd specific [comic_id]",
8990
)
9091
@commands.guild_only()
9192
async def specific(self, ctx: commands.Context[Tux], comic_id: int) -> None:

tux/cogs/info/avatar.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
from discord.ext import commands
88

99
from tux.bot import Tux
10+
from tux.utils.flags import generate_usage
1011

1112
client = httpx.AsyncClient()
1213

1314

1415
class Avatar(commands.Cog):
1516
def __init__(self, bot: Tux) -> None:
1617
self.bot = bot
18+
self.prefix_avatar.usage = generate_usage(self.prefix_avatar)
1719

1820
@app_commands.command(name="avatar")
1921
@app_commands.guild_only()
@@ -38,7 +40,6 @@ async def slash_avatar(
3840
@commands.command(
3941
name="avatar",
4042
aliases=["av"],
41-
usage="avatar <member>",
4243
)
4344
@commands.guild_only()
4445
async def prefix_avatar(

tux/cogs/info/info.py

+31-7
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,27 @@
66

77
from tux.bot import Tux
88
from tux.ui.embeds import EmbedCreator, EmbedType
9+
from tux.utils.flags import generate_usage
910

1011

1112
class Info(commands.Cog):
1213
def __init__(self, bot: Tux) -> None:
1314
self.bot = bot
14-
15+
self.info.usage = generate_usage(self.info)
16+
self.server.usage = generate_usage(self.server)
17+
self.member.usage = generate_usage(self.member)
18+
self.roles.usage = generate_usage(self.roles)
19+
self.emotes.usage = generate_usage(self.emotes)
20+
21+
@commands.hybrid_group(
22+
name="info",
23+
aliases=["i"],
24+
)
1525
@commands.guild_only()
16-
@commands.hybrid_group(name="info", aliases=["i"], usage="info <subcommand>")
17-
async def info(self, ctx: commands.Context[Tux]) -> None:
26+
async def info(
27+
self,
28+
ctx: commands.Context[Tux],
29+
) -> None:
1830
"""
1931
Information commands.
2032
@@ -27,8 +39,11 @@ async def info(self, ctx: commands.Context[Tux]) -> None:
2739
if ctx.invoked_subcommand is None:
2840
await ctx.send_help("info")
2941

42+
@info.command(
43+
name="server",
44+
aliases=["s"],
45+
)
3046
@commands.guild_only()
31-
@info.command(name="server", aliases=["s"], usage="info server")
3247
async def server(self, ctx: commands.Context[Tux]) -> None:
3348
"""
3449
Show information about the server.
@@ -68,8 +83,11 @@ async def server(self, ctx: commands.Context[Tux]) -> None:
6883

6984
await ctx.send(embed=embed)
7085

86+
@info.command(
87+
name="member",
88+
aliases=["m", "user", "u"],
89+
)
7190
@commands.guild_only()
72-
@info.command(name="member", aliases=["m", "user", "u"], usage="info member [member]")
7391
async def member(self, ctx: commands.Context[Tux], member: discord.Member) -> None:
7492
"""
7593
Show information about a member.
@@ -113,8 +131,11 @@ async def member(self, ctx: commands.Context[Tux], member: discord.Member) -> No
113131

114132
await ctx.send(embed=embed)
115133

134+
@info.command(
135+
name="roles",
136+
aliases=["r"],
137+
)
116138
@commands.guild_only()
117-
@info.command(name="roles", aliases=["r"], usage="info roles")
118139
async def roles(self, ctx: commands.Context[Tux]) -> None:
119140
"""
120141
List all roles in the server.
@@ -131,7 +152,10 @@ async def roles(self, ctx: commands.Context[Tux]) -> None:
131152

132153
await self.paginated_embed(ctx, "Server Roles", "roles", guild.name, roles, 32)
133154

134-
@info.command(name="emotes", aliases=["e"], usage="info emotes")
155+
@info.command(
156+
name="emotes",
157+
aliases=["e"],
158+
)
135159
async def emotes(self, ctx: commands.Context[Tux]) -> None:
136160
"""
137161
List all emotes in the server.

0 commit comments

Comments
 (0)