diff --git a/docs/guides/int_framework/autocompletion.md b/docs/guides/int_framework/autocompletion.md index 35b4858914..6c5eefddc0 100644 --- a/docs/guides/int_framework/autocompletion.md +++ b/docs/guides/int_framework/autocompletion.md @@ -20,6 +20,10 @@ A valid AutocompleteHandlers must inherit [AutocompleteHandler] base type and im [!code-csharp[Autocomplete Command Example](samples/autocompletion/autocomplete-example.cs)] +In order for Autocompletehandlers to work you must register a AutocompleteExecuted method with your DiscordSocketClient + +[!code-csharp[RegisterAutocompleteExecuted](samples/autocompletion/exampleRegisterAutocompletion.cs)] + ### GenerateSuggestionsAsync() The Interactions Service uses this method to generate a response of an Autocomplete Interaction. diff --git a/docs/guides/int_framework/samples/autocompletion/exampleRegisterAutocompletion.cs b/docs/guides/int_framework/samples/autocompletion/exampleRegisterAutocompletion.cs new file mode 100644 index 0000000000..bc1dc94705 --- /dev/null +++ b/docs/guides/int_framework/samples/autocompletion/exampleRegisterAutocompletion.cs @@ -0,0 +1,6 @@ +_client.AutocompleteExecuted += HandleAutocompleteExecution; + +private static async Task HandleAutocompleteExecution(SocketAutocompleteInteraction arg){ + var context = new InteractionContext(_client, arg, arg.Channel); + await _interactionService.ExecuteCommandAsync(context, null); +}