select() declares a select menu, from any file of src/; the name of its export is its id. It takes one object, SelectConfig, and types values in run from it.
src/components/color.ts
How to write a menu and show it is in the guide. This page lists what exists. What a menu shares with a button (
data, where, who, the place) is on the button() page.select()
src/: the name of the export is what tells the menu apart, so you never write an id.
SelectDeclaration
Whatselect() returns: a declaration the framework finds in the exports of a file. Import it where you send a message, and call it with the data it carries; a menu without data is used as is, or called with what to show.
SelectConfig
What a select file gives toselect(): a menu of texts, or of things of the server.
What to do when something is picked. Leave it out for a menu that is only waited for (
message.waitForClick()).StringSelectConfig
A menu of texts you declare.The options (25 at most): a list of texts, an object from what is shown to what your code receives, or a list of
RichOption.EntitySelectConfig
A menu of users, roles, users and roles, or channels of the server.SelectType, EntitySelectType
SelectLook
What a select menu looks like.The text shown when nothing is picked (150 characters at most): written as is, or a function of
t and the data, run when the message is sent. See DynamicText.SelectInstanceOptions
What a message can change when it shows a menu: everything ofSelectLook, plus:
What is picked when the menu appears: the values of the options for a menu of texts, the ids (or the things themselves) for the others.
Options
SelectOptions
RichOption for descriptions and emojis. The same type serves the select, radio and checkboxes fields of a form.
RichOption
One option of a menu, with everything Discord shows for it.What the person sees (100 characters at most): a text, or a function of
t and the data.A second line under the label (100 characters at most): a text, or a function of
t and the data.OptionValue
run receives for one picked option, typed from the declaration: the union of the texts of a list, of the values of an object, or of the value of each RichOption.
Discord documentation
SelectContext
Whatrun receives when something is picked: everything of InteractiveContext, the place as PlaceOf gives it with a ComponentInteraction, and:
Picked is OptionValue<Options> for a menu of texts, User for 'user', Role for 'role', User | Role for 'mentionable' and Channel for 'channel'.