D++ (DPP)
C++ Discord API Bot Library
|
Each command option is a command line parameter. It can have a type (see dpp::command_option_type), a name, a description, can be required or optional, and can have zero or more choices (for multiple choice), plus options. Adding options acts like sub-commands and can contain more options. More...
#include <appcommand.h>
Public Member Functions | |
command_option ()=default | |
Construct a new command option object. More... | |
command_option (command_option_type t, const std::string &name, const std::string &description, bool required=false) | |
Construct a new command option object. More... | |
command_option & | add_choice (const command_option_choice &o) |
Add a multiple choice option. More... | |
command_option & | set_min_value (command_option_range min_v) |
Set the minimum numeric value of the option. Only valid if the type is co_number or co_integer. More... | |
command_option & | set_max_value (command_option_range max_v) |
Set the maximum numeric value of the option. Only valid if the type is co_number or co_integer. More... | |
command_option & | add_option (const command_option &o) |
Add a sub-command option. More... | |
command_option & | add_channel_type (const channel_type ch) |
Add channel type for option (only for co_channel type options) More... | |
command_option & | set_auto_complete (bool autocomp) |
Set the auto complete state. More... | |
Public Attributes | |
command_option_type | type |
Option type (what type of value is accepted) More... | |
std::string | name |
Option name (1-32 chars) More... | |
std::string | description |
Option description (1-100 chars) More... | |
bool | required |
True if this is a mandatory parameter. More... | |
bool | focused |
True if the user is typing in this field, when sent via autocomplete. More... | |
command_value | value |
Set only by autocomplete went sent as part of an interaction. More... | |
std::vector< command_option_choice > | choices |
List of choices for multiple choice command. More... | |
bool | autocomplete |
True if this option supports auto completion. More... | |
std::vector< command_option > | options |
Sub-commands. More... | |
std::vector< channel_type > | channel_types |
Allowed channel types for channel snowflake id options. More... | |
command_option_range | min_value |
Minimum value allowed, for co_number and co_integer types only. More... | |
command_option_range | max_value |
Maximum value allowed, for co_number and co_integer types only. More... | |
Each command option is a command line parameter. It can have a type (see dpp::command_option_type), a name, a description, can be required or optional, and can have zero or more choices (for multiple choice), plus options. Adding options acts like sub-commands and can contain more options.
|
default |
Construct a new command option object.
dpp::command_option::command_option | ( | command_option_type | t, |
const std::string & | name, | ||
const std::string & | description, | ||
bool | required = false |
||
) |
Construct a new command option object.
t | Option type |
name | Option name |
description | Option description |
required | True if this is a mandatory parameter |
command_option & dpp::command_option::add_channel_type | ( | const channel_type | ch | ) |
Add channel type for option (only for co_channel type options)
ch | type to set |
command_option & dpp::command_option::add_choice | ( | const command_option_choice & | o | ) |
Add a multiple choice option.
o | choice to add |
dpp::exception | command_option is an autocomplete, so choices cannot be added |
command_option & dpp::command_option::add_option | ( | const command_option & | o | ) |
Add a sub-command option.
o | Sub-command option to add |
command_option & dpp::command_option::set_auto_complete | ( | bool | autocomp | ) |
Set the auto complete state.
autocomp | True to enable auto completion for this option |
dpp::exception | You attempted to enable auto complete on a command_option that has choices added to it |
command_option & dpp::command_option::set_max_value | ( | command_option_range | max_v | ) |
Set the maximum numeric value of the option. Only valid if the type is co_number or co_integer.
max_v | Maximum value |
command_option & dpp::command_option::set_min_value | ( | command_option_range | min_v | ) |
Set the minimum numeric value of the option. Only valid if the type is co_number or co_integer.
min_v | Minimum value |
bool dpp::command_option::autocomplete |
True if this option supports auto completion.
std::vector<channel_type> dpp::command_option::channel_types |
Allowed channel types for channel snowflake id options.
std::vector<command_option_choice> dpp::command_option::choices |
List of choices for multiple choice command.
std::string dpp::command_option::description |
Option description (1-100 chars)
bool dpp::command_option::focused |
True if the user is typing in this field, when sent via autocomplete.
command_option_range dpp::command_option::max_value |
Maximum value allowed, for co_number and co_integer types only.
command_option_range dpp::command_option::min_value |
Minimum value allowed, for co_number and co_integer types only.
std::string dpp::command_option::name |
Option name (1-32 chars)
std::vector<command_option> dpp::command_option::options |
Sub-commands.
bool dpp::command_option::required |
True if this is a mandatory parameter.
command_option_type dpp::command_option::type |
Option type (what type of value is accepted)
command_value dpp::command_option::value |
Set only by autocomplete went sent as part of an interaction.