aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/model/guild.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/model/guild.rs b/src/model/guild.rs
index 5ae0804..e136ccc 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<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")]
@@ -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.
@@ -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.