-
Notifications
You must be signed in to change notification settings - Fork 140
feat: implement new select menu components #803
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
Merged
Merged
Conversation
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
eb9b09f
to
dfcfe17
Compare
6f96e68
to
15282ba
Compare
dfcfe17
to
21edda2
Compare
15282ba
to
e075246
Compare
50ee58a
to
5a435b7
Compare
5a435b7
to
b6b6a33
Compare
b6b6a33
to
0fdc82c
Compare
@shiftinv would you please resolve conflicts? |
21edda2
to
6e8c348
Compare
6e8c348
to
3e32d53
Compare
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.
Mostly good, but values ends up empty when used with disnake.ui.ActionRow.rows_from_message:
class PR803(commands.Cog):
@commands.slash_command()
async def select(self, inter: disnake.GuildCommandInteraction) -> None:
comps = disnake.ui.RoleSelect(custom_id="pr:803")
await inter.send(components=comps)
@commands.Cog.listener()
async def on_dropdown(self, inter: disnake.MessageInteraction):
if inter.data.custom_id != "pr:803":
return
comp: disnake.BaseSelectMenu = inter.component # type: ignore
print(inter.data.values)
rows = disnake.ui.ActionRow.rows_from_message(inter.message)
select = rows[0][0]
await inter.send(repr(select))
print(select.values)
Additionally, I have not yet tested their compatibility with views.
3e32d53
to
1ee37b9
Compare
c9f282b
to
48398fd
Compare
shiftinv
commented
Oct 21, 2022
8 tasks
5fb7a23
to
285568a
Compare
onerandomusername
approved these changes
Oct 30, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Summary
Adds new select menu components/items, with almost everything there is to it (component types, methods, decorators, ...).
This is a draft PR for several reasons:
It depends on refactor: split select menu types into base and concrete type #800, which is currently set as the base branch to get a clean diff.It depends on typing: misc internal component typing changes #801, which is currently merged into this branch to avoid merge conflicts later on.I haven't added backwards-compatible aliases yet, but that'll be easy enough once everything else is settled.Depends on refactor: slightly rework resolved interaction data handling #814 for theresolved
field, currently set as base branch.Select.values
issue with concurrent interactions.Resolves #798.
Checklist
task lint
task pyright