D++ (DPP)
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 ()
 
 embed (nlohmann::json *j)
 
 ~embed ()
 
embedset_title (const std::string &text)
 
embedset_description (const std::string &text)
 
embedset_footer (const embed_footer &f)
 Set the footer of the embed. More...
 
embedset_color (uint32_t col)
 
embedset_timestamp (time_t tstamp)
 
embedset_url (const std::string &url)
 
embedadd_field (const std::string &name, const std::string &value, bool is_inline=false)
 
embedset_author (const dpp::embed_author &a)
 
embedset_author (const std::string &name, const std::string &url, const std::string &icon_url)
 
embedset_provider (const std::string &name, const std::string &url)
 
embedset_image (const std::string &url)
 
embedset_video (const std::string &url)
 
embedset_thumbnail (const std::string &url)
 

Public Attributes

std::string title
 
std::string type
 
std::string description
 
std::string url
 
time_t timestamp
 
uint32_t color
 
std::optional< embed_footerfooter
 
std::optional< embed_imageimage
 
std::optional< embed_imagethumbnail
 
std::optional< embed_imagevideo
 
std::optional< embed_providerprovider
 
std::optional< embed_authorauthor
 
std::vector< embed_fieldfields
 

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 ( const std::string &  name,
const std::string &  value,
bool  is_inline = false 
)

Add an embed field. Returns the embed itself so these method calls may be "chained"

Parameters
nameThe name of the field
valueThe value of the field (max length 1000)
is_inlineWhether or not to display the field 'inline' or on its own line
Returns
A reference to self

◆ set_author() [1/2]

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

Set embed author. Returns the embed itself so these method calls may be "chained"

Parameters
aThe author to set
Returns
A reference to self

◆ 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. Returns the embed itself so these method calls may be "chained"

Parameters
nameThe name of the author
urlThe url of the author
icon_urlThe icon URL of the author
Returns
A reference to self

◆ set_color()

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

Set embed colour. Returns the embed itself so these method calls may be "chained"

Parameters
colThe colour of the embed
Returns
A reference to self

◆ set_description()

embed & dpp::embed::set_description ( const std::string &  text)

Set embed description. Returns the embed itself so these method calls may be "chained"

Parameters
textThe text of the title
Returns
A reference to self

◆ set_footer()

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

Set the footer of the embed.

Parameters
fthe footer to set
Returns
embed& a reference to self

◆ set_image()

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

Set embed image. Returns the embed itself so these method calls may be "chained"

Parameters
urlThe embed image URL
Returns
A reference to self

◆ set_provider()

embed & dpp::embed::set_provider ( const std::string &  name,
const std::string &  url 
)

Set embed provider. Returns the embed itself so these method calls may be "chained"

Parameters
nameThe provider name
urlThe provider url
Returns
A reference to self

◆ set_thumbnail()

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

Set embed thumbnail. Returns the embed itself so these method calls may be "chained"

Parameters
urlThe embed thumbnail url
Returns
A reference to self

◆ set_timestamp()

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

Set embed timestamp. Returns the embed itself so these method calls may be "chained"

Parameters
tstampThe timestamp to show in the footer, should be in UTC
Returns
A reference to self

◆ set_title()

embed & dpp::embed::set_title ( const std::string &  text)

Set embed title. Returns the embed itself so these method calls may be "chained"

Parameters
textThe text of the title
Returns
A reference to self

◆ set_url()

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

Set embed url. Returns the embed itself so these method calls may be "chained"

Parameters
urlthe url of the embed
Returns
A reference to self

◆ set_video()

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

Set embed video. Returns the embed itself so these method calls may be "chained"

Parameters
urlThe embed video url
Returns
A reference to self

Member Data Documentation

◆ author

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

Optional: author information

◆ color

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 (can't send these)

◆ 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 (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 (can't send these)

D++ Library version 10.0.35D++ 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