feat: allow staff to assign roles on behalf of users - #954
Closed
majestic-owl448 wants to merge 2 commits into
Closed
feat: allow staff to assign roles on behalf of users#954majestic-owl448 wants to merge 2 commits into
majestic-owl448 wants to merge 2 commits into
Conversation
Adds an optional autocomplete handler to the command and subcommand interfaces, and dispatches autocomplete interactions to it. Every path responds, since Discord only accepts a choice list for these.
Adds a management assign-role subcommand that toggles a role for the target member, mirroring the self-serve role buttons. The role option is autocompleted with every role below the camperChan's own highest role, excluding the everyone role and integration-owned roles such as the booster role. Changes are logged to the mod webhook, since Discord's audit log credits the camperChan rather than the moderator. Closes #943
naomi-freecodecamp
requested changes
Aug 5, 2026
naomi-freecodecamp
left a comment
Contributor
There was a problem hiding this comment.
blocking while discussing on discord
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.
Checklist:
Update index.md)Closes #943
Adds
/management assign-role, which toggles a role for a target member the same way the self-serve role buttons do. Moderators can now sort out campers who cannot work the onboarding UI.The
roleoption is autocompleted, and the list is computed live rather than configured: every role below the CamperChan's own highest role, minus the everyone role and minus roles owned by an integration, such as the booster role. Nothing to maintain when roles are added, moved, or removed. The same check runs again when the command executes, since a client can submit any string to an autocompleted option.Autocomplete had no plumbing in this repository, so the first commit adds it: an optional
autocompletehandler on the command and subcommand interfaces, plus a branch inhandleInteractionCreatethat dispatches to it. Every path there responds, because Discord accepts nothing but a choice list for these interactions and the camper's client hangs until timeout otherwise. Themanagementcommand routes autocomplete through the same subcommand map asrun, and runs the permission validator first, so non moderators get an empty list.Role changes are posted to the mod webhook, in the same plain content style as the voice reports:
Discord's audit log credits the CamperChan for the change, so without this there is no record of which moderator made it. The role is named rather than mentioned, so the log cannot ping everyone holding a mentionable role.
No configuration or permission changes are needed to deploy this. Commands are registered on boot, and the Manage Roles permission and the
GuildMembersintent are both already in use.