I'm working with slashed command, and I want to add autocomplete on arguments.
I created class named "AutoCompleteHandlerGeneral" derived from "AutocompleteHandler", and add an override on "GenerateSuggestionsAsync function".
I create a slashed command with argument like that "[Discord.Commands.Summary("nom_du_paramètre"), Autocomplete(typeof(AutoCompleteHandlerGeneral))]"
I add to the interaction handler this 2 functions :
private async Task AutocompleteExecuted(SocketAutocompleteInteraction interaction)
{
var context = new SocketInteractionContext(_client, interaction);
_interactionService.
await _interactionService.ExecuteCommandAsync(context, services: _serviceProvider);
}
private async Task InteractionCreated(SocketInteraction interaction)
{
if (interaction.Type == InteractionType.ApplicationCommandAutocomplete)
{
var context = new SocketInteractionContext(_client, interaction);
await _interactionService.ExecuteCommandAsync(context, services: _serviceProvider);
}
}
During execution, autocomplete window is opening in discord, but stay empty and display "Loading options failed". The 2 functions are called, but the execute commandasync seems to be call ... nothing ...
To help problem solving, I created a public simple bot on github to test it ... AutoCompleteBot ... But proposition window stay empty ....
Please help ! Thanks a lot