Skip to content

Commit

Permalink
feat: added message_author_id field to message_reaction_add_t event (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Commandserver authored Jul 15, 2023
1 parent bacda13 commit 7433586
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/dpp/collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class collected_reaction : public managed {
channel* react_channel{};
/// Reacted emoji
emoji react_emoji;
/// ID of the user who authored the message which was reacted to (Optional)
snowflake message_author_id{};
};

/**
Expand Down Expand Up @@ -273,6 +275,7 @@ class reaction_collector : public reaction_collector_t {
react.react_member = element.reacting_member;
react.react_channel = element.reacting_channel;
react.react_emoji = element.reacting_emoji;
react.message_author_id = element.message_author_id;
return &react;
} else {
return nullptr;
Expand Down
4 changes: 4 additions & 0 deletions include/dpp/dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,10 @@ struct DPP_EXPORT message_reaction_add_t : public event_dispatch_t {
* @brief message id of the message reacted upon
*/
snowflake message_id;
/**
* @brief ID of the user who authored the message which was reacted to (Optional)
*/
snowflake message_author_id;
};

/** @brief Guild members chunk */
Expand Down
1 change: 1 addition & 0 deletions src/dpp/events/message_reaction_add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void message_reaction_add::handle(discord_client* client, json &j, const std::st
mra.channel_id = snowflake_not_null(&d, "channel_id");
mra.reacting_channel = dpp::find_channel(mra.channel_id);
mra.message_id = snowflake_not_null(&d, "message_id");
mra.message_author_id = snowflake_not_null(&d, "message_author_id");
mra.reacting_emoji = dpp::emoji().fill_from_json(&(d["emoji"]));
if (mra.channel_id && mra.message_id) {
client->creator->on_message_reaction_add.call(mra);
Expand Down

0 comments on commit 7433586

Please sign in to comment.