Skip to content

Commit aaf3a32

Browse files
committed
Update Member.php
1 parent b90d192 commit aaf3a32

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Discord/Parts/User/Member.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ protected function getClientStatusAttribute(): ClientStatus
667667
*/
668668
protected function getIdAttribute(): string
669669
{
670-
return $this->attributes['id'] ?? $this->user->id;
670+
return $this->attributes['id'] ?? $this->user->id ?? '';
671671
}
672672

673673
/**
@@ -699,11 +699,16 @@ protected function getDiscriminatorAttribute(): ?string
699699
*/
700700
protected function getUserAttribute(): ?User
701701
{
702+
if (isset($this->attributes['user'])) {
703+
return $this->attributePartHelper('user', User::class);
704+
}
705+
702706
if ($user = $this->discord->users->get('id', $this->id)) {
707+
$this->attributes['user'] = $user;
703708
return $user;
704709
}
705710

706-
return $this->attributePartHelper('user', User::class);
711+
return null;
707712
}
708713

709714
/**

0 commit comments

Comments
 (0)