From 9257a09abbf80558ed2d5d209a2f6bd2a4b3d799 Mon Sep 17 00:00:00 2001 From: Vlad Frangu Date: Tue, 3 Sep 2024 00:20:16 +0300 Subject: [PATCH] fix(Message): reacting returning undefined (#10475) --- packages/discord.js/src/client/actions/Action.js | 4 ++++ .../discord.js/src/client/actions/MessageReactionAdd.js | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/discord.js/src/client/actions/Action.js b/packages/discord.js/src/client/actions/Action.js index 96170ee87d7e..b5f1f756b4a2 100644 --- a/packages/discord.js/src/client/actions/Action.js +++ b/packages/discord.js/src/client/actions/Action.js @@ -111,6 +111,10 @@ class GenericAction { getThreadMember(id, manager) { return this.getPayload({ user_id: id }, manager, id, Partials.ThreadMember, false); } + + spreadInjectedData(data) { + return Object.fromEntries(Object.getOwnPropertySymbols(data).map(symbol => [symbol, data[symbol]])); + } } module.exports = GenericAction; diff --git a/packages/discord.js/src/client/actions/MessageReactionAdd.js b/packages/discord.js/src/client/actions/MessageReactionAdd.js index 9c9ffbc874a0..b32f7154f102 100644 --- a/packages/discord.js/src/client/actions/MessageReactionAdd.js +++ b/packages/discord.js/src/client/actions/MessageReactionAdd.js @@ -23,7 +23,13 @@ class MessageReactionAdd extends Action { if (!user) return false; // Verify channel - const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id, user_id: data.user_id }); + const channel = this.getChannel({ + id: data.channel_id, + guild_id: data.guild_id, + user_id: data.user_id, + ...this.spreadInjectedData(data), + }); + if (!channel?.isTextBased()) return false; // Verify message