Skip to content

Commit

Permalink
docs: describe private properties (#8879)
Browse files Browse the repository at this point in the history
* feat: describe private properties

* Update packages/discord.js/src/structures/GuildMember.js

Co-authored-by: MrMythicalYT <91077061+MrMythicalYT@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: MrMythicalYT <91077061+MrMythicalYT@users.noreply.github.com>

* Apply suggestions from code review

---------

Co-authored-by: MrMythicalYT <91077061+MrMythicalYT@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 1, 2023
1 parent 384b4d1 commit 2792e48
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/discord.js/src/managers/CachedManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ class CachedManager extends DataManager {
constructor(client, holds, iterable) {
super(client, holds);

/**
* The private cache of items for this manager.
* @type {Collection}
* @private
* @readonly
* @name CachedManager#_cache
*/
Object.defineProperty(this, '_cache', { value: this.client.options.makeCache(this.constructor, this.holds) });

if (iterable) {
Expand Down
5 changes: 5 additions & 0 deletions packages/discord.js/src/structures/GuildMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ class GuildMember extends Base {
*/
this.communicationDisabledUntilTimestamp = null;

/**
* The role ids of the member
* @type {Snowflake[]}
* @private
*/
this._roles = [];
if (data) this._patch(data);
}
Expand Down
12 changes: 12 additions & 0 deletions packages/discord.js/src/structures/Presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ class Presence extends Base {
*/
class Activity {
constructor(presence, data) {
/**
* The presence of the Activity
* @type {Presence}
* @readonly
* @name Activity#presence
*/
Object.defineProperty(this, 'presence', { value: presence });

/**
Expand Down Expand Up @@ -287,6 +293,12 @@ class Activity {
*/
class RichPresenceAssets {
constructor(activity, assets) {
/**
* The activity of the RichPresenceAssets
* @type {Activity}
* @readonly
* @name RichPresenceAssets#activity
*/
Object.defineProperty(this, 'activity', { value: activity });

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ declare module 'node:events' {

export class Activity {
private constructor(presence: Presence, data?: RawActivityData);
public readonly presence: Presence;
public applicationId: Snowflake | null;
public assets: RichPresenceAssets | null;
public buttons: string[];
Expand Down Expand Up @@ -1505,6 +1506,7 @@ export class GuildMemberFlagsBitField extends BitField<GuildMemberFlagsString> {

export class GuildMember extends PartialTextBasedChannel(Base) {
private constructor(client: Client<true>, data: RawGuildMemberData, guild: Guild);
private _roles: Snowflake[];
public avatar: string | null;
public get bannable(): boolean;
public get dmChannel(): DMChannel | null;
Expand Down Expand Up @@ -2442,6 +2444,7 @@ export class ReactionEmoji extends Emoji {

export class RichPresenceAssets {
private constructor(activity: Activity, assets: RawRichPresenceAssets);
public readonly activity: Activity;
public largeImage: Snowflake | null;
public largeText: string | null;
public smallImage: Snowflake | null;
Expand Down Expand Up @@ -3678,6 +3681,7 @@ export abstract class DataManager<K, Holds, R> extends BaseManager {

export abstract class CachedManager<K, Holds, R> extends DataManager<K, Holds, R> {
protected constructor(client: Client<true>, holds: Constructable<Holds>);
private readonly _cache: Collection<K, Holds>;
private _add(data: unknown, cache?: boolean, { id, extras }?: { id: K; extras: unknown[] }): Holds;
}

Expand Down

0 comments on commit 2792e48

Please sign in to comment.