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](https://cdn.answeroverflow.com/1210373040177807481/2024-02-22_19-48.png)
4 Replies
- 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 OPThere is likely some delay when fetching data when the bot first connects, instead you could try to use the
ready
eventDocumentation suggestion for @Pedro:
:event: (event) Client#ready
Emitted when the client becomes ready to start working.
Nice, that's it then