SyntaxError: Unexpected token 'else'

Not too sure what is wrong with this code…

else if (message.content === ${prefix}server) {

    message.channel.send(`Server name: ${message.guild.name}\nTotal members: ${message.guild.memberCount}`);

}

else if (message.content === ${prefix}server) {

    message.channel.send(`Server name: ${message.guild.name}\nTotal members: ${message.guild.memberCount}`);

}

Difficult to say without seeing more of the code. Could be you forgot a closing bracket

when having a syntax error like this, always check the line above as well.

1 Like

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