diff --git a/src/model/guild.rs b/src/model/guild.rs index 5ae08042b61..e136ccc9488 100644 --- a/src/model/guild.rs +++ b/src/model/guild.rs @@ -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 { + 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")] @@ -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 { + self.icon.as_ref().map(|icon| + format!(cdn!("/splashes/{}/{}.jpg"), self.id, icon)) + } + /// Retrieves the guild's webhooks. /// /// **Note**: Requires the [Manage Webhooks] permission. @@ -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 { + 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.