Skip to content

Conversation

@shtlrs
Copy link
Member

@shtlrs shtlrs commented Nov 26, 2022

Closes #2332

As stated by Zig, subscribing to our public roles is currently not super visible since it revolves around executing the !subscribe command 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 #roles channel that allows people to subscribing to their chosen roles by a click of a button.

…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 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
@shtlrs shtlrs marked this pull request as ready for review November 27, 2022 22:03
@shtlrs shtlrs requested review from Den4200 and jb3 as code owners November 27, 2022 22:03
@shtlrs shtlrs changed the title 2332 permanent role view Allow members to self assign roles through a persistent view Nov 28, 2022
@minalike minalike requested a review from mbaruh November 28, 2022 20:22
mbaruh
mbaruh previously approved these changes Dec 3, 2022
Copy link
Member

@mbaruh mbaruh left a 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.

Copy link
Member

@mbaruh mbaruh left a 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
@shtlrs shtlrs requested review from mbaruh and removed request for Den4200 and jb3 December 4, 2022 13:03
@onerandomusername
Copy link
Contributor

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?

@shtlrs
Copy link
Member Author

shtlrs commented Dec 4, 2022

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?

@onerandomusername
Copy link
Contributor

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.

image

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.

@shtlrs
Copy link
Member Author

shtlrs commented Dec 5, 2022

Hummm, i guess this could be discussed in another issue.
If it is going to be implemented, I think it should be done in another separate PR.

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.

@mbaruh
Copy link
Member

mbaruh commented Dec 5, 2022

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

Copy link
Member

@mbaruh mbaruh left a 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

LABEL_FORMAT = "{action} role {role_name}."

Let's get rid of that dot at the end while we're at it.

@python-discord-policy-bot python-discord-policy-bot bot dismissed stale reviews from mbaruh December 17, 2022 14:27

Dismissed because the approval was invalidated by another commit

Copy link
Contributor

@Robin5605 Robin5605 left a 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 😄


SELF_ASSIGNABLE_ROLES_MESSAGE = (
f"Hi there {GREETING_EMOJI},"
"\nWe have self-assignable roles for server updates an events!"
Copy link
Contributor

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?

Copy link
Member Author

@shtlrs shtlrs Jan 14, 2023

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
Copy link
Contributor

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?

Copy link
Member Author

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.

@wookie184 wookie184 added t: feature New feature or request s: needs review Author is waiting for someone to review and approve labels Jan 14, 2023
Copy link
Contributor

@Robin5605 Robin5605 left a 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 😃

@mbaruh mbaruh merged commit 0937e95 into python-discord:main Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

s: needs review Author is waiting for someone to review and approve t: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permanent roles view

5 participants