diff --git a/src/managers/PresenceManager.js b/src/managers/PresenceManager.js index 044dee68f..bd342bc81 100644 --- a/src/managers/PresenceManager.js +++ b/src/managers/PresenceManager.js @@ -19,8 +19,7 @@ class PresenceManager extends CachedManager { */ add(data, cache) { - const existing = this.cache.get(data.user.id); - return existing ? existing.patch(data) : super.add(data, cache, { id: data.user.id }); + return super.add(data, cache, { id: data.user.id }); } /** diff --git a/src/structures/ClientPresence.js b/src/structures/ClientPresence.js index 2a705c1cf..6d471b716 100644 --- a/src/structures/ClientPresence.js +++ b/src/structures/ClientPresence.js @@ -15,7 +15,7 @@ class ClientPresence extends Presence { set(presence) { const packet = this._parse(presence); - this.patch(packet); + this._patch(packet); if (typeof presence.shardId === 'undefined') { this.client.ws.broadcast({ op: OPCodes.STATUS_UPDATE, d: packet }); } else if (Array.isArray(presence.shardId)) { diff --git a/src/structures/Presence.js b/src/structures/Presence.js index e0fba5e20..424cba2b6 100644 --- a/src/structures/Presence.js +++ b/src/structures/Presence.js @@ -1,5 +1,6 @@ 'use strict'; +const Base = require('./Base'); const Emoji = require('./Emoji'); const ActivityFlags = require('../util/ActivityFlags'); const { ActivityTypes } = require('../util/Constants'); @@ -31,20 +32,16 @@ const Util = require('../util/Util'); /** * Represents a user's presence. + * @extends {Base} */ -class Presence { +class Presence extends Base { /** * @param {Client} client The instantiating client * @param {APIPresence} [data={}] The data for the presence */ constructor(client, data = {}) { - /** - * The client that instantiated this - * @name Presence#client - * @type {Client} - * @readonly - */ - Object.defineProperty(this, 'client', { value: client }); + super(client); + /** * The presence's user id * @type {Snowflake} @@ -57,7 +54,7 @@ class Presence { */ this.guild = data.guild ?? null; - this.patch(data); + this._patch(data); } /** @@ -78,7 +75,7 @@ class Presence { return this.guild.members.resolve(this.userId); } - patch(data) { + _patch(data) { /** * The status of this presence * @type {PresenceStatus} diff --git a/typings/index.d.ts b/typings/index.d.ts index c6c76cc4e..6628bcb64 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1273,10 +1273,9 @@ export class Permissions extends BitField { public static resolve(permission?: PermissionResolvable): bigint; } -export class Presence { +export class Presence extends Base { public constructor(client: Client, data?: unknown); public activities: Activity[]; - public readonly client: Client; public clientStatus: ClientPresenceStatusData | null; public guild: Guild | null; public readonly member: GuildMember | null;