Skip to content

Commit

Permalink
feat: dpp::message::add_sticker
Browse files Browse the repository at this point in the history
  • Loading branch information
Mishura4 committed Jan 6, 2024
1 parent 9d498f3 commit aa69714
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
18 changes: 18 additions & 0 deletions include/dpp/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -2181,6 +2181,24 @@ struct DPP_EXPORT message : public managed, json_interface<message> {
*/
message& add_embed(const embed& e);

/**
* @brief Add a sticker to this message
*
* As of writing this, a message can only contain up to 3 stickers
* @param s sticker to add
* @return message& reference to self
*/
message& add_sticker(const sticker& s);

/**
* @brief Add a sticker to this message
*
* As of writing this, a message can only contain up to 3 stickers
* @param id id of the sticker to add
* @return message& reference to self
*/
message& add_sticker(const snowflake& id);

/**
* @brief Set the flags
*
Expand Down
22 changes: 14 additions & 8 deletions src/dpp/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,26 +535,32 @@ message::message(snowflake _channel_id, const std::string &_content, message_typ
type = t;
}

message& message::add_component(const component& c)
{
message& message::add_component(const component& c) {
components.emplace_back(c);
return *this;
}

message& message::add_embed(const embed& e)
{
message& message::add_embed(const embed& e) {
embeds.emplace_back(e);
return *this;
}

message& message::set_flags(uint16_t f)
{
message& message::add_sticker(const sticker& s) {
stickers.emplace_back(s);
return *this;
}

message& message::add_sticker(const snowflake& id) {
stickers.emplace_back().id = id;
return *this;
}

message& message::set_flags(uint16_t f) {
flags = f;
return *this;
}

message& message::set_type(message_type t)
{
message& message::set_type(message_type t) {
type = t;
return *this;
}
Expand Down

0 comments on commit aa69714

Please sign in to comment.