From 78e2fb2945cc3e9976b2962baf34330d1dd51dc6 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Wed, 31 Jan 2024 21:05:18 +0700 Subject: [PATCH] Update Presence.js --- src/structures/Presence.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/structures/Presence.js b/src/structures/Presence.js index 03708ab..5cd9f90 100644 --- a/src/structures/Presence.js +++ b/src/structures/Presence.js @@ -90,15 +90,19 @@ class Presence extends Base { if ('activities' in data) { /** * The activities of this presence (Always `Activity[]` if not ClientUser) - * @type {CustomStatus[]|RichPresence[]|SpotifyRPC[]} + * @type {CustomStatus[]|RichPresence[]|SpotifyRPC[]|Activity[]} */ this.activities = data.activities.map(activity => { - if ([ActivityTypes.CUSTOM, 'CUSTOM'].includes(activity.type)) { - return new CustomStatus(this.client, activity); - } else if (activity.id == 'spotify:1') { - return new SpotifyRPC(this.client, activity); + if (this.userId == this.client.user.id) { + if ([ActivityTypes.CUSTOM, 'CUSTOM'].includes(activity.type)) { + return new CustomStatus(this.client, activity); + } else if (activity.id == 'spotify:1') { + return new SpotifyRPC(this.client, activity); + } else { + return new RichPresence(this.client, activity); + } } else { - return new RichPresence(this.client, activity); + return new Activity(this, activity); } }); } else { @@ -621,7 +625,7 @@ class CustomStatus extends Activity { * @param {CustomStatus|CustomStatusOptions} [data={}] CustomStatus to clone or raw data */ constructor(client, data = {}) { - super(client.presence, { + super('presence' in client ? client.presence : client, { name: 'Custom Status', type: ActivityTypes.CUSTOM, ...data, @@ -670,7 +674,7 @@ class RichPresence extends Activity { * @param {RichPresence} [data={}] RichPresence to clone or raw data */ constructor(client, data = {}) { - super(client.presence, { type: 0, ...data }); + super('presence' in client ? client.presence : client, { type: 0, ...data }); this.setup(data); }