Components & Interactions
addSelectDefaultValue
$addSelectDefaultValue
$addSelectDefaultValue preselects one entry in a user, role, mentionable or channel select menu. Call it once per entry, after the function that adds the menu.
For a string select menu, use the default argument of $addStringSelectOption[].
Syntax
$addSelectDefaultValue[menuID;id;(type)]
Parameters
| Parameter | Description |
|---|---|
menuID |
Required. The custom ID of the select menu. |
id |
Required. The ID of the user, role or channel to preselect. |
type |
Optional. user, role or channel. By default the type of the menu; a mentionable menu takes user (default) or role. |
Errors
No user, role or channel select menu <menuID>.: no such menu was added before this call.This menu takes role values.: the type does not fit the menu.A select menu cannot hold more default values than its maximum.: raise themaxValuesof the menu.
Examples
Who should get the role?
$addUserSelect[who;Pick members;1;3]
$addSelectDefaultValue[who;$authorID]
$addMentionableSelect[target;Pick;1;2]
$addSelectDefaultValue[target;$authorID;user]
$addSelectDefaultValue[target;$highestRole;role]
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.