Skip to content

Add commands#185

Merged
ChrisLovering merged 3 commits into
mainfrom
add_commands
Apr 1, 2026
Merged

Add commands#185
ChrisLovering merged 3 commits into
mainfrom
add_commands

Conversation

@brad90four
Copy link
Copy Markdown
Contributor

  • points_edit command to directly edit a user's points
  • role_reset command to reset a user's 'levels' role

- `points_edit` command to directly edit a user's points
- `role_reset` command to reset a user's 'levels' role
@python-discord-policy-bot python-discord-policy-bot Bot requested a review from a team April 1, 2026 18:30
Comment thread bot/exts/levels/_cog.py Outdated
Comment on lines +350 to +351
async def points_edit(self, ctx: commands.Context, user_id: int, point_edit: int) -> None:
"""Edits the given user's points."""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: It's not clear from the var name + docstring that point_edit is a diff to apply, rather than the number of points to set it to.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated docstring to more clearly indicate that the point value given in the command is an offset, not a new total.

Comment thread bot/exts/levels/_cog.py Outdated
Comment on lines +358 to +368
@levels_command_group.command()
@commands.has_any_role(*ELEVATED_ROLES)
async def role_reset(self, ctx: commands.Context, user_id: int) -> None:
"""Reset a given user's 'levels' roles."""
guild = self.bot.get_guild(constants.Bot.guild)
user = await members.get_or_fetch_member(guild, user_id)
for user_role in user.roles:
if user_role in LEVEL_ROLES:
await members.handle_role_change(user, user.remove_roles, user_role)

await ctx.reply(f"Reset {user}'s 'levels' roles.")
Copy link
Copy Markdown
Member

@ChrisLovering ChrisLovering Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't they just get the highest role they meet back next time they hit a rule?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, updated and refactored to re-use _update_role_assignment

@ChrisLovering ChrisLovering merged commit db6a74e into main Apr 1, 2026
5 checks passed
@ChrisLovering ChrisLovering deleted the add_commands branch April 1, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants