79185342

Date: 2024-11-13 14:30:47
Score: 4.5
Natty:
Report link

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

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • RegEx Blacklisted phrase (3): Please help
  • RegEx Blacklisted phrase (1): I want
  • Contains signature (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: xNiux