D++ (DPP)
C++ Discord API Bot Library
dpp::select_option Struct Reference

An option for a select component. More...

#include <message.h>

+ Inheritance diagram for dpp::select_option:
+ Collaboration diagram for dpp::select_option:

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_optionset_label (const std::string &l)
 Set the label. More...
 
select_optionset_value (const std::string &v)
 Set the value. More...
 
select_optionset_description (const std::string &d)
 Set the description. More...
 
select_optionset_emoji (const std::string &n, dpp::snowflake id=0, bool animated=false)
 Set the emoji. More...
 
select_optionset_default (bool def)
 Set the option as default. More...
 
select_optionset_animated (bool anim)
 Set the emoji as animated. More...
 
select_optionfill_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
 Label for option. More...
 
std::string value
 Value for option. More...
 
std::string description
 Description of option. More...
 
bool is_default
 True if option is the default option. More...
 
struct dpp::select_option::inner_select_emoji emoji
 

Detailed Description

An option for a select component.

Constructor & Destructor Documentation

◆ select_option() [1/2]

dpp::select_option::select_option ( )

Construct a new select option object.

◆ ~select_option()

virtual dpp::select_option::~select_option ( )
virtualdefault

Destructs the select option object.

◆ select_option() [2/2]

dpp::select_option::select_option ( const std::string &  label,
const std::string &  value,
const std::string &  description = "" 
)

Construct a new select option object.

Parameters
labelLabel of option
valueValue of option
descriptionDescription of option

Member Function Documentation

◆ build_json()

virtual std::string dpp::json_interface< select_option >::build_json ( bool  with_id = false) const
inlinevirtualinherited

Build JSON string from the object.

Parameters
with_idInclude the ID in the JSON
Returns
std::string JSON string version of object

◆ fill_from_json()

select_option & dpp::select_option::fill_from_json ( nlohmann::json *  j)

Read class values from json object

Parameters
jA json object to read from
Returns
A reference to self

◆ set_animated()

select_option & dpp::select_option::set_animated ( bool  anim)

Set the emoji as animated.

Parameters
animtrue if animated
Returns
select_option& reference to self for chaining

◆ set_default()

select_option & dpp::select_option::set_default ( bool  def)

Set the option as default.

Parameters
deftrue to set the option as default
Returns
select_option& reference to self for chaining

◆ set_description()

select_option & dpp::select_option::set_description ( const std::string &  d)

Set the description.

Parameters
ddescription to set. It will be truncated to the maximum length of 100 UTF-8 characters.
Returns
select_option& reference to self for chaining

◆ set_emoji()

select_option & dpp::select_option::set_emoji ( const std::string &  n,
dpp::snowflake  id = 0,
bool  animated = false 
)

Set the emoji.

Parameters
nemoji name
idemoji id for custom emojis
animatedtrue if animated emoji
Returns
select_option& reference to self for chaining

◆ set_label()

select_option & dpp::select_option::set_label ( const std::string &  l)

Set the label.

Parameters
lthe user-facing name of the option. It will be truncated to the maximum length of 100 UTF-8 characters.
Returns
select_option& reference to self for chaining

◆ set_value()

select_option & dpp::select_option::set_value ( const std::string &  v)

Set the value.

Parameters
vvalue to set. It will be truncated to the maximum length of 100 UTF-8 characters.
Returns
select_option& reference to self for chaining

Member Data Documentation

◆ description

std::string dpp::select_option::description

Description of option.

◆ emoji

struct dpp::select_option::inner_select_emoji dpp::select_option::emoji

◆ is_default

bool dpp::select_option::is_default

True if option is the default option.

◆ label

std::string dpp::select_option::label

Label for option.

◆ value

std::string dpp::select_option::value

Value for option.

D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0