Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

457
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!