You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guide/slash-commands/autocomplete.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,7 @@ The <DocsLink path="AutocompleteInteraction:Class"/> class provides the <DocsLin
97
97
Unlike static choices, autocompletion suggestions are *not* enforced, and users may still enter free text.
98
98
:::
99
99
100
-
The <DocsLinkpath="CommandInteractionOptionResolver:Class#getFocused"type="method"/> method returns the currently focused option's value, which can be used to apply filtering to the choices presented. For example, to only display options starting with the focused value you can use the `Array#filter()` method, then using `Array#map()`, you can transform the array into an array of <DocsLinkpath="ApplicationCommandOptionChoiceData:Interface" /> objects.
100
+
The <DocsLinkpath="CommandInteractionOptionResolver:Class#getFocused"type="method"/> method returns the currently focused option, which can be used to apply filtering to the choices presented. For example, to only display options starting with the focused value, you can use the `Array#filter()` method. Then, using `Array#map()`, you can transform the array into an array of <DocsLinkpath="ApplicationCommandOptionChoiceData:Interface" /> objects.
To distinguish between multiple options, you can pass `true` into <DocsLinkpath="CommandInteractionOptionResolver:Class#getFocused"type="method"/>, which will now return the full focused object instead of just the value. This is used to get the name of the focused option below, allowing for multiple options to each have their own set of suggestions:
124
+
By making use of `name`, you can distinguish between multiple options and provide different suggestions for each:
0 commit comments