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 toolkit4mo 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
probablyraging4mo 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 docs4mo ago
Documentation suggestion for @Pedro: :event: (event) Client#ready Emitted when the client becomes ready to start working.
Pedro
Pedro4mo ago
Nice, that's it then