-
-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
This snippet of code causes the above error:
case 'MessageReact': {
const message = client.messages.getOrPartial(event.id);
if (message) {
const reactions = message.reactions;
const set = reactions.get(event.emoji_id);... when a messageReactionAdd event listener exists:
// ...
this.options.client.on('messageReactionAdd', this.listener);
// ...This code was used to trigger the error:
await msg.clearReactions();
await msg.react(encodeURIComponent('❌'));Explanation: The event tries to get which reaction was added (?), but, since clearReactions ran, message.reactions is {}, causing the reactions.get is not a function error, since reactions is not a Map anymore.
My temporary fix:
case 'MessageReact': {
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);Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working