Skip to content

Commit

Permalink
Deprecate Guild::is_large, Message::is_own, and `Message::is_priv…
Browse files Browse the repository at this point in the history
…ate` (#2825)

These methods are all wrong and/or easily performed without Serenity
doing it.
  • Loading branch information
GnomedDev authored Mar 30, 2024
1 parent 484a4a9 commit d5a71ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/model/channel/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ impl Message {

/// A util function for determining whether this message was sent by someone else, or the bot.
#[cfg(feature = "cache")]
#[deprecated = "Check Message::author is equal to Cache::current_user"]
pub fn is_own(&self, cache: impl AsRef<Cache>) -> bool {
self.author.id == cache.as_ref().current_user().id
}
Expand Down Expand Up @@ -453,6 +454,7 @@ impl Message {
/// never set for those, which this method relies on.
#[inline]
#[must_use]
#[deprecated = "Check if guild_id is None if the message is received from the gateway."]
pub fn is_private(&self) -> bool {
self.guild_id.is_none()
}
Expand Down
8 changes: 5 additions & 3 deletions src/model/guild/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1520,12 +1520,14 @@ impl Guild {
self.id.invites(cache_http.http()).await
}

/// Checks if the guild is 'large'. A guild is considered large if it has more than 250
/// members.
/// Checks if the guild is 'large'.
///
/// A guild is considered large if it has more than 250 members.
#[inline]
#[must_use]
#[deprecated = "Use Guild::large"]
pub fn is_large(&self) -> bool {
self.members.len() > LARGE_THRESHOLD as usize
self.member_count > u64::from(LARGE_THRESHOLD)
}

/// Kicks a [`Member`] from the guild.
Expand Down

0 comments on commit d5a71ed

Please sign in to comment.