From 56c40720e81f5dda6e29ac3357f3821fcf9425c9 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 5 Nov 2024 14:34:51 +0000 Subject: [PATCH] Fix case where you could send larger strings as emoji --- src/useReactions.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/useReactions.tsx b/src/useReactions.tsx index d38fca01..f068ca3a 100644 --- a/src/useReactions.tsx +++ b/src/useReactions.tsx @@ -213,10 +213,17 @@ export const ReactionsProvider = ({ return; } + const emoji = content.emoji?.split(/(?:)/u)?.[0]; + + if (!emoji) { + logger.warn(`Reaction had no emoji from ${reactionEventId}`); + return; + } + // One of our custom reactions const reaction = { ...GenericReaction, - emoji: content.emoji, + emoji, // If we don't find a reaction, we can fallback to the generic sound. ...ReactionSet.find((r) => r.name === content.name), };