#Select menus
11 messages · Page 1 of 1 (latest)
Sure, dynamically make the options from the data of the file
Is there a link you could recommend to read about that ?
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? …?
the setting of the options part if possible ?
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)
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)
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
ah ok sorry i didn't know that thanks, one lawt thing ||sorry|| do you have somewhere for the .map that could help me ?
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.
Interactions: Building and sending select menus