Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(GuildMember): make _roles property non-enumerable #9387

Merged
merged 8 commits into from
May 18, 2023
18 changes: 9 additions & 9 deletions packages/discord.js/src/structures/GuildMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ class GuildMember extends Base {
this.communicationDisabledUntilTimestamp = null;

/**
* The role ids of the member
* @type {Snowflake[]}
* @private
* A manager for the roles belonging to this member
* @type {GuildMemberRoleManager}
* @readonly
*/
this._roles = [];
this.roles = new GuildMemberRoleManager(this);
if (data) this._patch(data);
}

Expand Down Expand Up @@ -127,12 +127,12 @@ class GuildMember extends Base {
}

/**
* A manager for the roles belonging to this member
* @type {GuildMemberRoleManager}
* @readonly
* The role ids of the member
* @type {Snowflake[]}
* @private
*/
get roles() {
return new GuildMemberRoleManager(this);
get _roles() {
return [];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ export class GuildMember extends PartialTextBasedChannel(Base) {
public get premiumSince(): Date | null;
public premiumSinceTimestamp: number | null;
public get presence(): Presence | null;
public get roles(): GuildMemberRoleManager;
public readonly roles: GuildMemberRoleManager;
public user: User;
public get voice(): VoiceState;
public avatarURL(options?: ImageURLOptions): string | null;
Expand Down