Skip to content

Commit 2c7cea5

Browse files
committed
Update GuildSearch.php
1 parent 4912769 commit 2c7cea5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Discord/Parts/Guild/GuildSearch.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ protected function getMessagesAttribute(): ?ExCollectionInterface
6262
$collection = Collection::for(Message::class);
6363

6464
foreach ($this->attributes['messages'] as $snowflake => $message) {
65-
if ($guild = $this->discord->guilds->get('id', $this->guild_id)) {
65+
if ($guild = $this->discord->guilds->get('id', $message->guild_id)) {
6666
if ($channel = $guild->channels->get('id', $message->channel_id)) {
6767
$messagePart = $channel->messages->get('id', $snowflake);
6868
}
6969
}
7070

71-
$collection->pushItem($messagePart ?? $this->factory->part(Message::class, (array) $message + ['guild_id' => $this->guild_id], true));
71+
$collection->pushItem($messagePart ?? $this->factory->part(Message::class, (array) $message, true));
7272
}
7373

7474
return $collection;
@@ -84,15 +84,15 @@ protected function getMembersAttribute(): ?ExCollectionInterface
8484
$collection = Collection::for(Member::class);
8585

8686
foreach ($this->attributes['members'] ?? [] as $snowflake => $member) {
87-
if ($guild_id = $member->guild_id ?? null) {
87+
if ($guild_id = $member->guild_id) {
8888
if ($guild = $this->discord->guilds->get('id', $guild_id)) {
8989
$memberPart = $guild->members->get('id', $snowflake);
9090
}
9191
}
9292

9393
if (! isset($memberPart)) {
9494
$member->user = $this->attributes['users']->$snowflake;
95-
$memberPart = $this->factory->part(Member::class, (array) $member + ['guild_id' => $this->guild_id], true);
95+
$memberPart = $this->factory->part(Member::class, (array) $member, true);
9696
}
9797

9898
$collection->pushItem($memberPart);

0 commit comments

Comments
 (0)