From bf1635f21ee59006af74188ff65817f7cd95b95e Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Thu, 8 Jul 2021 12:39:15 +0200 Subject: [PATCH 1/2] fix(PresenceUpdate): use added presence over nullable getter --- 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 3639ec3b49a6..62aedff82451 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); } } } From 1500c130828ad769b3a0c48bc9b98bfc5241623f Mon Sep 17 00:00:00 2001 From: Noel Date: Thu, 8 Jul 2021 22:42:20 +0200 Subject: [PATCH 2/2] Update src/client/actions/PresenceUpdate.js Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> --- src/client/actions/PresenceUpdate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/actions/PresenceUpdate.js b/src/client/actions/PresenceUpdate.js index 62aedff82451..2e34c212fe90 100644 --- a/src/client/actions/PresenceUpdate.js +++ b/src/client/actions/PresenceUpdate.js @@ -27,7 +27,7 @@ class PresenceUpdateAction extends Action { this.client.emit(Events.GUILD_MEMBER_AVAILABLE, member); } const newPresence = guild.presences._add(Object.assign(data, { guild })); - if (this.client.listenerCount(Events.PRESENCE_UPDATE) && newPresence.equals(oldPresence)) { + 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