Skip to content

Commit

Permalink
Expand delete_messages documentation (#2973)
Browse files Browse the repository at this point in the history
I stated in the document that the function also handles the case of a
single message, also it would be a good idea if it just returns in case
of an empty array.
  • Loading branch information
NiiightmareXD authored Sep 30, 2024
1 parent d3665b7 commit 853f177
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/model/channel/channel_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,18 @@ impl ChannelId {
http.as_ref().delete_message(self, message_id.into(), None).await
}

/// Deletes all messages by Ids from the given vector in the given channel.
/// Deletes messages by Ids from the given vector in the given channel.
///
/// The minimum amount of messages is 2 and the maximum amount is 100.
/// The Discord API supports deleting between 2 and 100 messages at once. This function
/// also handles the case of a single message by calling `delete_message` internally.
///
/// Requires the [Manage Messages] permission.
///
/// **Note**: Messages that are older than 2 weeks can't be deleted using this method.
///
/// # Errors
///
/// Returns [`ModelError::BulkDeleteAmount`] if an attempt was made to delete either 0 or more
/// Returns [`ModelError::BulkDeleteAmount`] if an attempt was made to delete 0 or more
/// than 100 messages.
///
/// Also will return [`Error::Http`] if the current user lacks permission to delete messages.
Expand Down

0 comments on commit 853f177

Please sign in to comment.