diff --git a/docs/guides/int_framework/samples/intro/autocomplete.cs b/docs/guides/int_framework/samples/intro/autocomplete.cs index f93c56eaa..8327d4e60 100644 --- a/docs/guides/int_framework/samples/intro/autocomplete.cs +++ b/docs/guides/int_framework/samples/intro/autocomplete.cs @@ -1,9 +1,17 @@ [AutocompleteCommand("parameter_name", "command_name")] public async Task Autocomplete() { - IEnumerable results; + IEnumerable results = new[] + { + new AutocompleteResult("Name1", "value1"), + new AutocompleteResult("Name2", "value2") + }; - ... - - await (Context.Interaction as SocketAutocompleteInteraction).RespondAsync(results); + // max - 25 suggestions at a time + await (Context.Interaction as SocketAutocompleteInteraction).RespondAsync(results.Take(25)); } + +// you need to add `Autocomplete` attribute before parameter to add autocompletion to it +[SlashCommand("command_name", "command_description")] +public async Task ExampleCommand([Summary("parameter_name"), Autocomplete] string parameterWithAutocompletion) + => await RespondAsync($"Your choice: {parameterWithAutocompletion}"); \ No newline at end of file