Skip to content

Commit

Permalink
Merge pull request #1016 from SQKo/patch-150 build docs
Browse files Browse the repository at this point in the history
Fix thread metadata return, Remove private thread feature check
  • Loading branch information
SQKo authored Dec 13, 2022
2 parents 589f147 + a3db1d9 commit c3290e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/Discord/Parts/Channel/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ protected function getDefaultReactionEmojiAttribute(): ?Reaction
* @link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel
*
* @param array $options Thread params.
* @param bool $options['private'] Whether the thread should be private. cannot start a private thread in a news channel channel. Ignored in forum channel.
* @param bool $options['private'] Whether the thread should be private. Cannot start a private thread in a news channel channel. Ignored in forum channel.
* @param string $options['name'] The name of the thread.
* @param int|null $options['auto_archive_duration'] Number of minutes of inactivity until the thread is auto-archived. one of 60, 1440, 4320, 10080.
* @param bool|null $options['invitable'] Whether non-moderators can add other non-moderators to a thread; only available when creating a private thread.
Expand Down Expand Up @@ -1009,10 +1009,6 @@ public function startThread(array $options, ?string $reason = null): ExtendedPro
return reject(new NoPermissionsException("You do not have permission to create public threads in the channel {$this->id}."));
}
} else {
if (! $this->guild->feature_private_threads) {
return reject(new \RuntimeException('Guild does not have access to private threads.'));
}

if ($botperms && ! $botperms->create_private_threads) {
return reject(new NoPermissionsException("You do not have permission to create private threads in the channel {$this->id}."));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Discord/Parts/Thread/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ protected function getLockedAttribute(): bool
*/
protected function getInvitableAttribute(): ?bool
{
return $this->thread_metadata->invitable;
return $this->thread_metadata->invitable ?? null;
}

/**
Expand All @@ -227,7 +227,7 @@ protected function getInvitableAttribute(): ?bool
*/
protected function getAutoArchiveDurationAttribute(): ?int
{
return $this->thread_metadata->auto_archive_duration;
return $this->thread_metadata->auto_archive_duration ?? null;
}

/**
Expand Down

0 comments on commit c3290e5

Please sign in to comment.