Skip to content

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 29 commits into from
Oct 30, 2022
Merged

Conversation

shiftinv
Copy link
Member

@shiftinv shiftinv commented Oct 16, 2022

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:

Resolves #798.

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running task lint
    • I have type-checked the code by running task pyright
  • This PR fixes an issue
  • This PR adds something new (e.g. new method or parameters)
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@shiftinv shiftinv added t: enhancement New feature t: api support Support of Discord API features p: high High priority s: in progress Issue/PR is being worked on s: needs review Issue/PR is awaiting reviews labels Oct 16, 2022
@shiftinv shiftinv added this to the disnake v2.7 milestone Oct 16, 2022
Base automatically changed from refactor/select-base to master October 17, 2022 00:12
@onerandomusername onerandomusername changed the base branch from master to misc/component-stuff October 17, 2022 04:53
@shiftinv shiftinv force-pushed the misc/component-stuff branch from 15282ba to e075246 Compare October 17, 2022 18:07
@shiftinv shiftinv force-pushed the misc/component-stuff branch from 5a435b7 to b6b6a33 Compare October 17, 2022 18:55
Base automatically changed from misc/component-stuff to master October 17, 2022 18:58
@onerandomusername
Copy link
Member

@shiftinv would you please resolve conflicts?

@onerandomusername onerandomusername marked this pull request as ready for review October 18, 2022 03:06
Copy link
Member

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

@onerandomusername onerandomusername added the s: blocked Issue/PR is blocked by other issues label Oct 19, 2022
@shiftinv shiftinv marked this pull request as draft October 20, 2022 14:14
@shiftinv shiftinv force-pushed the feature/select branch 2 times, most recently from c9f282b to 48398fd Compare October 21, 2022 11:41
@shiftinv shiftinv changed the base branch from master to refactor/interaction-resolved October 21, 2022 11:41
@shiftinv shiftinv removed the s: in progress Issue/PR is being worked on label Oct 21, 2022
@onerandomusername onerandomusername marked this pull request as ready for review October 26, 2022 04:19
@shiftinv shiftinv removed the s: blocked Issue/PR is blocked by other issues label Oct 29, 2022
@onerandomusername onerandomusername merged commit 5170aaa into master Oct 30, 2022
@onerandomusername onerandomusername deleted the feature/select branch October 30, 2022 03:13
@onerandomusername onerandomusername removed the s: needs review Issue/PR is awaiting reviews label Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: high High priority t: api support Support of Discord API features t: enhancement New feature
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

New select menu components
2 participants