Skip to content

Commit

Permalink
fix(PresenceUpdate): use added presence over nullable getter (#6077)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com>
Co-authored-by: Noel <buechler.noel@outlook.com>
  • Loading branch information
3 people committed Jul 8, 2021
1 parent 6301728 commit 637c8e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/client/actions/PresenceUpdate.js
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 637c8e0

Please sign in to comment.