Make a select menu builder for certain roles?
I am kinda new to coding and confused on how I can make a select menu for certain roles. I can get the menu sent but don't know how to make a certain interaction add a certain role.
11 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by staffDiscord does not support customizing which roles are shown in a role select menu, so you'll have to use a string select menu in this occasion and call
addOptions()
to add the options you want into the select menuohh, well if I do so then how would I make it so when they select the option it gives it to them?
One way would be to include the role ID in your select menu option value, something like
role-menu-1234567890
, where you the parse the role ID out of that option's value and then simply call <StringSelectMenuInteraction>.member.roles.add(parsedRoleId)
:guide: Message Components: Component interactions
read more
:property: StringSelectMenuInteraction#values
@14.16.3
The values selectedSorry one last question, what would I replace the
<StringSelectMenuInteraction>
with?Your actual StringSelectMenuInteraction you receive, whether that's from a collector or an event listener
Could you possibly help with the collector or send a doc that explains into more detail about it?
Thank you!