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

A rich embed for display within a dpp::message. More...

+ Collaboration diagram for dpp::embed:

Public Member Functions

 embed ()
 Constructor. More...
 
 embed (nlohmann::json *j)
 Constructor to build embed from json object. More...
 
 ~embed ()
 Destructor. More...
 
embedset_title (std::string_view text)
 Set embed title. More...
 
embedset_description (std::string_view text)
 Set embed description. More...
 
embedset_footer (const embed_footer &f)
 Set the footer of the embed. More...
 
embedset_footer (std::string_view text, std::string_view icon_url)
 Set the footer of the embed. More...
 
embedset_color (uint32_t col)
 Set embed colour. More...
 
embedset_colour (uint32_t col)
 Set embed colour. More...
 
embedset_timestamp (time_t tstamp)
 Set embed timestamp. More...
 
embedset_url (std::string_view url)
 Set embed url. More...
 
embedadd_field (std::string_view name, std::string_view value, bool is_inline=false)
 Add an embed field. More...
 
embedset_author (const dpp::embed_author &a)
 Set embed author. More...
 
embedset_author (std::string_view name, std::string_view url, std::string_view icon_url)
 Set embed author. More...
 
embedset_provider (std::string_view name, std::string_view url)
 Set embed provider. More...
 
embedset_image (std::string_view url)
 Set embed image. More...
 
embedset_video (std::string_view url)
 Set embed video. More...
 
embedset_thumbnail (std::string_view url)
 Set embed thumbnail. More...
 

Public Attributes

std::string title
 Optional: Title of embed. More...
 
std::string type
 Optional: Type of embed. More...
 
std::string description
 Optional: Description of embed. More...
 
std::string url
 Optional: URL of embed. More...
 
time_t timestamp
 Optional: Timestamp of embed content. More...
 
std::optional< uint32_t > color
 Optional: Color code of the embed. More...
 
std::optional< embed_footerfooter
 Optional: Footer information. More...
 
std::optional< embed_imageimage
 Optional: Image information. More...
 
std::optional< embed_imagethumbnail
 Optional: Thumbnail information. More...
 
std::optional< embed_imagevideo
 Optional: Video information. More...
 
std::optional< embed_providerprovider
 Optional: Provider information. More...
 
std::optional< embed_authorauthor
 Optional: Author information. More...
 
std::vector< embed_fieldfields
 Optional: Fields information. More...
 

Detailed Description

A rich embed for display within a dpp::message.

Constructor & Destructor Documentation

◆ embed() [1/2]

dpp::embed::embed ( )

Constructor.

◆ embed() [2/2]

dpp::embed::embed ( nlohmann::json *  j)

Constructor to build embed from json object.

Parameters
jJSON to read content from

◆ ~embed()

dpp::embed::~embed ( )

Destructor.

Member Function Documentation

◆ add_field()

embed& dpp::embed::add_field ( std::string_view  name,
std::string_view  value,
bool  is_inline = false 
)

Add an embed field.

Parameters
nameThe name of the field. It will be truncated to the maximum length of 256 UTF-8 characters.
valueThe value of the field. It will be truncated to the maximum length of 1024 UTF-8 characters.
is_inlineWhether or not to display the field 'inline' or on its own line
Returns
A reference to self so this method may be "chained".

◆ set_author() [1/2]

embed& dpp::embed::set_author ( const dpp::embed_author a)

Set embed author.

Parameters
aThe author to set
Returns
A reference to self so this method may be "chained".

◆ set_author() [2/2]

embed& dpp::embed::set_author ( std::string_view  name,
std::string_view  url,
std::string_view  icon_url 
)

Set embed author.

Parameters
nameThe name of the author. It will be truncated to the maximum length of 256 UTF-8 characters.
urlThe url of the author (only supports http(s))
icon_urlThe icon URL of the author (only supports http(s) and attachments)
Returns
A reference to self so this method may be "chained".

◆ set_color()

embed& dpp::embed::set_color ( uint32_t  col)

Set embed colour.

Parameters
colThe colour of the embed
Returns
A reference to self so this method may be "chained".

◆ set_colour()

embed& dpp::embed::set_colour ( uint32_t  col)

Set embed colour.

Parameters
colThe colour of the embed
Returns
A reference to self so this method may be "chained".

◆ set_description()

embed& dpp::embed::set_description ( std::string_view  text)

Set embed description.

Parameters
textThe text of the title. It will be truncated to the maximum length of 4096 UTF-8 characters.
Returns
A reference to self so this method may be "chained".

◆ set_footer() [1/2]

embed& dpp::embed::set_footer ( const embed_footer f)

Set the footer of the embed.

Parameters
fthe footer to set
Returns
A reference to self so this method may be "chained".

◆ set_footer() [2/2]

embed& dpp::embed::set_footer ( std::string_view  text,
std::string_view  icon_url 
)

Set the footer of the embed.

Parameters
textstring to set as footer text. It will be truncated to the maximum length of 2048 UTF-8 characters.
icon_urlan url to set as footer icon url (only supports http(s) and attachments)
Returns
A reference to self so this method may be "chained".

◆ set_image()

embed& dpp::embed::set_image ( std::string_view  url)

Set embed image.

Parameters
urlThe embed image URL (only supports http(s) and attachments)
Returns
A reference to self so this method may be "chained".

◆ set_provider()

embed& dpp::embed::set_provider ( std::string_view  name,
std::string_view  url 
)

Set embed provider.

Parameters
nameThe provider name. It will be truncated to the maximum length of 256 UTF-8 characters.
urlThe provider url
Returns
A reference to self so this method may be "chained".

◆ set_thumbnail()

embed& dpp::embed::set_thumbnail ( std::string_view  url)

Set embed thumbnail.

Parameters
urlThe embed thumbnail url (only supports http(s) and attachments)
Returns
A reference to self so this method may be "chained".

◆ set_timestamp()

embed& dpp::embed::set_timestamp ( time_t  tstamp)

Set embed timestamp.

Parameters
tstampThe timestamp to show in the footer, should be in UTC
Returns
A reference to self so this method may be "chained".

◆ set_title()

embed& dpp::embed::set_title ( std::string_view  text)

Set embed title.

Parameters
textThe text of the title. It will be truncated to the maximum length of 256 UTF-8 characters.
Returns
A reference to self so this method may be "chained".

◆ set_url()

embed& dpp::embed::set_url ( std::string_view  url)

Set embed url.

Parameters
urlthe url of the embed
Returns
A reference to self so this method may be "chained".

◆ set_video()

embed& dpp::embed::set_video ( std::string_view  url)

Set embed video.

Parameters
urlThe embed video url
Returns
A reference to self so this method may be "chained".

Member Data Documentation

◆ author

std::optional<embed_author> dpp::embed::author

Optional: Author information.

◆ color

std::optional<uint32_t> dpp::embed::color

Optional: Color code of the embed.

◆ description

std::string dpp::embed::description

Optional: Description of embed.

◆ fields

std::vector<embed_field> dpp::embed::fields

Optional: Fields information.

◆ footer

std::optional<embed_footer> dpp::embed::footer

Optional: Footer information.

◆ image

std::optional<embed_image> dpp::embed::image

Optional: Image information.

◆ provider

std::optional<embed_provider> dpp::embed::provider

Optional: Provider information.

Warning
Can't send this.

◆ thumbnail

std::optional<embed_image> dpp::embed::thumbnail

Optional: Thumbnail information.

◆ timestamp

time_t dpp::embed::timestamp

Optional: Timestamp of embed content.

◆ title

std::string dpp::embed::title

Optional: Title of embed.

◆ type

std::string dpp::embed::type

Optional: Type of embed.

Note
Always "rich" for webhook embeds.

◆ url

std::string dpp::embed::url

Optional: URL of embed.

◆ video

std::optional<embed_image> dpp::embed::video

Optional: Video information.

Warning
Can't send this.
D++ 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