Skip to content Skip to sidebar Skip to footer

How To Fix "cannot Read Property 'react' Of Undefined" In Discord.js

I'm setting up a discord bot with reactions, but there is an error in the second reaction by number, but I can not find it. It's probably a loop error, but I've already tried to ch

Solution 1:

One thing I noticed is that you are using async/wait but handling it like a promise.then

var sentMessage1 = awaitaccessSpreadsheet(embed2)
                        .then(() => message.author.send(embed2))
                        .catch(console.error);

sentMessage1 does not receive anything back from you call.

You either must return a something that has .react on it or handle everything inside your then statement.

var sentMessage1 = await accessSpreadsheet(embed2)
                        .then(() => {
                             message.author.send(embed2);
                             message.author.react(####); //I don't know the discord API
                         })
                        .catch(console.error);

Post a Comment for "How To Fix "cannot Read Property 'react' Of Undefined" In Discord.js"