From 637c8e0fdfb4ce15361646017718c72c3d6af538 Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Thu, 8 Jul 2021 22:43:48 +0200 Subject: [PATCH] fix(PresenceUpdate): use added presence over nullable getter (#6077) Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> Co-authored-by: Noel --- src/client/actions/PresenceUpdate.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/actions/PresenceUpdate.js b/src/client/actions/PresenceUpdate.js index 3639ec3b4..2e34c212f 100644 --- a/src/client/actions/PresenceUpdate.js +++ b/src/client/actions/PresenceUpdate.js @@ -26,15 +26,15 @@ class PresenceUpdateAction extends Action { }); this.client.emit(Events.GUILD_MEMBER_AVAILABLE, member); } - guild.presences._add(Object.assign(data, { guild })); - if (this.client.listenerCount(Events.PRESENCE_UPDATE) && member && !member.presence.equals(oldPresence)) { + const newPresence = guild.presences._add(Object.assign(data, { guild })); + if (this.client.listenerCount(Events.PRESENCE_UPDATE) && !newPresence.equals(oldPresence)) { /** * Emitted whenever a guild member's presence (e.g. status, activity) is changed. * @event Client#presenceUpdate * @param {?Presence} oldPresence The presence before the update, if one at all * @param {Presence} newPresence The presence after the update */ - this.client.emit(Events.PRESENCE_UPDATE, oldPresence, member.presence); + this.client.emit(Events.PRESENCE_UPDATE, oldPresence, newPresence); } } }