From 9201de8a6773cc6b6889f0e04f05f9844f80d72b Mon Sep 17 00:00:00 2001 From: "Vladyslav G." Date: Wed, 2 Sep 2026 03:07:39 +0200 Subject: [PATCH] fix(rest): modify a channel with PATCH rather than POST Modify Channel is PATCH /channels/{channel.id}. Sending POST meant every rename, move between categories and permission change made through Channel::modify() was refused by Discord, so nothing that edits a channel after creating it has ever worked. The test covering it asserted the verb the implementation happened to use rather than the one the API documents, so it passed throughout. --- src/Rest/Channel.php | 2 +- tests/Rest/ChannelTest.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Rest/Channel.php b/src/Rest/Channel.php index 75e7438..9626624 100644 --- a/src/Rest/Channel.php +++ b/src/Rest/Channel.php @@ -60,7 +60,7 @@ public function get(string $channelId): PromiseInterface public function modify(string $channelId, ChannelBuilder $channel, ?string $reason = null): PromiseInterface { return $this->mapPromise( - $this->http->post( + $this->http->patch( Endpoint::bind( Endpoint::CHANNEL, $channelId diff --git a/tests/Rest/ChannelTest.php b/tests/Rest/ChannelTest.php index d89236a..bf512be 100644 --- a/tests/Rest/ChannelTest.php +++ b/tests/Rest/ChannelTest.php @@ -141,7 +141,7 @@ public static function httpBindingsProvider(): array 'method' => 'modify', 'args' => ['::channel id::', new GuildTextChannelBuilder()], 'mockOptions' => [ - 'method' => 'post', + 'method' => 'patch', 'return' => (object) [], ], 'validationOptions' => [ @@ -152,7 +152,7 @@ public static function httpBindingsProvider(): array 'method' => 'modify', 'args' => ['::channel id::', new GuildAnnouncementChannelBuilder()], 'mockOptions' => [ - 'method' => 'post', + 'method' => 'patch', 'return' => (object) [], ], 'validationOptions' => [ @@ -163,7 +163,7 @@ public static function httpBindingsProvider(): array 'method' => 'modify', 'args' => ['::channel id::', new GuildStageVoiceChannelBuilder()], 'mockOptions' => [ - 'method' => 'post', + 'method' => 'patch', 'return' => (object) [], ], 'validationOptions' => [ @@ -174,7 +174,7 @@ public static function httpBindingsProvider(): array 'method' => 'modify', 'args' => ['::channel id::', new GuildForumChannelBuilder()], 'mockOptions' => [ - 'method' => 'post', + 'method' => 'patch', 'return' => (object) [], ], 'validationOptions' => [ @@ -185,7 +185,7 @@ public static function httpBindingsProvider(): array 'method' => 'modify', 'args' => ['::channel id::', new GuildVoiceChannelBuilder()], 'mockOptions' => [ - 'method' => 'post', + 'method' => 'patch', 'return' => (object) [], ], 'validationOptions' => [