From a543e49acdc1de20bbe6d3adb335560dacb5bb71 Mon Sep 17 00:00:00 2001 From: Orlando <109116795+osirais@users.noreply.github.com> Date: Sat, 2 Mar 2024 03:13:28 -0600 Subject: [PATCH] feat: add embed-only message ctor (#1100) --- include/dpp/message.h | 9 ++++++++- src/dpp/message.cpp | 7 +++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/dpp/message.h b/include/dpp/message.h index d6def6a0d0..2d11b527e2 100644 --- a/include/dpp/message.h +++ b/include/dpp/message.h @@ -2023,13 +2023,20 @@ struct DPP_EXPORT message : public managed, json_interface { */ message(snowflake channel_id, const std::string &content, message_type type = mt_default); + /** + * @brief Construct a new message object with content + * + * @param _embed An embed to send + */ + message(const embed& _embed); + /** * @brief Construct a new message object with a channel and content * * @param channel_id The channel to send the message to * @param _embed An embed to send */ - message(snowflake channel_id, const embed & _embed); + message(snowflake channel_id, const embed& _embed); /** * @brief Construct a new message object with content diff --git a/src/dpp/message.cpp b/src/dpp/message.cpp index b7da4fc5af..850a6c67ed 100644 --- a/src/dpp/message.cpp +++ b/src/dpp/message.cpp @@ -622,11 +622,14 @@ message::message(const std::string &_content, message_type t) : message() { type = t; } -message::message(snowflake _channel_id, const embed& _embed) : message() { - channel_id = _channel_id; +message::message(const embed& _embed) : message() { embeds.emplace_back(_embed); } +message::message(snowflake _channel_id, const embed& _embed) : message(_embed) { + channel_id = _channel_id; +} + embed::embed(json* j) : embed() { title = string_not_null(j, "title"); type = string_not_null(j, "type");