what do i do yall???

ik this is some kind of connection error, it happened when i tried starting my bot, but how do i fix it? heres my index.js code btw:
const { Client, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json')

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

client.once(Events.ClientReady, readyClient => {
console.log(\`Bot Online.\`);
});

client.login(token);
const { Client, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json')

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

client.once(Events.ClientReady, readyClient => {
console.log(\`Bot Online.\`);
});

client.login(token);
No description
11 Replies
d.js toolkit
d.js toolkit19h ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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! - Marked as resolved by staff
xTwisteDx
xTwisteDx19h ago
This appears to be an improper handling of asynchronous code. I don’t think it has anything to do with your index.ts. Unfortunately without more details there’s not much we can do to help.
Nikode
NikodeOP19h ago
what details do u need
xTwisteDx
xTwisteDx19h ago
Well for start, explain what you were changing before and after the issue cropped up. Is this a new project you’re trying to setup? What troubleshooting steps have you taken?
Nikode
NikodeOP19h ago
this is completely new, i havent done any tests before this happened so this is was the first thing in my terminal and i haven't taken any troubleshooting steps
xTwisteDx
xTwisteDx19h ago
Okay, so your setup is wrong. I suggest that you go take a look at the guide and go through it with a fine tooth comb. Chances are you have some method you’re calling that isn’t being awaited. You can also try wrapping your code with try-catch to see if you can get more specific details. Try setting console logs throughout your code to find when it is breaking, and finally use breakpoints and step through till you find it.
Nikode
NikodeOP19h ago
aight bet thanks sorry but how do i set up a try-catch?
xTwisteDx
xTwisteDx18h ago
My dude, google is your friend. Part of being a programmer is being able to ask REALLY REALLY good questions.
Nikode
NikodeOP18h ago
ohk
d.js docs
d.js docs18h ago
Resources to understand Promise: - MDN: learn more - Guide: learn more - JavaScript info: learn more
treble/luna
treble/luna18h ago
and that error is indeed a network issue and nothing djs can do abour

Did you find this page helpful?