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 <slashcommand.h>
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.
◆ command_option() [1/2]
dpp::command_option::command_option |
( |
| ) |
|
|
default |
Construct a new command option object.
◆ command_option() [2/2]
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.
- Parameters
-
t | Option type |
name | Option name |
description | Option description |
required | True if this is a mandatory parameter |
◆ add_channel_type()
Add channel type for option (only for co_channel type options)
- Parameters
-
- Returns
- command_option& return a reference to self for chaining of calls
◆ add_choice()
Add a multiple choice option.
- Parameters
-
- Returns
- command_option& returns a reference to self for chaining of calls
- Exceptions
-
◆ add_option()
Add a sub-command option.
- Parameters
-
o | Sub-command option to add |
- Returns
- command_option& return a reference to self for chaining of calls
◆ set_auto_complete()
command_option & dpp::command_option::set_auto_complete |
( |
bool |
autocomp | ) |
|
Set the auto complete state.
- Parameters
-
autocomp | True to enable auto completion for this option |
- Returns
- command_option& return a reference to self for chaining of calls
- Exceptions
-
◆ set_max_value()
Set the maximum numeric value of the option. Only valid if the type is co_number or co_integer.
- Parameters
-
- Returns
- command_option& return a reference to sef for chaining of calls
◆ set_min_value()
Set the minimum numeric value of the option. Only valid if the type is co_number or co_integer.
- Parameters
-
- Returns
- command_option& return a reference to sef for chaining of calls
◆ autocomplete
bool dpp::command_option::autocomplete |
True if this option supports auto completion.
◆ channel_types
std::vector<channel_type> dpp::command_option::channel_types |
Allowed channel types for channel snowflake id options.
◆ choices
List of choices for multiple choice command.
◆ description
std::string dpp::command_option::description |
Option description (1-100 chars)
◆ focused
bool dpp::command_option::focused |
True if the user is typing in this field, when sent via autocomplete.
◆ max_value
Maximum value allowed, for co_number and co_integer types only.
◆ min_value
Minimum value allowed, for co_number and co_integer types only.
◆ name
std::string dpp::command_option::name |
◆ options
◆ required
bool dpp::command_option::required |
True if this is a mandatory parameter.
◆ type
Option type (what type of value is accepted)
◆ value
Set only by autocomplete went sent as part of an interaction.