diff --git a/src/builder/edit_channel.rs b/src/builder/edit_channel.rs index d5b6572838c..4c4ad3f4a90 100644 --- a/src/builder/edit_channel.rs +++ b/src/builder/edit_channel.rs @@ -141,6 +141,18 @@ impl<'a> EditChannel<'a> { self } + /// The status of the voice channel. Can be empty. + /// + /// Must be between 0 and 1024 characters long. + /// + /// This is for [voice] channels only. + /// + /// [voice]: ChannelType::Voice + pub fn status(mut self, status: impl Into) -> Self { + self.status = Some(status.into()); + self + } + /// Is the channel inappropriate for work? /// /// This is for [text] channels only. @@ -324,6 +336,24 @@ impl<'a> Builder for EditChannel<'a> { } } + if let Some(status) = &self.status { + #[derive(Serialize)] + struct EditVoiceStatusBody<'a> { + status: &'a str, + } + + cache_http + .http() + .edit_voice_status( + ctx, + &EditVoiceStatusBody { + status: status.as_str(), + }, + self.audit_log_reason, + ) + .await?; + } + cache_http.http().edit_channel(ctx, &self, self.audit_log_reason).await } } diff --git a/src/http/client.rs b/src/http/client.rs index 8212022ad80..07ef2b8d5ce 100644 --- a/src/http/client.rs +++ b/src/http/client.rs @@ -2412,6 +2412,28 @@ impl Http { .await } + /// Changes a voice channel's status. + pub async fn edit_voice_status( + &self, + channel_id: ChannelId, + map: &impl serde::Serialize, + audit_log_reason: Option<&str>, + ) -> Result<()> { + let body = to_vec(map)?; + + self.wind(204, Request { + body: Some(body), + multipart: None, + headers: audit_log_reason.map(reason_into_header), + method: LightMethod::Put, + route: Route::ChannelVoiceStatus { + channel_id, + }, + params: None, + }) + .await + } + /// Edits a the webhook with the given data. /// /// The Value is a map with optional values of: diff --git a/src/http/routing.rs b/src/http/routing.rs index 516bd3eea92..47ce4331a18 100644 --- a/src/http/routing.rs +++ b/src/http/routing.rs @@ -194,6 +194,10 @@ routes! ('a, { api!("/channels/{}/polls/{}/expire", channel_id, message_id), Some(RatelimitingKind::PathAndId(channel_id.into())); + ChannelVoiceStatus { channel_id: ChannelId }, + api!("/channels/{}/voice-status", channel_id), + Some(RatelimitingKind::PathAndId(channel_id.into())); + Gateway, api!("/gateway"), Some(RatelimitingKind::Path);