Skip to content

Commit 2577cb2

Browse files
committed
Update Channel.php
1 parent 3c85624 commit 2577cb2

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

src/Discord/Parts/Channel/Channel.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,33 @@ public function sendSoundboardSound(string $sound_id, ?string $source_guild_id =
673673
return $this->http->post(Endpoint::bind(Endpoint::CHANNEL_SEND_SOUNDBOARD_SOUND, $this->id), $payload);
674674
}
675675

676+
/**
677+
* Follow an Announcement Channel to send messages to a target channel.
678+
*
679+
* Requires the MANAGE_WEBHOOKS permission in the target channel.
680+
*
681+
* Returns a followed channel object. Fires a Webhooks Update Gateway event for the target channel.
682+
*
683+
* @link https://docs.discord.com/developers/resources/channel#followed-channel-object
684+
*
685+
* @param string $webhookChannelId ID of the channel to receive crossposted messages.
686+
*
687+
* @return PromiseInterface<array{channel: Channel|int, webhook: int}>
688+
*
689+
* @since 10.46.0
690+
*/
691+
public function follow(string $webhookChannelId): PromiseInterface
692+
{
693+
$payload = ['webhook_channel_id' => $webhookChannelId];
694+
695+
return $this->http->post(Endpoint::bind(Endpoint::CHANNEL_FOLLOW, $this->id), $payload)->then(
696+
fn ($response) => [
697+
'channel' => $this->discord->getChannel($response->channel_id) ?? $response->channel_id,
698+
'webhook' => $response->webhook_id,
699+
]
700+
);
701+
}
702+
676703
/**
677704
* Creates an invite for the channel.
678705
*

src/Discord/Repository/Guild/ScheduledEventRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function fetch(string $id, bool $fresh = false, bool $with_user_count = f
9494
* @param string $id The scheduled event id.
9595
*
9696
* @return PromiseInterface<int> The count of users subscribed to the scheduled event.
97-
*
97+
*
9898
* @since 10.46.0
9999
*/
100100
public function getUsersCount(string $id): PromiseInterface
@@ -112,7 +112,7 @@ public function getUsersCount(string $id): PromiseInterface
112112
* @param array $options
113113
*
114114
* @return PromiseInterface<ExCollectionInterface<User>>
115-
*
115+
*
116116
* @since 10.46.0
117117
*/
118118
public function getExceptionUsers(string $scheduledEventId, string $exceptionId, array $options = []): PromiseInterface

0 commit comments

Comments
 (0)