Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

454
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda