From aa3cc43daef874a67efdd174941f3d7c385aeecf Mon Sep 17 00:00:00 2001 From: SQKo <87897282+SQKo@users.noreply.github.com> Date: Tue, 13 Dec 2022 13:51:51 +0700 Subject: [PATCH 1/2] Fix thread metadata return --- src/Discord/Parts/Thread/Thread.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Discord/Parts/Thread/Thread.php b/src/Discord/Parts/Thread/Thread.php index 804b19cbc..3d84e7905 100644 --- a/src/Discord/Parts/Thread/Thread.php +++ b/src/Discord/Parts/Thread/Thread.php @@ -216,7 +216,7 @@ protected function getLockedAttribute(): bool */ protected function getInvitableAttribute(): ?bool { - return $this->thread_metadata->invitable; + return $this->thread_metadata->invitable ?? null; } /** @@ -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; } /** From a3db1d9e3828dfd225495562981314d9a824ab5f Mon Sep 17 00:00:00 2001 From: SQKo <87897282+SQKo@users.noreply.github.com> Date: Tue, 13 Dec 2022 13:57:14 +0700 Subject: [PATCH 2/2] remove guild feature private thread check --- src/Discord/Parts/Channel/Channel.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Discord/Parts/Channel/Channel.php b/src/Discord/Parts/Channel/Channel.php index 9509cab56..f06fc9f27 100644 --- a/src/Discord/Parts/Channel/Channel.php +++ b/src/Discord/Parts/Channel/Channel.php @@ -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. @@ -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}.")); }