select
select<
T,O>(type,config,run):Select<T, [O] extends [never] ?SelectValue[T] :O[keyofO]>
Defined in: select.ts:42
Declares a select menu and the handler that runs when the user picks from it. Put it in the
selects of a message, such as c.reply('Pick one', { selects: [menu] }), and in the selects of
bot so the bot gets the pick. Each menu takes a row of its own, above the buttons.
A string menu lists options, keyed by the label Discord shows, and the handler gets the picked
values. A user, role, channel or mentionable menu lets the user pick from the server, and
the handler gets the full objects Discord resolved. A channel menu takes channelTypes.
Type Parameters
Section titled “Type Parameters”T extends SelectType
O extends Record<string, T extends "string" ? string : never> = never
Parameters
Section titled “Parameters”T
What the user picks from.
config
Section titled “config”SelectConfig<T, O>
How Discord shows the menu.
(c) => Response | Promise<Response>
Answers the pick. c.values holds the picked items.
Returns
Section titled “Returns”Select<T, [O] extends [never] ? SelectValue[T] : O[keyof O]>
The select menu.
Example
Section titled “Example”const fruit = select('string', { id: 'fruit', options: { Apple: 'apple', Mango: 'mango' } }, (c) => c.update(`picked ${c.values.join(', ')}`),);