Skip to content

Commit

Permalink
Add GuildId::name() (#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
tverghis committed May 16, 2020
1 parent 3135e0f commit d99bee9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/model/guild/guild_id.rs
Expand Up @@ -568,6 +568,15 @@ impl GuildId {
http.as_ref().edit_member(self.0, user_id.0, &map)
}

/// Returns the name of whatever guild this id holds.
#[cfg(feature = "cache")]
pub fn name(self, cache: impl AsRef<CacheRwLock>) -> Option<String> {
let guild = self.to_guild_cached(&cache)?;
let guild = guild.read();

Some(guild.name.to_string())
}

/// Gets the number of [`Member`]s that would be pruned with the given
/// number of days.
///
Expand Down

0 comments on commit d99bee9

Please sign in to comment.