From 7433586df3e74794d5362b10fa3b56f5ec0c1783 Mon Sep 17 00:00:00 2001 From: Phil Date: Sat, 15 Jul 2023 18:08:55 +0200 Subject: [PATCH] feat: added message_author_id field to message_reaction_add_t event (#730) --- include/dpp/collector.h | 3 +++ include/dpp/dispatcher.h | 4 ++++ src/dpp/events/message_reaction_add.cpp | 1 + 3 files changed, 8 insertions(+) diff --git a/include/dpp/collector.h b/include/dpp/collector.h index 0bdb930758..a512287a5f 100644 --- a/include/dpp/collector.h +++ b/include/dpp/collector.h @@ -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{}; }; /** @@ -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; diff --git a/include/dpp/dispatcher.h b/include/dpp/dispatcher.h index 8119b62160..330466a47d 100644 --- a/include/dpp/dispatcher.h +++ b/include/dpp/dispatcher.h @@ -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 */ diff --git a/src/dpp/events/message_reaction_add.cpp b/src/dpp/events/message_reaction_add.cpp index 6c4c5ae184..979a6cc698 100644 --- a/src/dpp/events/message_reaction_add.cpp +++ b/src/dpp/events/message_reaction_add.cpp @@ -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);