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>
#include <dpp/fmt/format.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"));
embed.timestamp = time(0);
bot.message_create(dpp::message(event.msg->channel_id, embed));
}
});
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:221
Create message.
Definition: dispatcher.h:682
message * msg
Definition: dispatcher.h:688
std::string content
Definition: message.h:854
The code will send the following message.