0

So I'm working with discord.js but made the mistake of working in notepad, now I'm getting internal errors when I run the following:

client.on('message', async (message) => {
if (message.content == "help") {
    message.channel.send({embed: {
    color: 0,
    title: "Commands:",
    fields: [
    { name: "Commands", value: "help /support: \n help /games: \n help /commands:", inline: true},
    { name: "Actions", value: "Need help? Don't worry! \n Play a fun game or two. \n Need help with the basics? No problem.", inline: true}]}
});

What am I doing wrong?

The error is:

index.js:64
});


SyntaxError: Unexpected end of input
←[90m    at Object.compileFunction (node:vm:352:18)←[39m
←[90m    at wrapSafe (node:internal/modules/cjs/loader:1025:15)←[39m
←[90m    at Module._compile (node:internal/modules/cjs/loader:1059:27)←[39m
←[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)←[39m
←[90m    at Module.load (node:internal/modules/cjs/loader:975:32)←[39m
←[90m    at Function.Module._load (node:internal/modules/cjs/loader:816:12)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)←[39m
←[90m    at node:internal/main/run_main_module:17:47←[39m

Thanks!

1
  • 1
    Looks like you got confused with your closing brackets / curly brackets... seems you missed to close the if-loop body?! Do a cleaner way to indent your code to avoid such mistakes Commented Aug 17, 2021 at 8:08

1 Answer 1

2

As @suther already mentioned your syntax was not right. Have a look at this. You have missed some curly brackets.

Maybe you should also use the strict equality comparison operator === instead of == in js, for an equality check, but it's not mandatory in that case:

client.on('message', async (message) => {
  if (message.content === "help") {
    message.channel.send({
      embed: {
        color: 0,
        title: "Commands:",
        fields: [
          { 
            name: "Commands", 
            value: "help /support: \n help /games: \n help /commands:", 
            inline: true 
          },
          { 
            name: "Actions", 
            value: "Need help? Don't worry! \n Play a fun game or two. \n Need help with the basics? No problem.", 
            inline: true 
          }
        ]
      }
    });
  }
});
Sign up to request clarification or add additional context in comments.

1 Comment

tysm for the help

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.