Skip to content

Commit

Permalink
feat: add embed-only message ctor (#1100)
Browse files Browse the repository at this point in the history
  • Loading branch information
osirais authored Mar 2, 2024
1 parent 46044c8 commit a543e49
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion include/dpp/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -2023,13 +2023,20 @@ struct DPP_EXPORT message : public managed, json_interface<message> {
*/
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
Expand Down
7 changes: 5 additions & 2 deletions src/dpp/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit a543e49

Please sign in to comment.