1
client.on("message", (message) => {
  message.channel.send({
    embed: {
      color: 3447003,
      author: {
        name: client.user.username,
        icon_url: client.user.avatarURL
      },
      title: "commands",
      description: "all current commands",
      fields: [{
        name: "admin only",
        value: "ban"
      },
      {
        name: "moderator only",
        value: "kick"
      },
      {
        name: "everyone",
        value: "ping \n help \n invite \n sinvite \n gay \n owner "
      }],
      timestamp: new Date(),
      footer: {
        icon_url: client.user.avatarURL,
        text: "~Isabelle~"
      }
    }
  });
  ^
SyntaxError; Unexpected end of input

I'm using discord.js within node.js, and I'm unsure what's causing this error. I've tried checking back for typos but I haven't caught any. Help?

2
  • 2
    You're missing a closing }); for the client.on callback. Run your code through a linter like jslint, and even having consistent formatting like you can find on jsbeautifier.org can help you solve these syntax issues much faster Commented Feb 11, 2018 at 19:35
  • Yep, what Sterling said - I'd also recommend keeping your code formatted nicely (consistent spacings) so you can easily detect where brackets are missing. Commented Feb 12, 2018 at 17:34

1 Answer 1

1

As mentioned in the comments, add }); to the very end of your code. This should close off the client.on event listener. The final }); in your code looked like it closed off that listener until I edited the question with proper formatting. Now you can tell there is another }); needed.

Credit goes to @SterlingArcher, I answered b/c I want to stop looking at this as an unanswered question.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.