The bot doesn’t go online.
hi, what should i do if my bot doesn't go online? (the console returns no errors when I type “node index.js” or “node .” to run the bot) my npm -v version is the latest (20) but i have also tried with the 18.
14 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.Are you calling
client.login(...)
in index.js?yes
Can you show your index.js?
const { Client, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, c => {
console.log(
Ready! Logged in as ${c.user.tag}
);
});
client.login(token);
and in the config.json file i have {
“token” : “my token”
}What host are you using for your bot?
no one at the moment. just visual studio code on my computer
So whenever you type
node .
in your console, does it start a new line like PS C:/.../ >
, or is the last line the same as where you typed node .
?it start a new line
Are you sure that index.js is in your working directory (the same as what your "cursor" in your console says)?
yes
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
• Note: if you initialize your Client as
bot
or other identifiers you need to use these instead of client
• If the output is too long to post consider using a bin instead: gist | paste.gg | sourceb.in | hastebinAdding these should ensure that you get something logged
thanks, now it works
it was the first time i had this problem, i was practicable with discord.js 12.