Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:discord-php/DiscordPHP into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcole1340 committed Mar 4, 2021
2 parents b606073 + 3737f32 commit c4e1dff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/Discord/Parts/Channel/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
* @property string $last_message_id The unique identifier of the last message sent in the channel.
* @property int $bitrate The bitrate of the channel. Only for voice channels.
* @property User $recipient The first recipient of the channel. Only for DM or group channels.
* @property string $recipient_id The ID of the recipient of the channel, if it is a DM channel.
* @property Collection|User[] $recipients A collection of all the recipients in the channel. Only for DM or group channels.
* @property bool $nsfw Whether the channel is NSFW.
* @property int $user_limit The user limit of the channel.
Expand Down Expand Up @@ -139,6 +140,18 @@ protected function getRecipientAttribute(): ?User
return $this->recipients->first();
}

/**
* Gets the recipient ID attribute.
*
* @return string
*/
protected function getRecipientIdAttribute(): ?string
{
if ($this->recipient) {
return $this->recipient->id;
}
}

/**
* Gets the recipients attribute.
*
Expand Down Expand Up @@ -420,7 +433,7 @@ public function createInvite($options = []): ExtendedPromiseInterface
->setAllowedTypes('unique', 'bool')
->setAllowedValues('max_age', range(0, 604800))
->setAllowedValues('max_uses', range(0, 100));

$options = $resolver->resolve($options);

return $this->http->post(Endpoint::bind(Endpoint::CHANNEL_INVITES, $this->id), $options)
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class User extends Part
*/
public function getPrivateChannel(): ExtendedPromiseInterface
{
if ($channel = $this->discord->private_channels->get('id', $this->id)) {
if ($channel = $this->discord->private_channels->get('recipient_id', $this->id)) {
return \React\Promise\resolve($channel);
}

Expand Down

0 comments on commit c4e1dff

Please sign in to comment.