Open face-hh opened 1 year ago
In case it helps, this happened on 7.0.0-beta.7
.
The same issue seems to occur on the "MessageUnreact" event:
case 'MessageUnreact': {
const message = client.messages.getOrPartial(event.id);
if (message) {
const set = message.reactions.get(event.emoji_id);
where "message.reactions" is {}
, resulting in TypeError: 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:
case 'MessageUnreact': {
const message = client.messages.getOrPartial(event.id);
if (message) {
let reactions = message.reactions;
if (!(reactions instanceof Map)) reactions = new Map();
const set = reactions.get(event.emoji_id);
What happened?
This snippet of code causes the above error:
... when a
messageReactionAdd
event listener exists:This code was used to trigger the error:
Explanation: The event tries to get which reaction was added (?), but, since
clearReactions
ran,message.reactions
is{}
, causing thereactions.get is not a function
error, sincereactions
is not aMap
anymore.My temporary fix: