diff --git a/src/Discord/Parts/Channel/Channel.php b/src/Discord/Parts/Channel/Channel.php index 60a50dfa1..bc864de5a 100644 --- a/src/Discord/Parts/Channel/Channel.php +++ b/src/Discord/Parts/Channel/Channel.php @@ -262,6 +262,11 @@ protected function getRecipientsAttribute(): Collection return $recipients; } + + + + + /** * Returns the guild attribute. * @@ -350,6 +355,25 @@ public function setPermissions(Part $part, array $allow = [], array $deny = [], return $this->setOverwrite($part, $overwrite, $reason); } + + /** + * Rename channel + * + * @param string $name + * @return ExtendedPromiseInterface + */ + public function rename(string $name): ExtendedPromiseInterface + { + if ($this->name === $name) { + return reject(new InvalidOverwriteException('The name is already set in the channel.')); + } + + $this->name = $name; + return $this->http->patch(Endpoint::bind(Endpoint::CHANNEL, $this->id),[ + 'name' => $this->name + ]); + } + /** * Sets an overwrite to the channel. * diff --git a/src/Discord/Parts/Interactions/Interaction.php b/src/Discord/Parts/Interactions/Interaction.php index c50bf7937..0388bcd8c 100644 --- a/src/Discord/Parts/Interactions/Interaction.php +++ b/src/Discord/Parts/Interactions/Interaction.php @@ -414,12 +414,16 @@ public function sendFollowUpMessage(MessageBuilder $builder, bool $ephemeral = f * * @return ExtendedPromiseInterface */ - public function respondWithMessage(MessageBuilder $builder, bool $ephemeral = false): ExtendedPromiseInterface + public function respondWithMessage(string|MessageBuilder $builder, bool $ephemeral = false): ExtendedPromiseInterface { if (! in_array($this->type, [InteractionType::APPLICATION_COMMAND, InteractionType::MESSAGE_COMPONENT, InteractionType::MODAL_SUBMIT])) { return reject(new \LogicException('You can only acknowledge application command, message component, or modal submit interactions.')); } + if (is_string($builder)) { + $builder = MessageBuilder::new()->setContent($builder); + } + if ($ephemeral) { $builder->setFlags(Message::FLAG_EPHEMERAL); }