Discord Bot | SyntaxError: Unexpected end of input

Having some issues getting my code running. I suspect it might be due to me missing a matching }. However I’m not seeing it. A second set of eye would be very much appreciated.

Code Below:

I am using the Cloud IDE replit to run this code. It was used in this tutorial.
Tutorial Link

I used it to get a foundation for the bot. Maybe I’m running into this issue due to a quirk in replit, I figured it was worth mentioning.

if statement is missing ending brace }. also if client.login(mySecret) isn’t supposed to be part of your client.on(“message”) callback function then your callback function is also missing ending curly brace }.

I tried adding an extra curly brace, but now I’m getting a Unexpected token ‘)’ error on line 31. And the login line shouldn’t be part of the second client.on function.

Could you just throw up a quick example of correct syntax? Nothing I seem to try works.

I was able to find the solution. I just jumped into Javascript and Node.js without learning about how they close their blocks.

Solution Below.

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