-
-
Notifications
You must be signed in to change notification settings - Fork 731
Allow members to self assign roles through a persistent view #2341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…AssignableRolesButton button Note that these are still dummy views & have no behavior
This comes with another dependency to try to locate the message that needs to hold the view. If that message is not found, a new one will be created & sent.
…the appropriate roles
The messages were intended for a button that will automatically assign all availables roles to the interactor This changes since it's not the intended behavior
This also enhances the docstrings for a better clarification of its purpose
This documents the attributes the class has, which gives better context for future readers/contributors
mbaruh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good! this is purely a code review, will test later.
mbaruh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misclick 😅
This also renames to method to align more with our fetch or {action} pattern
This will help clarify the relationship between the button & the viw since it'll only be used there
…inside the view itself
|
I know I'm late but what about a button that shows an ephemeral view which takes into consideration what roles the user already has, so they can select all of the roles they want in one single go? |
|
But that's similar to what we already have, isn't it? or did I understand that wrong? The ones they have are highlighted in red, and the message states that just fine, e.g. Whether the role will be added or removed. And how would they select them all in one go? |
This is what I have for roles in my guilds. This implementation uses a slash command to show the select menu, but it could be anything: like a button in the #roles channel which shows this select. This is nicer from a UX perspective IMO because it shows which roles the user already has, and while its true the button view does communicate this fact, the button view is a bit confusing and does not allow for descriptions. |
|
Hummm, i guess this could be discussed in another issue. The current goal is to keep the same behavior for the subscribe command and add more visibility by '' pinning '' it in the roles channel. I like the idea, and if approved, i will be more than happy to do it. |
|
Let's keep this PR focused on generating the permanent view. We can discuss changing the subscription UI in a separate issue if you want to open one @onerandomusername |
mbaruh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just a few nitpicks
bot/bot/exts/info/subscribe.py
Line 101 in 91a869e
| LABEL_FORMAT = "{action} role {role_name}." |
Let's get rid of that dot at the end while we're at it.
Dismissed because the approval was invalidated by another commit
Robin5605
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing major. Thanks for the PR! I haven't tested it either, so I'm hoping we didn't letting anything slip by haha 😄
bot/exts/info/subscribe.py
Outdated
|
|
||
| SELF_ASSIGNABLE_ROLES_MESSAGE = ( | ||
| f"Hi there {GREETING_EMOJI}," | ||
| "\nWe have self-assignable roles for server updates an events!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this sentence is supposed to mean entirely. Perhaps it could be reworded to be concise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're just trying to let people know what these roles are for.
That's supposed to be an "and", it's a typo.
Do you still think it's unclear then ? If yes, a suggestion is appreciated :D
| async for message in roles_channel.history(limit=30): | ||
| if message.content == self.SELF_ASSIGNABLE_ROLES_MESSAGE: | ||
| log.debug(f"Found self assignable roles view message: {message.id}") | ||
| return message, None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we are returning None for the discord.ui.View? Couldn't we just use discord.ui.View.from_message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't really recreate the view using from_message, as this persistent view needs to be instantiated with the self assignable roles, and from_message cannot pick that up.
Robin5605
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, thanks! I have no more suggestions 😃
Closes #2332
As stated by Zig, subscribing to our public roles is currently not super visible since it revolves around executing the
!subscribecommand that usually goes by unnoticed.To make this easier, more visible & to align with other communities have, we decided to add a persistent view in the
#roleschannel that allows people to subscribing to their chosen roles by a click of a button.