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
d.js toolkit
d.js toolkit•3w ago
Definitely Not A Dolphin
GuildMember {
guild: <ref *2> Guild {
id: "1383472184416272507",
name: "The Breadening",
icon: "01fe8ab71da3351ac97eae37a74303bd",
features: [
"TIERLESS_BOOSTING_SYSTEM_MESSAGE",
"TIERLESS_BOOSTING",
"ENABLED_MODERATION_EXPERIENCE_FOR_NON_COMMUNITY",
"GUILD_ONBOARDING",
"GUILD_ONBOARDING_EVER_ENABLED",
"NEWS",
"SOUNDBOARD",
"GUILD_SERVER_GUIDE",
"COMMUNITY",
"GUILD_ONBOARDING_HAS_PROMPTS",
"PIN_PERMISSION_MIGRATION_COMPLETE"
],
commands: <ref *1> GuildApplicationCommandManager {
permissions: ApplicationCommandPermissionsManager {
manager: [Circular *1],
guild: [Circular *2],
guildId: "1383472184416272507",
commandId: null
},
guild: [Circular *2]
},
GuildMember {
guild: <ref *2> Guild {
id: "1383472184416272507",
name: "The Breadening",
icon: "01fe8ab71da3351ac97eae37a74303bd",
features: [
"TIERLESS_BOOSTING_SYSTEM_MESSAGE",
"TIERLESS_BOOSTING",
"ENABLED_MODERATION_EXPERIENCE_FOR_NON_COMMUNITY",
"GUILD_ONBOARDING",
"GUILD_ONBOARDING_EVER_ENABLED",
"NEWS",
"SOUNDBOARD",
"GUILD_SERVER_GUIDE",
"COMMUNITY",
"GUILD_ONBOARDING_HAS_PROMPTS",
"PIN_PERMISSION_MIGRATION_COMPLETE"
],
commands: <ref *1> GuildApplicationCommandManager {
permissions: ApplicationCommandPermissionsManager {
manager: [Circular *1],
guild: [Circular *2],
guildId: "1383472184416272507",
commandId: null
},
guild: [Circular *2]
},
members: GuildMemberManager { guild: [Circular *2] },
channels: GuildChannelManager { guild: [Circular *2] },
bans: GuildBanManager { guild: [Circular *2] },
roles: RoleManager { guild: [Circular *2] },
presences: PresenceManager {},
voiceStates: VoiceStateManager { guild: [Circular *2] },
stageInstances: StageInstanceManager { guild: [Circular *2] },
invites: GuildInviteManager { guild: [Circular *2] },
scheduledEvents: GuildScheduledEventManager { guild: [Circular *2] },
autoModerationRules: AutoModerationRuleManager { guild: [Circular *2] },
soundboardSounds: GuildSoundboardSoundManager { guild: [Circular *2] },
available: true,
shardId: 0,
splash: null,
banner: null,
description: "The hub for the Breadening. Together we shall infect. Together we shall bake. Together we shall rise.",
verificationLevel: 1,
vanityURLCode: null,
nsfwLevel: 0,
premiumSubscriptionCount: 2,
discoverySplash: null,
memberCount: 83,
large: true,
premiumProgressBarEnabled: false,
applicationId: null,
afkTimeout: 300,
afkChannelId: null,
systemChannelId: "1383472186073026632",
premiumTier: 0,
widgetEnabled: null,
widgetChannelId: null,
explicitContentFilter: 2,
mfaLevel: 0,
members: GuildMemberManager { guild: [Circular *2] },
channels: GuildChannelManager { guild: [Circular *2] },
bans: GuildBanManager { guild: [Circular *2] },
roles: RoleManager { guild: [Circular *2] },
presences: PresenceManager {},
voiceStates: VoiceStateManager { guild: [Circular *2] },
stageInstances: StageInstanceManager { guild: [Circular *2] },
invites: GuildInviteManager { guild: [Circular *2] },
scheduledEvents: GuildScheduledEventManager { guild: [Circular *2] },
autoModerationRules: AutoModerationRuleManager { guild: [Circular *2] },
soundboardSounds: GuildSoundboardSoundManager { guild: [Circular *2] },
available: true,
shardId: 0,
splash: null,
banner: null,
description: "The hub for the Breadening. Together we shall infect. Together we shall bake. Together we shall rise.",
verificationLevel: 1,
vanityURLCode: null,
nsfwLevel: 0,
premiumSubscriptionCount: 2,
discoverySplash: null,
memberCount: 83,
large: true,
premiumProgressBarEnabled: false,
applicationId: null,
afkTimeout: 300,
afkChannelId: null,
systemChannelId: "1383472186073026632",
premiumTier: 0,
widgetEnabled: null,
widgetChannelId: null,
explicitContentFilter: 2,
mfaLevel: 0,
joinedTimestamp: 1750116753725,
defaultMessageNotifications: 1,
systemChannelFlags: SystemChannelFlagsBitField { bitfield: 0 },
maximumMembers: 25000000,
maximumPresences: null,
maxVideoChannelUsers: 25,
maxStageVideoChannelUsers: 50,
approximateMemberCount: null,
approximatePresenceCount: null,
vanityURLUses: null,
rulesChannelId: "1388273106405294252",
publicUpdatesChannelId: "1383807467875733704",
preferredLocale: "en-US",
safetyAlertsChannelId: null,
ownerId: "939475554086838312",
emojis: GuildEmojiManager { guild: [Circular *2] },
stickers: GuildStickerManager { guild: [Circular *2] },
incidentsData: null
},
joinedTimestamp: 1749915884921,
premiumSinceTimestamp: null,
nickname: null,
pending: false,
communicationDisabledUntilTimestamp: null,
user: User {
id: "871772315099226113",
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 4194432 },
username: "definitely_not_a_dolphin",
globalName: "Zedder",
discriminator: "0",
avatar: "3de66ded50c7c0c88877a642fe2da1ff",
banner: undefined,
accentColor: undefined,
avatarDecoration: null,
avatarDecorationData: null
},
avatar: null,
banner: null,
flags: GuildMemberFlagsBitField { bitfield: 2 },
avatarDecorationData: null
}
joinedTimestamp: 1750116753725,
defaultMessageNotifications: 1,
systemChannelFlags: SystemChannelFlagsBitField { bitfield: 0 },
maximumMembers: 25000000,
maximumPresences: null,
maxVideoChannelUsers: 25,
maxStageVideoChannelUsers: 50,
approximateMemberCount: null,
approximatePresenceCount: null,
vanityURLUses: null,
rulesChannelId: "1388273106405294252",
publicUpdatesChannelId: "1383807467875733704",
preferredLocale: "en-US",
safetyAlertsChannelId: null,
ownerId: "939475554086838312",
emojis: GuildEmojiManager { guild: [Circular *2] },
stickers: GuildStickerManager { guild: [Circular *2] },
incidentsData: null
},
joinedTimestamp: 1749915884921,
premiumSinceTimestamp: null,
nickname: null,
pending: false,
communicationDisabledUntilTimestamp: null,
user: User {
id: "871772315099226113",
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 4194432 },
username: "definitely_not_a_dolphin",
globalName: "Zedder",
discriminator: "0",
avatar: "3de66ded50c7c0c88877a642fe2da1ff",
banner: undefined,
accentColor: undefined,
avatarDecoration: null,
avatarDecorationData: null
},
avatar: null,
banner: null,
flags: GuildMemberFlagsBitField { bitfield: 2 },
avatarDecorationData: null
}
TÆMBØØ
TÆMBØØ•3w ago
Consider using the documentation instead of console logging
d.js docs
d.js docs•3w ago
:property: GuildMember#roles discord.js@14.22.1 A manager for the roles belonging to this member
TÆMBØØ
TÆMBØØ•3w ago
What you're describing are circular references
Definitely Not A Dolphin
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
TÆMBØØ
TÆMBØØ•3w ago
: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 infinitely
Definitely Not A Dolphin
okay 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 itself
monbrey
monbrey•3w ago
It is the role manager Which has a guild property Which is circular
Definitely Not A Dolphin
and what about the rest of its properties? with the actual roles n stuff
d.js docs
d.js docs•3w ago
:class: RoleManager discord.js@14.22.1 Manages API methods for roles and stores their cache.
Definitely Not A Dolphin
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
TÆMBØØ
TÆMBØØ•3w ago
:IRT_This:
Definitely Not A Dolphin
I AM
TÆMBØØ
TÆMBØØ•3w ago
Then what's telling you that highest is not a property?
Definitely Not A Dolphin
this very very very stupid line in the json that is returned roles: RoleManager { guild: [Circular *2] }, why doesnt it show the other properties
TÆMBØØ
TÆMBØØ•3w ago
Because they are not enumerable RoleManager#highest is not a "property" per se, but a getter
monbrey
monbrey•3w ago
Please use documentation instead of console.logging
TÆMBØØ
TÆMBØØ•3w ago
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
Definitely Not A Dolphin
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?
TÆMBØØ
TÆMBØØ•3w ago
Sort of - a function disguised as a property
Definitely Not A Dolphin
it does show up under the properties - a thanks
d.js docs
d.js docs•3w ago
:mdn: get The get syntax binds an object property to a function that will be called when that property is looked up. It can also be used in classes.
Definitely Not A Dolphin
okay I get it all now thanks a lot
d.js toolkit
d.js toolkit•3w ago
The thread owner has marked this issue as solved.

Did you find this page helpful?