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

Add new component types for User, Role, Mentionable, and Channel Select #8753

Closed
TrevorSayre opened this issue Oct 14, 2022 · 9 comments · Fixed by #8793
Closed

Add new component types for User, Role, Mentionable, and Channel Select #8753

TrevorSayre opened this issue Oct 14, 2022 · 9 comments · Fixed by #8793

Comments

@TrevorSayre
Copy link

TrevorSayre commented Oct 14, 2022

Which package is the feature request for?

discord.js

Feature

Currently discord.js only supports Component Types 1 through 4: Action Row, Button, String Select, and Text Input. Discord added 4 more types, 5 through 8: User Select, Role Select, Mentionable Select, and Channel Select. They function nearly identically to String Select (Component Type 3), except they don't take options and they return not only a value but also a resolved object.

https://discord.com/developers/docs/interactions/message-components#component-object-component-types

https://discord.com/developers/docs/interactions/message-components#select-menu-types

Ideal solution or implementation

Add the 4 new select menu types.

Alternative solutions or implementations

No response

Other context

No response

@TrevorSayre
Copy link
Author

TrevorSayre commented Oct 14, 2022

I should add, I don't use builders, so I'm primarily looking for TypeScript types support and interaction payload support. Obviously, though, users of the builders package would benefit from the feature also being added there.

@Jiralite
Copy link
Member

That's all builders. discord.js just uses them.

@TrevorSayre
Copy link
Author

Great, thank you for the clarification!

@RedGuy12
Copy link
Contributor

@jaw0r3k and I are currently working on this.

@gamer0mega
Copy link

There is a workaround for now, you can use the SelectMenuBuilder and pass {type: 5} to its constructor, which should create a select menu for picking users, you can set other types to get different select menus. Passing a raw component will not work as the library does not recognize the component type yet.

@itsgox
Copy link

itsgox commented Oct 15, 2022

@gamer0mega I'm doing that aswell, but the "interactionCreate" event doesn't get triggered when I interact with the select menu 🤔

@SuperchupuDev
Copy link
Contributor

@itsgox discord.js ignores unknown interaction types on the interactionCreate event, if you really want to respond to new component types before they're officially supported you should listen to the raw client.ws.on('INTERACTION_CREATE', ...) event

@itsgox
Copy link

itsgox commented Oct 15, 2022

@SuperchupuDev Thank you so much!!

@TrevorSayre
Copy link
Author

There is a workaround for now, you can use the SelectMenuBuilder and pass {type: 5} to its constructor, which should create a select menu for picking users, you can set other types to get different select menus. Passing a raw component will not work as the library does not recognize the component type yet.

Side note, this workaround will not work for a Channel Select component when you want to include the channel_types optional field.

@kodiakhq kodiakhq bot closed this as completed in #8793 Nov 1, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants