Discord now supports sending auto completion lists for slash command choices. To use this feature you can use code such as the example below:
#include <dpp/dpp.h>
 
int main()
{
 
        
            .set_description("Send a random adorable animal photo")
            .set_application_id(bot.me.id)
                
            )
        );
    });
 
    
            dpp::command_interaction cmd_data = std::get<dpp::command_interaction>(event.command.data);
            
            if (cmd_data.name == "blep") {
                
                std::string animal = std::get<std::string>(event.get_parameter("animal"));
                
                event.reply(dpp::ir_channel_message_with_source, "Blep! You chose " + animal);
            }
        }
    });
 
    
            
            if (opt.focused) {
                
                std::string uservalue = std::get<std::string>(opt.value);
                bot.interaction_response_create(event.command.id, event.command.token, dpp::interaction_response(dpp::ir_autocomplete_reply)
                    .add_autocomplete_choice(dpp::command_option_choice("squids", "lots of squids"))
                    .add_autocomplete_choice(dpp::command_option_choice("cats", "a few cats"))
                    .add_autocomplete_choice(dpp::command_option_choice("dogs", "bucket of dogs"))
                    .add_autocomplete_choice(dpp::command_option_choice("elephants", "bottle of elephants"))
                );
                bot.log(dpp::ll_debug, "Autocomplete " + opt.name + " with value '" + uservalue + "' in field " + event.name);
                break;
            }
        }
    });
 
    
    });
 
    bot.start(false);
 
    return 0;
}
The cluster class represents a group of shards and a command queue for sending and receiving commands...
Definition: cluster.h:384
 
uint8_t type
the type of interaction
Definition: appcommand.h:563
 
Represents an application command, created by your bot either globally, or on a guild.
Definition: appcommand.h:679
 
slashcommand & add_option(const command_option &o)
Add an option (parameter)
 
std::string DPP_EXPORT loglevel(dpp::loglevel in)
Convert a dpp::loglevel enum value to a string.
 
@ it_application_command
application command (slash command)
Definition: appcommand.h:459
 
@ co_string
Definition: appcommand.h:47
 
Discord requests that we fill a list of auto completion choices for a command option.
Definition: dispatcher.h:409
 
std::vector< dpp::command_option > options
auto completion options
Definition: dispatcher.h:438
 
Each command option is a command line parameter. It can have a type (see dpp::command_option_type),...
Definition: appcommand.h:121
 
command_option & set_auto_complete(bool autocomp)
Set the auto complete state.
 
Create interaction.
Definition: dispatcher.h:259
 
interaction command
command interaction
Definition: dispatcher.h:351
 
Log messages.
Definition: dispatcher.h:92
 
loglevel severity
Definition: dispatcher.h:100
 
Session ready.
Definition: dispatcher.h:552