How to get rid of [Circular *1]
Hi yall I am making a command that has to check whether the person that runs it has a certain role, and if they do, they continue. The problem arises with getting the roles, for some reason it says cirular instead of the information that is supposed to show up.
25 Replies
Consider using the documentation instead of console logging
What you're describing are circular references
I did that
I realised my mistake
But still why does it say
[Circular *2]
and not just the data that is store in the manager:IRT_This:
It's referencing its parent class instance, so it's not wise to be logging the same data that'll get you stuck in an infinite loop of nested objects. You can also visualize this by logging
guild.members.guild.members.guild.members.guild
- it references itself infinitelyokay okay i get that
wait
roles: RoleManager { guild: [Circular *2] },
why does that say circular when roles
is supposed to be RoleManager and not the guild itselfIt is the role manager
Which has a guild property
Which is circular
and what about the rest of its properties?
with the actual roles n stuff
or am I just looking at the wrong location
I just did some testing and it should have other properties because
message.guild?.roles.highest.id
does return a string, so why does it not say that for example highest
is also a property
i feel like i am going insane:IRT_This:
I AM
Then what's telling you that
highest
is not a property?this very very very stupid line in the json that is returned
roles: RoleManager { guild: [Circular *2] },
why doesnt it show the other propertiesBecause they are not enumerable
RoleManager#highest is not a "property" per se, but a getter
Please use documentation instead of console.logging
This is the exact reason we suggest using the docs instead, because the docs show you what actually exists and doesn't exist, whereas console logs do not give the full picture
I am, I already had it open before I opened the question
okay thank you a lot sincerely
I thought the entire point of console logging was to show all the data there was but apparently it just skips some
i didnt know that
getter meaning a function that returns the value?
Sort of - a function disguised as a property
it does show up under the properties - a thanks
okay I get it all now thanks a lot
The thread owner has marked this issue as solved.