diff --git a/docs/guides/int_framework/samples/intro/autocomplete.cs b/docs/guides/int_framework/samples/intro/autocomplete.cs index 8327d4e60..32ba55462 100644 --- a/docs/guides/int_framework/samples/intro/autocomplete.cs +++ b/docs/guides/int_framework/samples/intro/autocomplete.cs @@ -1,13 +1,16 @@ [AutocompleteCommand("parameter_name", "command_name")] public async Task Autocomplete() { - IEnumerable results = new[] - { - new AutocompleteResult("Name1", "value1"), - new AutocompleteResult("Name2", "value2") - }; + string userInput = (Context.Interaction as SocketAutocompleteInteraction).Data.Current.Value.ToString(); - // max - 25 suggestions at a time + IEnumerable results = new[] + { + new AutocompleteResult("foo", "foo_value"), + new AutocompleteResult("bar", "bar_value"), + new AutocompleteResult("baz", "baz_value"), + }.Where(x => x.Name.StartsWith(userInput)); // only send suggestions that start with user's input + + // max - 25 suggestions at a time await (Context.Interaction as SocketAutocompleteInteraction).RespondAsync(results.Take(25)); }