If you've been in a server and used a bot or even seen a message from a bot, you might have seen a special message type, often sent by these bots. These are called embeds! In this section, we will show how to create an embed and reply to a user, using our newly created embed!
#include <dpp/dpp.h>
int main() {
.
set_author(
"Some name",
"https://dpp.dev/",
"https://dpp.dev/DPP-Logo.png")
"Regular field title",
"Some value here"
)
"Inline field title",
"Some value here",
true
)
"Inline field title",
"Some value here",
true
)
.set_text("Some footer text here")
.set_icon("https://dpp.dev/DPP-Logo.png")
)
event.reply(msg);
}
});
bot.global_command_create(
dpp::slashcommand(
"embed",
"Send a test embed!", bot.me.id));
}
});
return 0;
}
The cluster class represents a group of shards and a command queue for sending and receiving commands...
Definition cluster.h:89
snowflake channel_id
Optional: the channel it was sent from.
Definition appcommand.h:1043
std::string get_command_name() const
Get the command name for a command interaction.
Represents an application command, created by your bot either globally, or on a guild.
Definition appcommand.h:1436
static constexpr uint32_t sti_blue
Definition colors.h:70
std::function< void(const dpp::log_t &)> DPP_EXPORT cout_logger()
Get a default logger that outputs to std::cout. e.g.
auto run_once()
Run some code within an if() statement only once.
Definition once.h:41
@ st_wait
Wait forever on a condition variable. The cluster will spawn threads for each shard and start() will ...
Definition cluster.h:72
A rich embed for display within a dpp::message.
Definition message.h:1090
embed & set_description(std::string_view text)
Set embed description.
embed & set_author(const dpp::embed_author &a)
Set embed author.
embed & set_image(std::string_view url)
Set embed image.
embed & set_color(uint32_t col)
Set embed colour.
embed & set_title(std::string_view text)
Set embed title.
embed & set_timestamp(time_t tstamp)
Set embed timestamp.
embed & set_thumbnail(std::string_view url)
Set embed thumbnail.
embed & set_url(std::string_view url)
Set embed url.
embed & add_field(std::string_view name, std::string_view value, bool is_inline=false)
Add an embed field.
embed & set_footer(const embed_footer &f)
Set the footer of the embed.
interaction command
command interaction
Definition dispatcher.h:789
Represents messages sent and received on Discord.
Definition message.h:2350
Session ready.
Definition dispatcher.h:1072
User has issued a slash command.
Definition dispatcher.h:806
The code will send the following message.