mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
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>
This commit is contained in:
@@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
const Action = require('./Action');
|
const Action = require('./Action');
|
||||||
const Events = require('../../util/Events');
|
const Events = require('../../util/Events');
|
||||||
|
const Partials = require('../util/Partials');
|
||||||
|
|
||||||
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 && ('username' in data.user || this.client.options.partials.includes(Partials.User))) {
|
||||||
|
user = this.client.users._add(data.user);
|
||||||
|
}
|
||||||
if (!user) return;
|
if (!user) return;
|
||||||
|
|
||||||
if (data.user.username) {
|
if (data.user.username) {
|
||||||
|
|||||||
Reference in New Issue
Block a user