From 7c1b73cc697fd3b85011bdb2c098ca3a3f863b1f Mon Sep 17 00:00:00 2001 From: Digital Date: Mon, 13 Jan 2025 11:20:44 +0100 Subject: [PATCH] fix(PresenceUpdate): correctly add user regardless of their properties (#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> --- packages/discord.js/src/client/actions/PresenceUpdate.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/discord.js/src/client/actions/PresenceUpdate.js b/packages/discord.js/src/client/actions/PresenceUpdate.js index 0b4aaab75..eea2008a4 100644 --- a/packages/discord.js/src/client/actions/PresenceUpdate.js +++ b/packages/discord.js/src/client/actions/PresenceUpdate.js @@ -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) {