Need help with Discord JS

Getting an Unexpected identifier following the guide.

Just confused cause it looks almost exactly the same as the guide.

Hi @Miracle2 !

Welcome to the forum!

It’s a little hard to tell because you are not using conventional formatting.
Right now it looks like msg.reply is part of the encouragement variable.

Can you try rewriting it like this?

if (sadWords.some(word => msg.content.includes(word))) {
  const encouragement = encouragements[Math.floor(Math.random() * encouragements.length)]; 
  msg.reply(encouragement);
}

It might be easier to spot the issue this way.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.