aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-12-17 11:07:34 -0800
committerAustin Hellyer <[email protected]>2016-12-17 11:10:46 -0800
commitd58c54425a18bbbdc8e66e8eebfb8191bad06901 (patch)
tree095c054197e18228185c19ed9fedfa370b89a284 /src
parentRemove useless cache use (diff)
downloadserenity-d58c54425a18bbbdc8e66e8eebfb8191bad06901.tar.xz
serenity-d58c54425a18bbbdc8e66e8eebfb8191bad06901.zip
Add guild splash URL methods
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.