Skip to content

Commit

Permalink
move "plb" and "checkpost" to be a subcommand of "post" group
Browse files Browse the repository at this point in the history
  • Loading branch information
jackra1n committed Mar 19, 2024
1 parent c6ef4db commit 7a2896f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions extensions/karma.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,13 @@ async def karma_stats_graph(self, ctx: commands.Context):
await ctx.send(file=discord.File(filename))
os.remove(filename)

@commands.hybrid_group(name="post", aliases=["ps"], invoke_without_command=True)
async def post(self, ctx: commands.Context):
await ctx.send_help(ctx.command)

@commands.cooldown(2, 15, commands.BucketType.user)
@commands.hybrid_command(aliases=["plb"], usage="postlb")
async def postlb(self, ctx: commands.Context, user: discord.User = None):
@post.command(name="leaderboard", aliases=["lb"], usage="lb [user]")
async def post_leaderboard(self, ctx: commands.Context, user: discord.User = None):
"""
Posts the leaderboard of the most upvoted posts.
"""
Expand All @@ -478,9 +482,9 @@ async def fetch_and_create_leaderboard(self, ctx: commands.Context, user: discor
posts = await self.bot.db.fetch(stmt, *params)
return await self.create_post_leaderboard(posts)

@commands.command(name="checkpost", aliases=["cp"], usage="checkpost <post id>")
@post.command(name="check", aliases=["c"], usage="check <post id>")
@commands.is_owner()
async def check_post(self, ctx: commands.Context, post_id: int):
async def post_check(self, ctx: commands.Context, post_id: int):
"""
Checks if a post exists.
"""
Expand Down

0 comments on commit 7a2896f

Please sign in to comment.