mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +01:00
fix(PresenceUpdate): use added presence over nullable getter (#6077)
Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
@@ -26,15 +26,15 @@ class PresenceUpdateAction extends Action {
|
|||||||
});
|
});
|
||||||
this.client.emit(Events.GUILD_MEMBER_AVAILABLE, member);
|
this.client.emit(Events.GUILD_MEMBER_AVAILABLE, member);
|
||||||
}
|
}
|
||||||
guild.presences._add(Object.assign(data, { guild }));
|
const newPresence = guild.presences._add(Object.assign(data, { guild }));
|
||||||
if (this.client.listenerCount(Events.PRESENCE_UPDATE) && member && !member.presence.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.
|
* Emitted whenever a guild member's presence (e.g. status, activity) is changed.
|
||||||
* @event Client#presenceUpdate
|
* @event Client#presenceUpdate
|
||||||
* @param {?Presence} oldPresence The presence before the update, if one at all
|
* @param {?Presence} oldPresence The presence before the update, if one at all
|
||||||
* @param {Presence} newPresence The presence after the update
|
* @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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user