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

460
Vistas
Why can't I use my token to log into my bot?

I'm trying to log in to my discord bot but it only works using discord.js v12. I also have a config file where I stored my token so I could use config.token, but it shows invalid.

When I use v13 none works. Even when I use the actual token it shows invalid and when I use config.token it shows invalid too. Here is the code:

console.clear();
    
const Discord = require("discord.js");
const config = require("./Data/config.json");   
const intents = new Discord.Intents(32767);  
const client = new Discord.Client({ intents });
  
client.on("ready", () => console.log("Bot is online!"));
    
client.on("messageCreate", message => {

   if(message.content == "hello") message.reply("Hello!");
    
});
    
client.login("token");

The bot also doesn't reply back too. This is my config file.

{
   "token": "token",
   "prefix": "!"
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are trying to log in using a string, to use the token variable from your config, use client.login(config.token), without quotes around it. This gets the config variable, then the token variable inside it, or config.token.

Your code would look something like this:

console.clear();
    
const Discord = require("discord.js");
const config = require("./Data/config.json");   
const intents = new Discord.Intents(32767);  
const client = new Discord.Client({ intents });
  
client.on("ready", () => console.log("Bot is online!"));
    
client.on("messageCreate", message => {

   if(message.content == "hello") message.reply("Hello!");
    
});
    
client.login(config.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