Skip to content

Commit

Permalink
fix(PresenceUpdate): correctly add user regardless of their properties (
Browse files Browse the repository at this point in the history
#10672)

* fix(PresenceUpdate): correctly add user regardless of their properties

* refactor(PresenceUpdate): reflect partials

* refactor(PresenceUpdate): prettier

* refactor(PresenceUpdate): add import

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and Jiralite committed Jan 13, 2025
1 parent 95db597 commit 7c1b73c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/discord.js/src/client/actions/PresenceUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

const Action = require('./Action');
const Events = require('../../util/Events');
const Partials = require('../util/Partials');

class PresenceUpdateAction extends Action {
handle(data) {
let user = this.client.users.cache.get(data.user.id);
if (!user && data.user.username) user = this.client.users._add(data.user);
if (!user && ('username' in data.user || this.client.options.partials.includes(Partials.User))) {
user = this.client.users._add(data.user);
}
if (!user) return;

if (data.user.username) {
Expand Down

0 comments on commit 7c1b73c

Please sign in to comment.