Browse Source

added case insensetive matching; mentioned that 25 suggestions is an API limit

pull/2288/head
Misha133 3 years ago
parent
commit
f9a5526748
2 changed files with 3 additions and 2 deletions
  1. +1
    -1
      docs/guides/int_framework/samples/autocompletion/autocomplete-example.cs
  2. +2
    -1
      docs/guides/int_framework/samples/intro/autocomplete.cs

+ 1
- 1
docs/guides/int_framework/samples/autocompletion/autocomplete-example.cs View File

@@ -14,7 +14,7 @@ public class ExampleAutocompleteHandler : AutocompleteHandler
new AutocompleteResult("Name2", "value2")
};

// max - 25 suggestions at a time
// max - 25 suggestions at a time (API limit)
return AutocompletionResult.FromSuccess(results.Take(25));
}
}

+ 2
- 1
docs/guides/int_framework/samples/intro/autocomplete.cs View File

@@ -8,7 +8,8 @@ public async Task Autocomplete()
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
}.Where(x => x.Name.StartsWith(userInput, StringComparison.InvariantCultureIgnoreCase)); // only send suggestions that starts with user's input; use case insensitive matching


// max - 25 suggestions at a time
await (Context.Interaction as SocketAutocompleteInteraction).RespondAsync(results.Take(25));


Loading…
Cancel
Save