mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-19 09:05:59 -04:00
bug: MessageReact event crashes with: TypeError: reactions.get is not a function #29
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @face-hh on GitHub (Jun 18, 2023).
What happened?
This snippet of code causes the above error:
... when a
messageReactionAddevent listener exists:This code was used to trigger the error:
Explanation: The event tries to get which reaction was added (?), but, since
clearReactionsran,message.reactionsis{}, causing thereactions.get is not a functionerror, sincereactionsis not aMapanymore.My temporary fix:
@face-hh commented on GitHub (Jun 19, 2023):
In case it helps, this happened on
7.0.0-beta.7.The same issue seems to occur on the "MessageUnreact" event:
where "message.reactions" is
{}, resulting inTypeError: message.reactions.get is not a function, when there are 2 reactions on a message (me & the bot), and I unreact.edit: fixed it with: