Skip to content

Commit

Permalink
Add binding for forum channel thread (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
Exanlv authored Jan 25, 2024
1 parent 2a3eb33 commit 9becea9
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/Rest/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Ragnarok\Fenrir\Rest;

use Discord\Http\Endpoint;
use Discord\Http\Multipart\MultipartBody;
use Ragnarok\Fenrir\Parts\Channel as PartsChannel;
use Ragnarok\Fenrir\Parts\Invite;
use Ragnarok\Fenrir\Parts\Message;
Expand Down Expand Up @@ -567,10 +568,27 @@ public function startThreadWithoutMessage(
}

/**
* @todo implement call
* @see https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel
*
* @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel> includes $message property
*/
public function startThreadInForumChannel(): void
{
public function startThreadInForumChannel(
string $channelId,
MultipartBody|array $params,
?string $reason = null
): ExtendedPromiseInterface {
$forumChannelWithMessage = new class() extends Channel {
public Message $message;
};

return $this->mapPromise(
$this->http->post(
Endpoint::bind(Endpoint::CHANNEL_THREADS, $channelId),
$params,
$this->getAuditLogReasonHeader($reason),
),
$forumChannelWithMessage::class,
);
}

/**
Expand Down

0 comments on commit 9becea9

Please sign in to comment.