D++ (DPP)
C++ Discord API Bot Library
|
An option for a select component. More...
#include <message.h>
Public Member Functions | |
select_option () | |
Construct a new select option object. More... | |
virtual | ~select_option ()=default |
Destructs the select option object. More... | |
select_option (std::string_view label, std::string_view value, std::string_view description="") | |
Construct a new select option object. More... | |
select_option & | set_label (std::string_view l) |
Set the label. More... | |
select_option & | set_value (std::string_view v) |
Set the value. More... | |
select_option & | set_description (std::string_view d) |
Set the description. More... | |
select_option & | set_emoji (std::string_view n, dpp::snowflake id=0, bool animated=false) |
Set the emoji. More... | |
select_option & | set_default (bool def) |
Set the option as default. More... | |
select_option & | set_animated (bool anim) |
Set the emoji as animated. More... | |
select_option & | fill_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
auto | to_json (bool with_id=false) const |
Convert object to nlohmann::json. More... | |
std::string | build_json (bool with_id=false) const |
Convert object to json string. More... | |
Public Attributes | |
std::string | label |
User-facing name of the option. More... | |
std::string | value |
Dev-defined value of the option. More... | |
std::string | description |
Additional description of the option. More... | |
bool | is_default |
True if option is the default option. More... | |
partial_emoji | emoji |
The emoji for the select option. More... | |
Protected Member Functions | |
select_option & | fill_from_json_impl (nlohmann::json *j) |
Friends | |
struct | json_interface< select_option > |
An option for a select component.
dpp::select_option::select_option | ( | ) |
Construct a new select option object.
|
virtualdefault |
Destructs the select option object.
dpp::select_option::select_option | ( | std::string_view | label, |
std::string_view | value, | ||
std::string_view | description = "" |
||
) |
Construct a new select option object.
label | Label of option |
value | Value of option |
description | Description of option |
|
inlineinherited |
Convert object to json string.
with_id | Whether to include the ID or not |
|
inlineinherited |
Convert object from nlohmann::json.
j | nlohmann::json object |
|
protected |
Read class values from json object
j | A json object to read from |
select_option & dpp::select_option::set_animated | ( | bool | anim | ) |
Set the emoji as animated.
anim | true if animated |
select_option & dpp::select_option::set_default | ( | bool | def | ) |
Set the option as default.
def | true to set the option as default |
select_option & dpp::select_option::set_description | ( | std::string_view | d | ) |
Set the description.
d | description to set. It will be truncated to the maximum length of 100 UTF-8 characters. |
select_option & dpp::select_option::set_emoji | ( | std::string_view | n, |
dpp::snowflake | id = 0 , |
||
bool | animated = false |
||
) |
Set the emoji.
n | emoji name |
id | emoji id for custom emojis |
animated | true if animated emoji |
select_option & dpp::select_option::set_label | ( | std::string_view | l | ) |
Set the label.
l | the user-facing name of the option. It will be truncated to the maximum length of 100 UTF-8 characters. |
select_option & dpp::select_option::set_value | ( | std::string_view | v | ) |
Set the value.
v | value to set. It will be truncated to the maximum length of 100 UTF-8 characters. |
|
inlineinherited |
Convert object to nlohmann::json.
with_id | Whether to include the ID or not |
|
friend |
std::string dpp::select_option::description |
Additional description of the option.
partial_emoji dpp::select_option::emoji |
The emoji for the select option.
bool dpp::select_option::is_default |
True if option is the default option.
std::string dpp::select_option::label |
User-facing name of the option.
std::string dpp::select_option::value |
Dev-defined value of the option.