D++ (DPP)
C++ Discord API Bot Library
|
An option for a select component. More...
#include <message.h>
Classes | |
struct | inner_select_emoji |
Emoji definition. To set an emoji on your button you must set one of either the name or id fields. The easiest way is to use the component::set_emoji method. More... | |
Public Member Functions | |
select_option () | |
Construct a new select option object. More... | |
virtual | ~select_option ()=default |
Destructs the select option object. More... | |
select_option (const std::string &label, const std::string &value, const std::string &description="") | |
Construct a new select option object. More... | |
select_option & | set_label (const std::string &l) |
Set the label. More... | |
select_option & | set_value (const std::string &v) |
Set the value. More... | |
select_option & | set_description (const std::string &d) |
Set the description. More... | |
select_option & | set_emoji (const std::string &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) |
virtual std::string | build_json (bool with_id=false) const |
Build JSON string from the object. 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... | |
struct dpp::select_option::inner_select_emoji | emoji |
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 | ( | const std::string & | label, |
const std::string & | value, | ||
const std::string & | description = "" |
||
) |
Construct a new select option object.
label | Label of option |
value | Value of option |
description | Description of option |
|
inlinevirtualinherited |
Build JSON string from the object.
with_id | Include the ID in the JSON |
select_option & dpp::select_option::fill_from_json | ( | nlohmann::json * | j | ) |
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 | ( | const std::string & | 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 | ( | const std::string & | 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 | ( | const std::string & | 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 | ( | const std::string & | v | ) |
Set the value.
v | value to set. It will be truncated to the maximum length of 100 UTF-8 characters. |
std::string dpp::select_option::description |
Additional description of the option.
struct dpp::select_option::inner_select_emoji dpp::select_option::emoji |
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.