Bot not coming online

My bot does not come online when i run this code
const { Client, GatewayIntentBits } = require('discord.js');
require('dotenv/config');

const client = new Discord.Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});

client.on('ready', () =>{
console.log('The Bot is On!')
});


client.login(process.env.TOKEN);
const { Client, GatewayIntentBits } = require('discord.js');
require('dotenv/config');

const client = new Discord.Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});

client.on('ready', () =>{
console.log('The Bot is On!')
});


client.login(process.env.TOKEN);
There is no error, nothing in the terminal. It just looks lik this. (I have imported dotenv and have a file named .env with the token inside a variable called TOKEN, i dont think thats the issue.) I sent an image what the terminal looks like. Any help appreciated. PLS
15 Replies
d.js toolkit
d.js toolkit2y ago
- 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. - Issue solved? Press the button!
SpecialSauce
SpecialSauce2y ago
There seems to be a few things wrong with the code snippet here. Verify that you’re running the correct file with node. You should be getting a few errors in the console.
Someone
Someone2y ago
Discord is undefined, use new Client instead
Azure
Azure2y ago
Change the
const client = new Discord.Client(
const client = new Discord.Client(
part to
const client = new Client(
const client = new Client(
Galtrips
Galtrips2y ago
U can use the guidline to use the Client object, but it s important to know u can t use an undefined variable. U must to choice between const Discord = require('discord.js') And your declaration with Client and GatewayIntentBits
Russia
RussiaOP2y ago
How do I check this
Not So Marv
Not So Marv2y ago
You check it by looking at your file tree and package.json 1) node . will run your "main" file as defined in package.json 2) If you have "main": "./index.js" but you have bot.js as the file you are trying to run, then you will receive the error of "Invalid main entry" so you would have to specify the correct file to run. 3) To run some diagnostic: use node followed by the name of the file you are trying to start.
Russia
RussiaOP2y ago
there doesnt seem to be an issue with this, the only thing i can think of being wrong is when i set up the node project, i have to cd it to my onedrive, and then my desktop. if i just do cd desktop it says i cant find it
Russia
RussiaOP2y ago
This is my package.json. another issue i think it could be is that i have to make the index.js when i open it in visual. Maybe theres something to do with that
Russia
RussiaOP2y ago
Yeah i just like reset everything with a new set of files and the same thing is popping up the OneDrive thing is the only thing i can think of affecting the files not working also if you have any ideas here
Not So Marv
Not So Marv2y ago
Okay in that case open the project from that folder rather than where you opening it at.
Russia
RussiaOP2y ago
That did not change anything
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs2y ago
Suggestion for @russian__comrade:guide Home: Before you begin... read more
Russia
RussiaOP2y ago
followed the code perfectly, still not working im just gonna give up at this point thanks for the help guys
Want results from more Discord servers?
Add your server