From ea0e0ae866d9405c6e4b3e676fb4b3be6e8b2320 Mon Sep 17 00:00:00 2001 From: jamesbt365 Date: Tue, 28 May 2024 14:23:59 +0100 Subject: [PATCH] Update permissions for start_prune (#2881) https://github.com/discord/discord-api-docs/pull/6688 --- src/model/guild/guild_id.rs | 3 ++- src/model/guild/mod.rs | 5 +++-- src/model/guild/partial_guild.rs | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/model/guild/guild_id.rs b/src/model/guild/guild_id.rs index 602cc8ac0c0..34a9b963613 100644 --- a/src/model/guild/guild_id.rs +++ b/src/model/guild/guild_id.rs @@ -1430,13 +1430,14 @@ impl GuildId { /// /// See the documentation on [`GuildPrune`] for more information. /// - /// **Note**: Requires the [Kick Members] permission. + /// **Note**: Requires [Kick Members] and [Manage Guild] permissions. /// /// # Errors /// /// Returns [`Error::Http`] if the current user lacks permission. /// /// [Kick Members]: Permissions::KICK_MEMBERS + /// [Manage Guild]: Permissions::KICK_MEMBERS #[inline] pub async fn start_prune(self, http: impl AsRef, days: u8) -> Result { http.as_ref().start_guild_prune(self, days, None).await diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs index 487409a278a..1d00445a65f 100644 --- a/src/model/guild/mod.rs +++ b/src/model/guild/mod.rs @@ -2354,7 +2354,7 @@ impl Guild { /// /// See the documentation on [`GuildPrune`] for more information. /// - /// **Note**: Requires the [Kick Members] permission. + /// **Note**: Requires [Kick Members] and [Manage Guild] permissions. /// /// # Errors /// @@ -2366,13 +2366,14 @@ impl Guild { /// Can also return an [`Error::Json`] if there is an error deserializing the API response. /// /// [Kick Members]: Permissions::KICK_MEMBERS + /// [Manage Guild]: Permissions::MANAGE_GUILD /// [`Error::Http`]: crate::error::Error::Http /// [`Error::Json`]: crate::error::Error::Json pub async fn start_prune(&self, cache_http: impl CacheHttp, days: u8) -> Result { #[cfg(feature = "cache")] { if let Some(cache) = cache_http.cache() { - self.require_perms(cache, Permissions::KICK_MEMBERS)?; + self.require_perms(cache, Permissions::KICK_MEMBERS | Permissions::MANAGE_GUILD)?; } } diff --git a/src/model/guild/partial_guild.rs b/src/model/guild/partial_guild.rs index ce53597a71c..fcb440f50ac 100644 --- a/src/model/guild/partial_guild.rs +++ b/src/model/guild/partial_guild.rs @@ -1119,7 +1119,7 @@ impl PartialGuild { /// /// See the documentation on [`GuildPrune`] for more information. /// - /// **Note**: Requires the [Kick Members] permission. + /// **Note**: Requires [Kick Members] and [Manage Guild] permissions. /// /// # Errors /// @@ -1131,6 +1131,7 @@ impl PartialGuild { /// Can also return an [`Error::Json`] if there is an error deserializing the API response. /// /// [Kick Members]: Permissions::KICK_MEMBERS + /// [Manage Guild]: Permissions::MANAGE_GUILD /// [`Error::Http`]: crate::error::Error::Http /// [`Error::Json`]: crate::error::Error::Json pub async fn start_prune(&self, cache_http: impl CacheHttp, days: u8) -> Result {