the new SelectMenuBuilder() - Error when adding one in my ContainerBuilder()
Hello, so I am doing my bot using the new Container and I just saw that there is a new way to create select menus.
But I got an issue by creating one for the roles. I have a .json file with a few IDs and I want to add each of these IDs as options of the menu. But I got an error and I don't really know how to fix it, so I am asking here
Here is my code : https://pastebin.com/0TXLxMu2
And here is the error
19 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 staffAlso if you could ping me when you will answer me
thank you
for the record, auto-populating select menus aren't really new
that being said, select menus (including string select menus) default to having a max values of 1
therefore the number of default roles you've selected is over the max
what is the max I can put per select menus
I stopped doing bot for 1 or 2 years, so didn't know
before it was just a global selectMenuBuilder with
.addOptions()the max you can set for the max values is 25
I have 18 IDs
yes, but max values defaults to 1
you'll need to call
.setMaxValues()but that is what I want
then don't select 18 roles as the default
oh I understand
is it possible to not have all the roles by default
thought it was like a filter
all roles being available in the select menu is the default
<RoleSelectMenuBuilder>.setDefaultroles() sets the default roles selected
there is no means of filtering which roles appear in the select menu
it is auto-populatingOk I see
I will use 18 buttons then
thank you
@duck so I edited my code to replace the select menu with all the 18 buttons but I got an error when I responded to the interaction even though it's the same response in several of my commands.
Here is the new code with all the buttons : https://pastebin.com/pzr2rQYy
And the error :
It is talking about an array, but I can not figure which one
Pastebin
const { SlashCommandBuilder, ContainerBuilder, MessageFlags, Permis...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
sections are specifically for if you want a text display with 1 thumbnail/button
you're looking to put those buttons in action rows
documentation suggestion for @clst.risuu:
:method: ContainerBuilder#addActionRowComponents()
discord.js@14.19.3
Adds action row components to this container.oh okay did not know, I will remember
thank you
so I may use the ButtonBuilder instead of the ButtonAccessory ?
I mean you were already using
ButtonBuilder since that's what each b param is in each setButtonAccessoryokay I see
thank you for your help
npm list discord.js