#Select menus

11 messages · Page 1 of 1 (latest)

rose vigil
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

raven crescent
#

Sure, dynamically make the options from the data of the file

formal holly
raven crescent
#

What part of it? The reading and parsing of a file? The setting of the options? Watching for file changes to automatically edit the file? …?

formal holly
crude turtleBOT
#

guide Interactions: Building and sending select menus
read more

raven crescent
#

addOptions accepts an array or Rest parameters. So you can simply .map whatever you have as data from the file to match the label-value pairs (optionally with description and emoji)

formal holly
#

but if i have a different amount of data in my file everytiime I call my command, so let's say I have at one moment only one option but then next time 3 how could i do so that the amount of options also change (i can't seem to find a way to do so)

raven crescent
#

By using .map on the array of data from your file. That will result in one element for the first case but three elements for the second time

formal holly
#

ah ok sorry i didn't know that thanks, one lawt thing ||sorry|| do you have somewhere for the .map that could help me ?

crude turtleBOT
#

mdn Array.prototype.map()
The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.