Skip to content

Commit

Permalink
Add guild splash URL methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Hellyer committed Dec 17, 2016
1 parent b60246d commit d58c544
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/model/guild.rs
Expand Up @@ -137,6 +137,15 @@ impl GuildInfo {
}
}

impl InviteGuild {
/// Returns the formatted URL of the guild's splash image, if one exists.
#[cfg(feature="methods")]
pub fn splash_url(&self) -> Option<String> {
self.icon.as_ref().map(|icon|
format!(cdn!("/splashes/{}/{}.jpg"), self.id, icon))
}
}

impl PartialGuild {
/// Finds a role by Id within the guild.
#[cfg(feature="methods")]
Expand All @@ -163,6 +172,13 @@ impl PartialGuild {
format!(cdn!("/icons/{}/{}.jpg"), self.id, icon))
}

/// Returns the formatted URL of the guild's splash image, if one exists.
#[cfg(feature="methods")]
pub fn splash_url(&self) -> Option<String> {
self.icon.as_ref().map(|icon|
format!(cdn!("/splashes/{}/{}.jpg"), self.id, icon))
}

/// Retrieves the guild's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
Expand Down Expand Up @@ -717,6 +733,13 @@ impl Guild {
rest::get_guild_prune_count(self.id.0, map)
}

/// Returns the formatted URL of the guild's splash image, if one exists.
#[cfg(feature="methods")]
pub fn splash_url(&self) -> Option<String> {
self.icon.as_ref().map(|icon|
format!(cdn!("/splashes/{}/{}.jpg"), self.id, icon))
}

/// Starts a prune of [`Member`]s.
///
/// See the documentation on [`GuildPrune`] for more information.
Expand Down

0 comments on commit d58c544

Please sign in to comment.