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

#10672 djs
This commit is contained in:
Elysia
2025-02-14 22:20:04 +07:00
parent e53ff466cd
commit f9216e58ae

View File

@@ -2,11 +2,15 @@
const Action = require('./Action'); const Action = require('./Action');
const { Events } = require('../../util/Constants'); const { Events } = require('../../util/Constants');
const { PartialTypes } = require('../../util/Constants');
class PresenceUpdateAction extends Action { class PresenceUpdateAction extends Action {
handle(data) { handle(data) {
let user = this.client.users.cache.get(data.user.id); let user = this.client.users.cache.get(data.user.id);
if (!user && data.user?.username) user = this.client.users._add(data.user); if (!user && data.user?.username) user = this.client.users._add(data.user);
if (!user && ('username' in data.user || this.client.options.partials.includes(PartialTypes.USER))) {
user = this.client.users._add(data.user);
}
if (!user) return; if (!user) return;
if (data.user?.username) { if (data.user?.username) {