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

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

#include "message.h"

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...
 
embedadd_field (const std::string &name, const std::string &value, bool is_inline=false)
 Add an embed field. More...
 
embedset_author (const dpp::embed_author &a)
 Set embed author. More...
 
embedset_author (const std::string &name, const std::string &url, const std::string &icon_url)
 Set embed author. More...
 
embedset_color (uint32_t col)
 Set embed colour. More...
 
embedset_colour (uint32_t col)
 Set embed colour. More...
 
embedset_description (const std::string &text)
 Set embed description. More...
 
embedset_footer (const embed_footer &f)
 Set the footer of the embed. More...
 
embedset_footer (const std::string &text, const std::string &icon_url)
 Set the footer of the embed. More...
 
embedset_image (const std::string &url)
 Set embed image. More...
 
embedset_provider (const std::string &name, const std::string &url)
 Set embed provider. More...
 
embedset_thumbnail (const std::string &url)
 Set embed thumbnail. More...
 
embedset_timestamp (time_t tstamp)
 Set embed timestamp. More...
 
embedset_title (const std::string &text)
 Set embed title. More...
 
embedset_url (const std::string &url)
 Set embed url. More...
 
embedset_video (const std::string &url)
 Set embed video. More...
 

Public Attributes

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

Detailed Description

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

Constructor & Destructor Documentation

◆ embed() [1/2]

dpp::embed::embed ( )

Constructor.

References dpp::unicode_emoji::o.

◆ embed() [2/2]

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

Constructor to build embed from json object.

Parameters
jJSON to read content from

References dpp::embed_image::height, dpp::embed_image::proxy_url, dpp::string_not_null(), dpp::embed_image::url, and dpp::embed_image::width.

Here is the call graph for this function:

◆ ~embed()

dpp::embed::~embed ( )
default

Destructor.

Member Function Documentation

◆ add_field()

embed & dpp::embed::add_field ( const std::string &  name,
const std::string &  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 ( const std::string &  name,
const std::string &  url,
const std::string &  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".

References dpp::embed_footer::icon_url.

◆ 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".

References dpp::embed_footer::proxy_url.

◆ set_description()

embed & dpp::embed::set_description ( const std::string &  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".

References dpp::embed_footer::text, and dpp::utility::utf8substr().

Here is the call graph for this function:

◆ 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 ( const std::string &  text,
const std::string &  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 ( const std::string &  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 ( const std::string &  name,
const std::string &  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 ( const std::string &  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".

References footer, dpp::embed_footer::set_icon(), and dpp::embed_footer::set_text().

Here is the call graph for this function:

◆ set_title()

embed & dpp::embed::set_title ( const std::string &  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".

References url.

◆ set_url()

embed & dpp::embed::set_url ( const std::string &  url)

Set embed url.

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

References dpp::reaction::count, dpp::reaction::count_burst, and dpp::reaction::count_normal.

◆ set_video()

embed & dpp::embed::set_video ( const std::string &  url)

Set embed video.

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

References description, and dpp::utility::utf8substr().

Here is the call graph for this function:

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.

Referenced by set_video().

◆ fields

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

Optional: Fields information.

◆ footer

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

Optional: Footer information.

Referenced by set_timestamp().

◆ 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.

Referenced by set_title().

◆ video

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

Optional: Video information.

Warning
Can't send this.

The documentation for this struct was generated from the following files: