Skip to content

Commit f3503ee

Browse files
committed
$channel->members should actually return members
1 parent 65119ef commit f3503ee

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/Discord/Parts/Channel/Channel.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
* @property InviteRepository $invites Invites in the channel.
9090
* @property StageInstanceRepository $stage_instances Stage instances in the channel.
9191
*
92-
* @property ExCollectionInterface<VoiceStateUpdate>|VoiceStateUpdate[] $members If voice channel, the members currently in the channel.
92+
* @property ExCollectionInterface<Member>|Member[] $members If voice channel, the members currently in the channel.
9393
*/
9494
class Channel extends Part implements Stringable
9595
{
@@ -1042,16 +1042,15 @@ public function startThread(array|string $options, string|bool|null $reason = nu
10421042
/**
10431043
* Gets the members currently in the voice channel.
10441044
*
1045-
* @return ExCollectionInterface<VoiceStateUpdate>|VoiceStateUpdate[] Members in the voice channel.
1045+
* @return ExCollectionInterface<Member>|Member[] Members in the voice channel.
10461046
*/
10471047
public function getMembersAttribute(): ExCollectionInterface
10481048
{
10491049
if ($guild = $this->guild) {
1050-
return $guild->voice_states->filter(fn (VoiceStateUpdate $voice_state) => $voice_state->channel_id === $this->id);
1050+
return $guild->members->filter(fn (Member $member) => $guild->voice_states->filter(fn (VoiceStateUpdate $voice_state) => $voice_state->channel_id === $this->id)->has($member->id));
10511051
}
10521052

1053-
/** @var ExCollectionInterface<VoiceStateUpdate> */
1054-
return $this->discord->getCollectionClass()::for(VoiceStateUpdate::class, 'user_id');
1053+
return $this->discord->getCollectionClass()::for(Member::class, 'id');
10551054
}
10561055

10571056
/**

src/Discord/Parts/Channel/ChannelTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@
5757
* @property string $parent_id The ID of the parent channel or the channel which the thread was started in.
5858
* @property-read Channel|null $parent The parent channel or the channel which the thread was created in.
5959
*
60-
* @property bool $is_private Whether the channel is a private channel.
61-
* @property ExCollectionInterface<VoiceStateUpdate>|VoiceStateUpdate[] $members Voice channel only - members in the channel or thread.
62-
* @property MessageRepository $messages Text channel only - messages sent in the channel or thread.
60+
* @property bool $is_private Whether the channel is a private channel.
61+
* @property ExCollectionInterface<Member>|Member[] $members Voice channel only - members in the channel or thread.
62+
* @property MessageRepository $messages Text channel only - messages sent in the channel or thread.
6363
*
6464
* @property Discord $discord The Discord client instance.
6565
*/

0 commit comments

Comments
 (0)