- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
#When I type node index.js in the terminal nothing happens
22 messages · Page 1 of 1 (latest)
did you save your code
no how do I save it
ctrl + s
though if you dont even know how you save code, i would check out #resources first
now it says something
I have a .env file with the discord token set next to the equal sign
const { Client, GatewayIntentBits } = require('discord.js');
require('dotenv').config(); // Load environment variables from .env
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once('ready', () => {
console.log(Bot is online as ${client.user.tag}!);
});
const token = process.env.DISCORD_TOKEN;
if (!token) {
console.error('Bot token is missing. Make sure you have a .env file with DISCORD_TOKEN set.');
process.exit(1);
}
client.login(token);
is your env file in your root directory
and does it actually have a key named DISCORD_TOKEN
yes
which question is that an answer to
show whats in your env (but remove the token)
this is whats in there, DISCORD_TOKEN=
is your env file saved
i fixed it