Skip to content
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

Allow custom select options in SimpleMenu #6455

Open
CattoFace opened this issue Sep 21, 2024 · 1 comment
Open

Allow custom select options in SimpleMenu #6455

CattoFace opened this issue Sep 21, 2024 · 1 comment
Labels
Status: Needs Triage This has not been labeled or discussed for handling yet. Type: Feature New feature or request.

Comments

@CattoFace
Copy link

CattoFace commented Sep 21, 2024

Type of feature request

API functionality

Description of the feature you're suggesting

SimpleMenu should allow custom names for the pages instead of the hardcoded "Page X".
The most straight forward solution I can see is to take an optional list of names when creating the menu and if its given, use it instead of generating the "Page X" list.
My cog currently "hacks" the existing behavior using

menu.select_options = [discord.SelectOption(label=n, value=num) for num, (n,_) in enumerate(menu_items)]
menu.select_menu = menu._get_select_menu()
menu.add_item(menu.select_menu)

(menu_items is a list of tuples of (name,content) in this case)

Anything else?

I can write a pull request myself if needed.

@CattoFace CattoFace added the Type: Feature New feature or request. label Sep 21, 2024
@github-actions github-actions bot added the Status: Needs Triage This has not been labeled or discussed for handling yet. label Sep 21, 2024
@TrustyJAID
Copy link
Member

SimpleMenu is meant to be a quick easy way to create a menu by providing the list of pages. It's an evolution on Red's original menu system adding some quality of life with the select menu picker to jump to specific pages. Generally I would recommend making your own view and menu if you want to customize the select pages. Alternatively since SimpleMenu is a view you can just write your own select menu to add to it with the add_item method.

The only complex part of SimpleMenu is how it handles when there's more than 25 options in your list. In order to support this I would suggest moving self.select_menu = self._get_select_menu() into the start method so that it utilizes customized values before sending while keeping everything as simple as it currently is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage This has not been labeled or discussed for handling yet. Type: Feature New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants