Everyone role on guild.roles.everyone being undefined sometimes

In the attached image function first it awaits the login of the client then fetch the mainServer my project uses, if i print the guild.roles.everyone.id right after awaiting these things sometimes it have a value, sometimes not, if use a timeout of 500 miliseconds it always have a value, there is away to make sure it will have a value ?
No description
4 Replies
d.js toolkit
d.js toolkit10mo 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 OP
probablyraging
probablyraging10mo ago
There is likely some delay when fetching data when the bot first connects, instead you could try to use the ready event
d.js docs
d.js docs10mo ago
Documentation suggestion for @Pedro: :event: (event) Client#ready Emitted when the client becomes ready to start working.
Pedro
PedroOP10mo ago
Nice, that's it then
Want results from more Discord servers?
Add your server