embed-message

# Sending Embeds

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>

    intmain(){
    /*Setupthebot*/
    dpp::clusterbot("token");

    bot.on_log(dpp::utility::cout_logger());

    /*Theeventisfiredwhensomeoneissuesyourcommands*/
    bot.on_slashcommand([&bot](constdpp::slashcommand_t&event){
    /*Checkwhichcommandtheyran*/
    if(event.command.get_command_name()=="embed"){
    /*Createanembed*/
    dpp::embedembed=dpp::embed()
    .set_color(dpp::colors::sti_blue)
    .set_title("Somename")
    .set_url("https://dpp.dev/")
    .set_author("Somename","https://dpp.dev/","https://dpp.dev/DPP-Logo.png")
    .set_description("Somedescriptionhere")
    .set_thumbnail("https://dpp.dev/DPP-Logo.png")
    .add_field(
    "Regularfieldtitle",
    "Somevaluehere"
    )
    .add_field(
    "Inlinefieldtitle",
    "Somevaluehere",
    true
    )
    .add_field(
    "Inlinefieldtitle",
    "Somevaluehere",
    true
    )
    .set_image("https://dpp.dev/DPP-Logo.png")
    .set_footer(
    dpp::embed_footer()
    .set_text("Somefootertexthere")
    .set_icon("https://dpp.dev/DPP-Logo.png")
    )
    .set_timestamp(time(0));

    /*Createamessagewiththecontentasournewembed.*/
    dpp::messagemsg(event.command.channel_id,embed);

    /*Replytotheuserwiththemessage,containingourembed.*/
    event.reply(msg);
    }
    });

    bot.on_ready([&bot](constdpp::ready_t&event){
    if(dpp::run_once<struct register_bot_commands>()){
    /*Createandregisteracommandwhenthebotisready*/
    bot.global_command_create(dpp::slashcommand("embed","Sendatestembed!",bot.me.id));
    }
    });

    bot.start(dpp::st_wait);

    return0;
    }

The code will send the following message.