Skip to content

Commit b297ea2

Browse files
committed
Pixl - reset scoreboard command
1 parent babba00 commit b297ea2

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

pixl/pixl.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Pixl(commands.Cog):
4848
"""
4949

5050
__author__ = "[vertyco](https://github.com/vertyco/vrt-cogs)"
51-
__version__ = "0.3.7"
51+
__version__ = "0.3.8"
5252

5353
def __init__(self, bot: Red, *args, **kwargs):
5454
super().__init__(*args, **kwargs)
@@ -250,7 +250,7 @@ async def start_game(self, ctx: commands.Context):
250250
if winner: # Chicken dinner
251251
thumb = (winner.display_avatar.url) if dpy2 else winner.avatar_url
252252
title = "Winner!"
253-
desc = f"{winner.name} guessed correctly after {shown} blocks!\n" f"`Points Awarded: `{points}\n"
253+
desc = f"{winner.name} guessed correctly after {shown} blocks!\n`Points Awarded: `{points}\n"
254254
if participants >= min_p and reward:
255255
desc += f"`Credits Awarded: `{humanize_number(reward)}"
256256
color = winner.color
@@ -427,6 +427,30 @@ async def set_game_delay(self, ctx: commands.Context, seconds: int):
427427
await self.config.delay.set(seconds)
428428
await ctx.send(f"Game delay has been set to {humanize_timedelta(seconds=seconds)}")
429429

430+
@pixlset.command(name="reset")
431+
@commands.guild_only()
432+
@commands.admin_or_permissions(manage_guild=True)
433+
async def reset_scoreboard(self, ctx: commands.Context, user: Optional[discord.Member] = None):
434+
"""
435+
Reset the Pixl scoreboard
436+
437+
**Arguments**
438+
`user`: (Optional) A specific user to reset scores for. If not provided, resets scores for all users.
439+
440+
Examples:
441+
- `[p]pixlset reset` - Resets scores for all users
442+
- `[p]pixlset reset @user` - Resets scores for the specified user
443+
"""
444+
async with ctx.typing():
445+
if user:
446+
# Reset scores for a specific user
447+
await self.config.member(user).clear()
448+
await ctx.send(f"Scoreboard has been reset for {user.display_name}")
449+
else:
450+
# Reset scores for all users
451+
await self.config.clear_all_members(ctx.guild)
452+
await ctx.send("Scoreboard has been reset for all users in this server")
453+
430454
@pixlset.group(name="image")
431455
async def image(self, ctx: commands.Context):
432456
"""Add/Remove images"""

0 commit comments

Comments
 (0)