diff --git a/src/model/channel/channel_id.rs b/src/model/channel/channel_id.rs index 7fe7e52d646..6fd674f6799 100644 --- a/src/model/channel/channel_id.rs +++ b/src/model/channel/channel_id.rs @@ -279,6 +279,25 @@ impl ChannelId { ) .await } + /// Deletes all of the [`Reaction`]s associated with the provided message id. + /// + /// **Note**: Requires the [Manage Messages] permission. + /// + /// [Manage Messages]: Permissions::MANAGE_MESSAGES + /// + /// # Errors + /// + /// Returns [`Error::Http`] if the current user lacks permission + /// + /// [Manage Messages]: Permissions::MANAGE_MESSAGES + #[inline] + pub async fn delete_reactions( + &self, + http: impl AsRef, + message_id: impl Into, + ) -> Result<()> { + http.as_ref().delete_message_reactions(self.0, message_id.into().0).await + } /// Deletes all [`Reaction`]s of the given emoji to a message within the channel. /// diff --git a/src/model/channel/guild_channel.rs b/src/model/channel/guild_channel.rs index 843470b95cc..68bb1c44f86 100644 --- a/src/model/channel/guild_channel.rs +++ b/src/model/channel/guild_channel.rs @@ -439,6 +439,26 @@ impl GuildChannel { self.id.delete_reaction(&http, message_id, user_id, reaction_type).await } + /// Deletes all of the [`Reaction`]s associated with the provided message id. + /// + /// **Note**: Requires the [Manage Messages] permission. + /// + /// [Manage Messages]: Permissions::MANAGE_MESSAGES + /// + /// # Errors + /// + /// Returns [`Error::Http`] if the current user lacks permission + /// + /// [Manage Messages]: Permissions::MANAGE_MESSAGES + #[inline] + pub async fn delete_reactions( + &self, + http: impl AsRef, + message_id: impl Into, + ) -> Result<()> { + self.id.delete_reactions(http, message_id).await + } + /// Modifies a channel's settings, such as its position or name. /// /// Refer to [`EditChannel`]s documentation for a full list of methods. diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs index b8ce087257c..728011a97b1 100644 --- a/src/model/channel/message.rs +++ b/src/model/channel/message.rs @@ -261,7 +261,28 @@ impl Message { } } - cache_http.http().as_ref().delete_message_reactions(self.channel_id.0, self.id.0).await + self.channel_id.delete_reactions(cache_http.http(), self.id).await + } + + /// Deletes the given [`Reaction`] from the message. + /// + /// **Note**: Requires the [Manage Messages] permission, _if_ the current user did not perform + /// the reaction. + /// + /// # Errors + /// + /// Returns [`Error::Http`] if the current user did not perform the reaction, or lacks + /// permission. + /// + /// [Manage Messages]: Permissions::MANAGE_MESSAGES + #[inline] + pub async fn delete_reaction( + self, + http: impl AsRef, + user_id: Option, + reaction_type: impl Into, + ) -> Result<()> { + self.channel_id.delete_reaction(http, self.id, user_id, reaction_type).await } /// Deletes all of the [`Reaction`]s of a given emoji associated with the message.