Add commands#185
Merged
Merged
Conversation
- `points_edit` command to directly edit a user's points - `role_reset` command to reset a user's 'levels' role
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.""" |
Member
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
Updated docstring to more clearly indicate that the point value given in the command is an offset, not a new total.
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.") |
Member
There was a problem hiding this comment.
wouldn't they just get the highest role they meet back next time they hit a rule?
Contributor
Author
There was a problem hiding this comment.
Yes, updated and refactored to re-use _update_role_assignment
ChrisLovering
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
points_editcommand to directly edit a user's pointsrole_resetcommand to reset a user's 'levels' role