You might have seen these special messages, often sent by bots. In this section, we will show how to create an embed.
To make an embed use this.
#include <dpp/dpp.h>
int main() {
dpp::embed embed = dpp::embed().
set_color(0x0099ff).
set_title("Some name").
set_url("https://dpp.dev/").
set_author("Some name", "https://dpp.dev/", "https://dpp.dev/DPP-Logo.png").
set_description("Some description here").
set_thumbnail("https://dpp.dev/DPP-Logo.png").
add_field(
"Regular field title",
"Some value here"
).
add_field(
"Inline field title",
"Some value here",
true
).
add_field(
"Inline field title",
"Some value here",
true
).
set_image("https://dpp.dev/DPP-Logo.png").
set_footer(dpp::embed_footer().set_text("Some footer text here").set_icon("https://dpp.dev/DPP-Logo.png")).
set_timestamp(time(0));
bot.message_create(dpp::message(event.msg->channel_id, embed).set_reference(event.msg->id));
}
});
bot.start(false);
return 0;
}
The cluster class represents a group of shards and a command queue for sending and receiving commands...
Definition: cluster.h:236
Create message.
Definition: dispatcher.h:1013
message * msg
message that was created (sent). If you use any parts of this in another thread, take a copy!...
Definition: dispatcher.h:1023
std::string content
Definition: message.h:971
The code will send the following message.