Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

169
Vistas
Discord bot is not coming online

My discord bot is not coming online. Here is my .js file

const Discord = require("discord.js");
const client = new Discord.Client();

const TOKEN = "my-token-is-here";

client.on("message", message => {
  if (message.content === "Hello Discord Bot") {
    message.channel.send("Hi There!");
  }
  {
    console.log("Bot Is Ready!");
  }
});

client.login(TOKEN)

The error I am getting is

SyntaxError: Unexpected token ?
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Based on your comments you've installed Discord.js version 13.1.0 but your NodeJS version is lower than 16.6. There are two options for you to solve this problem.

Option 1 (most recommended)

You'll need to update your NodeJS version to 16.6 or higher. You can do this by downloading a version of NodeJS at the NodeJS website and complete the setup again.

Once you've completed the setup you should be able to run your Discord bot again.

Option 2

If you don't want to update your version you can install Discord.js version 12.5.3. This version is not as stable as version 13.1.0 is but it is possible. You can do this by using the npm command npm install discord.js@12.5.3. After installing the 12.5.3 version you should be able to run your bot again.


Also like Luca Mertens noticed your breaks are incorrectely. You should replace them to

client.on('ready', () => console.log(`Bot is ready`));

client.on("message", message => {
    if (message.content === "Hello Discord Bot") {
        message.channel.send("Hi There!");
    }
});
about 4 years ago · Juan Pablo Isaza Denunciar

0

You should never post any private tokens publicly. Be sure to make a new token on the Discord-Developer-Portal and don't continue using this one!

To your question: It seems like the lines

{
    console.log("Bot Is Ready!");
}

cause the syntax error. You probably want to move that statement into it's own event handler for the event "ready" (triggered when DiscordJs has finished setting up the bot-client for you).

client.on("message", message => {
  if (message.content === "Hello Discord Bot") {
    message.channel.send("Hi There!");
  }
});

client.on("ready", () => {
    console.log("Bot Is Ready!");
});

client.login(TOKEN)
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda